Skip to content

Commit f24f045

Browse files
authored
C++: turn on -Weverything (#4104)
### What ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/4104) (if applicable) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/4104) - [Docs preview](https://rerun.io/preview/d084501dddbe035eb3022b1b7afd80cfbdc2fb24/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/d084501dddbe035eb3022b1b7afd80cfbdc2fb24/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://ref.rerun.io/dev/bench/) - [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
1 parent a143e9d commit f24f045

File tree

10 files changed

+42
-16
lines changed

10 files changed

+42
-16
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ DerivePointerAlignment: false
1919
EmptyLineBeforeAccessModifier: LogicalBlock
2020
IndentWidth: 4
2121
IndentWrappedFunctionNames: true
22+
InsertBraces: true
2223
InsertTrailingCommas: Wrapped
2324
MaxEmptyLinesToKeep: 1
2425
NamespaceIndentation: All

.github/workflows/documentation.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
# BEWARE(streetsidesoftware/cspell-action#187): a misconfigured cspell will _not_ have a non-zero exit code...
13+
# BEWARE(streetsidesoftware/cspell-action#187): a misconfigured cspell will _not_ have a non-zero exit code
1414
spellcheck:
1515
name: Spellcheck
1616
runs-on: ubuntu-latest
@@ -34,7 +34,7 @@ jobs:
3434
paths: "**/*.c, **/*.cpp, **/*.fbs, **/*.h, **/*.hpp, **/*.js, **/*.md, **/*.py, **/*.rs, **/*.sh, **/*.toml, **/*.txt, **/*.wgsl, **/*.yml"
3535

3636
# Avoid crates.io rate-limiting, skip changelog PR links (so many), and skip speculative links
37-
# TODO(##4085): https://rerun-io.github.io/rerun/dev/bench/ often 404:s for unknown reasons
37+
# TODO(#4085): https://rerun-io.github.io/rerun/dev/bench/ often 404:s for unknown reasons
3838
linksToSkip: "https://crates.io/crates/.*, https://github.com/rerun-io/rerun/pull/.*, .*?speculative-link, https://rerun-io.github.io/rerun/dev/bench/"
3939
retry: true
4040
retryErrors: true

CMakeLists.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,40 @@ function(set_default_warning_settings target)
3030
-Wpointer-arith
3131
-Wshadow
3232
-Wswitch-enum
33+
-Wunreachable-code
3334
-Wvla
3435
)
3536

3637
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # match both "Clang" and "AppleClang"
3738
target_compile_options(${target} PRIVATE
3839
-Wc++17-compat-pedantic
3940
-Wc++20-compat-pedantic
40-
-Wpre-c2x-compat-pedantic
4141
-Wc99-extensions
42+
-Weverything
4243
-Wgnu
4344
-Wnon-gcc
45+
-Wpre-c2x-compat-pedantic
4446
-Wshadow-all
47+
48+
# Turn off some warning that -Weverything turns on:
49+
-Wno-c++98-compat
50+
-Wno-c++98-compat-pedantic
51+
-Wno-covered-switch-default # We often add a `default:` case out of paranoia
52+
-Wno-ctad-maybe-unsupported
53+
-Wno-disabled-macro-expansion
54+
-Wno-documentation
55+
-Wno-documentation-unknown-command
56+
-Wno-double-promotion # float->double is nothing to whine about
57+
-Wno-exit-time-destructors
58+
-Wno-float-equal # comparing floats is fine
59+
-Wno-global-constructors
60+
-Wno-missing-prototypes
61+
-Wno-padded
62+
-Wno-reserved-id-macro
63+
-Wno-reserved-identifier
64+
-Wno-unreachable-code-break # TODO(emilk): remove this exception - we only need this because of codegen
65+
-Wno-unreachable-code-return # TODO(emilk): remove this exception - we only need this because of codegen
66+
-Wno-unused-macros
4567
)
4668
endif()
4769

examples/cpp/clock/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ int main() {
5050
log_hand(rec, "seconds", step, (step % 60) / 60.0f, LENGTH_S, WIDTH_S, 0);
5151
log_hand(rec, "minutes", step, (step % 3600) / 3600.0f, LENGTH_M, WIDTH_M, 128);
5252
log_hand(rec, "hours", step, (step % 43200) / 43200.0f, LENGTH_H, WIDTH_H, 255);
53-
};
53+
}
5454
}

pixi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ cpp-build-and-test-all = { depends_on = ["cpp-build-all", "cpp-test"] }
9898
[dependencies]
9999
attrs = ">=23.1.0"
100100
blackdoc = "0.3.8"
101-
clang-tools = ">=15,<16"
101+
clang-tools = ">=15,<16" # clang-format
102102
cmake = "3.27.6"
103103
flatbuffers = ">=23"
104104
gitignore-parser = ">=0.1.9"

rerun_cpp/src/rerun/arrow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace rerun {
99
Result<std::shared_ptr<arrow::Buffer>> ipc_from_table(const arrow::Table& table) {
10-
ARROW_ASSIGN_OR_RAISE(auto output, arrow::io::BufferOutputStream::Create());
11-
ARROW_ASSIGN_OR_RAISE(auto writer, arrow::ipc::MakeStreamWriter(output, table.schema()));
10+
ARROW_ASSIGN_OR_RAISE(auto output, arrow::io::BufferOutputStream::Create())
11+
ARROW_ASSIGN_OR_RAISE(auto writer, arrow::ipc::MakeStreamWriter(output, table.schema()))
1212
ARROW_RETURN_NOT_OK(writer->WriteTable(table));
1313
ARROW_RETURN_NOT_OK(writer->Close());
1414

rerun_cpp/src/rerun/datatypes/translation_rotation_scale3d.hpp

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rerun_cpp/src/rerun/datatypes/translation_rotation_scale3d_ext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ namespace rerun {
2828
: translation(other.translation),
2929
rotation(other.rotation),
3030
scale(other.scale),
31-
from_parent(other.from_parent){};
31+
from_parent(other.from_parent) {}
32+
3233
DISABLE_MAYBE_UNINITIALIZED_POP
3334

3435
/// Creates a new 3D transform from translation/rotation/scale.

rerun_cpp/tests/recording_stream.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ SCENARIO("RecordingStream can log to file", TEST_TAG) {
282282
std::string test_rrd0 = std::string(test_path) + "test-file-0.rrd";
283283
std::string test_rrd1 = std::string(test_path) + "test-file-1.rrd";
284284

285-
fs::remove(test_rrd0.c_str());
286-
fs::remove(test_rrd1.c_str());
285+
fs::remove(test_rrd0);
286+
fs::remove(test_rrd1);
287287

288288
GIVEN("a new RecordingStream") {
289289
auto stream0 = std::make_unique<rerun::RecordingStream>("test");
@@ -299,16 +299,16 @@ SCENARIO("RecordingStream can log to file", TEST_TAG) {
299299
// }
300300
AND_GIVEN("valid save path " << test_rrd0) {
301301
AND_GIVEN("a directory already existing at this path") {
302-
fs::create_directory(test_rrd0.c_str());
302+
fs::create_directory(test_rrd0);
303303
THEN("then the save call fails") {
304304
CHECK(
305-
stream0->save(test_rrd0.c_str()).code ==
305+
stream0->save(test_rrd0).code ==
306306
rerun::ErrorCode::RecordingStreamSaveFailure
307307
);
308308
}
309309
}
310310
THEN("save call returns no error") {
311-
REQUIRE(stream0->save(test_rrd0.c_str()).is_ok());
311+
REQUIRE(stream0->save(test_rrd0).is_ok());
312312

313313
THEN("a new file got immediately created") {
314314
CHECK(fs::exists(test_rrd0));
@@ -318,7 +318,7 @@ SCENARIO("RecordingStream can log to file", TEST_TAG) {
318318
auto stream1 = std::make_unique<rerun::RecordingStream>("test2");
319319

320320
WHEN("saving that one to a different file " << test_rrd1) {
321-
REQUIRE(stream1->save(test_rrd1.c_str()).is_ok());
321+
REQUIRE(stream1->save(test_rrd1).is_ok());
322322

323323
WHEN("logging a component to the second stream") {
324324
check_logged_error([&] {

scripts/lint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def lint_line(line: str, file_extension: str = "rs", is_in_docstring: bool = Fal
5757
if "NOLINT" in line:
5858
return None # NOLINT ignores the linter
5959

60-
if file_extension not in ("py", "txt", "yml"):
60+
if file_extension not in ("py", "txt", "yaml", "yml"):
6161
if "Github" in line:
6262
return "It's 'GitHub', not 'Github'"
6363

@@ -706,6 +706,7 @@ def main() -> None:
706706
"toml",
707707
"txt",
708708
"wgsl",
709+
"yaml",
709710
"yml",
710711
]
711712

0 commit comments

Comments
 (0)