Skip to content

Commit

Permalink
build: Enable some commonly enabled compiler diagnostics
Browse files Browse the repository at this point in the history
Summary:
> as discussed in [[ bitcoin/bitcoin#17344 | #17344]]
>
> There is a large overlap between this list and Jason Turner's list of recommended compiler diagnostics in the Collaborative Collection of C++ Best Practices (cppbestpractices) project. There is also an overlap with the recommendations given in the C++ Core Guidelines (with editors Bjarne Stroustrup and Herb Sutter).

This is a backport of [[bitcoin/bitcoin#19015 | core#19015]]

Disable `-Wduplicated-branches` for secp256k1, because of some exotic intentional use of ternary operator duplicated branches in test_inverse_scalar.

Test Plan:
```
cmake .. -GNinja -DCMAKE_CXX_FLAGS=-Werror -DCMAKE_C_FLAGS=-Werror
ninja && ninja check && ninja check-secp256k1
rm -Rf *
cmake .. -GNinja  -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-Werror  -DCMAKE_C_FLAGS=-Werror
ninja && ninja check && ninja check-secp256k1
```

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10113
  • Loading branch information
PiRK committed Sep 15, 2021
1 parent 420e0cf commit 6fc1400
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -52,6 +52,7 @@ add_c_compiler_flags(
-Wnested-externs
-Wstrict-prototypes
-Wno-long-long
-Wno-duplicated-branches
)

# Default visibility is hidden on all targets.
Expand Down

0 comments on commit 6fc1400

Please sign in to comment.