-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow -Wpedantic in C++20 mode #5322
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -479,6 +479,8 @@ PYBIND11_WARNING_POP | |||
} | |||
|
|||
\endrst */ | |||
PYBIND11_WARNING_PUSH | |||
PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double-checking: is this needed, even with -std=c++20
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
* 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]>
Description
I think we can support
-Wpedandic
in 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