Skip to content

Limiting pragma for ignoring GCC 7 -Wnoexcept-type to the scope of pybind11.h. #3161

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

Merged
merged 4 commits into from
Jul 30, 2021

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jul 30, 2021

Follow-on to PR #3127, based on results obtained under PR #3125.

Note that the pragma for -Wnoexcept-type is moved from above to below all #includes. This unblocks refactoring and IWYU cleanup (and eventually merging the smart_holder branch).

It is somewhat of a coincidence that the moved pragma is still in the same header file. Potentially, the pragma for -Wnoexcept-type may need to be copied to refactored header files, but that's the price we have to pay for improved code organization with the added requirement to not suppress warnings from the command line (for portability).

The suggested changelog entry will be in the final PR of this cleanup series.

Worksheet

@rwgk rwgk changed the title Moving pragma for ignoring -Wnoexcept-type to the one location where it is needed. Limiting pragma for ignoring GCC 7 -Wnoexcept-type to the scope of pybind11.h. Jul 30, 2021
@rwgk rwgk marked this pull request as ready for review July 30, 2021 13:25
@rwgk rwgk requested review from henryiii and Skylion007 July 30, 2021 13:26
Comment on lines 53 to 55
It seems very unlikely that this warning will be useful to anyone (no other GCC version
generates it), but to be maximally accommodating we turn it off here instead of using a
command line option.
Copy link
Collaborator

@henryiii henryiii Jul 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other GCC version generates it

🤣

Suggested change
It seems very unlikely that this warning will be useful to anyone (no other GCC version
generates it), but to be maximally accommodating we turn it off here instead of using a
command line option.
No other GCC version generates this warning.

Too much information, we want pybind11 to compile out of the box with no warnings if possible, and that's why we carefully remove a few warnings, including this one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change applied. Thanks!

@rwgk
Copy link
Collaborator Author

rwgk commented Jul 30, 2021

Thanks Henry!

The one failing CI job is a test_iostream flake. Safe to ignore, especially because it worked in the previous CI run and the only change was to a comment.

@rwgk rwgk merged commit b425972 into pybind:master Jul 30, 2021
@rwgk rwgk deleted the pragma_block_rm_noexcept_type branch July 30, 2021 14:09
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 30, 2021
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jul 30, 2021
henryiii pushed a commit that referenced this pull request Jul 30, 2021
…bind11.h. (#3161)

* Moving pragma for ignoring -Wnoexcept-type to the one location where it is needed.

* Trying a second location.

* The previous commit worked (GitHub Actions green), but see the added comment about the dicy nature of -Wnoexcept-type ("if and only if").

* Applying reviewer suggestion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants