fix: allow -Wpedantic in C++20 mode#5322
Merged
henryiii merged 5 commits intopybind:masterfrom Aug 22, 2024
Merged
Conversation
37cd500 to
10c5398
Compare
6605ad4 to
bdf929c
Compare
Signed-off-by: Henry Schreiner <[email protected]>
bdf929c to
1a6fca3
Compare
Signed-off-by: Henry Schreiner <[email protected]>
6e02b58 to
b0e2ac3
Compare
Signed-off-by: Henry Schreiner <[email protected]>
6a8463d to
641f9ba
Compare
Signed-off-by: Henry Schreiner <[email protected]>
641f9ba to
b3d5042
Compare
henryiii
commented
Aug 21, 2024
3 tasks
rwgk
approved these changes
Aug 22, 2024
Collaborator
rwgk
left a comment
There was a problem hiding this comment.
Thanks for the cleanup!
I think it's a great compromise, to turn on the option only for C++20. That'll will catch pretty much everything already.
|
|
||
| \endrst */ | ||
| PYBIND11_WARNING_PUSH | ||
| PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments") |
Collaborator
There was a problem hiding this comment.
Just double-checking: is this needed, even with -std=c++20?
Collaborator
Author
There was a problem hiding this comment.
Yeah, for some reason Clang produces a warning here. GCC is fine, but Clang complains. It produces a warning saying this is a C++20 feature on newer compilers if set less than C++20, so no idea why the old warning triggers in C++20 mode. I think it's a bug.
henryiii
added a commit
that referenced
this pull request
Aug 22, 2024
* fix: allow -Wpedantic again Signed-off-by: Henry Schreiner <[email protected]> * tests: ignore pedantic warning for PYBIND11_DECLARE_HOLDER_TYPE Signed-off-by: Henry Schreiner <[email protected]> * tests: try just turning off pedantic for one file Signed-off-by: Henry Schreiner <[email protected]> * tests: only run pedantic in C++20 mode Signed-off-by: Henry Schreiner <[email protected]> * Update tests/local_bindings.h --------- Signed-off-by: Henry Schreiner <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I think we can support
-Wpedandicin C++20 mode. Before that the variadic macros cause warnings that are pretty much impossible to fix from a macro AFAICT. Fix #5310.Suggested changelog entry:
* Support ``-Wpedantic`` in C++20 mode