Skip to content
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

Moving pragma for MSVC warning C4505 from pybind11.h to existing list in detail/common.h #3160

Merged
merged 3 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.

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

Worksheet

@rwgk rwgk marked this pull request as ready for review July 30, 2021 11:07
@rwgk rwgk requested review from henryiii and Skylion007 July 30, 2021 11:07
@@ -13,7 +13,6 @@
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
# pragma warning(push)
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
# pragma warning(disable: 4505) // warning C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like that we lose the comment here, especially the PyPy only part. Could we move the comment to just above the other place? Also, we could make this PyPy only, if we wanted to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll copy it over to the other place. It will look odd though as the only one. What do you think about adding the message for all diagnostics, for completeness?

Also, we could make this PyPy only, if we wanted to.

I was thinking about that but

  • how do we know that we have PyPy before including Python.h?

  • how much do we want to, given 1. that there are four other diagnostics already, 2. how useful is the warning, really? The suppression is not even for our code.

But in any case, if there is a practical method to make it PyPy only, I'd be happy to do it that way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about adding the message for all diagnostics, for completeness?

+1, if you want to do it :)

how do we know that we have PyPy before including Python.h?

This is probably why it's there without a check for PyPy currently. My only worry is that, like hiding any warning, you are also are losing sensitivity to what it was supposed to catch as well. Perfectly fine with not making it depend on PyPy then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@henryiii please take another look: it turns out none of the existing four suppressions is needed anymore.

@rwgk rwgk marked this pull request as draft July 30, 2021 14:22
@rwgk rwgk force-pushed the pragma_block_rm_msvc_c4505 branch from 2c8aa67 to d9d124b Compare July 30, 2021 14:22
@rwgk rwgk marked this pull request as ready for review July 30, 2021 15:31
@rwgk rwgk merged commit e2573dc into pybind:master Jul 30, 2021
@rwgk rwgk deleted the pragma_block_rm_msvc_c4505 branch July 30, 2021 17:51
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 30, 2021
henryiii pushed a commit that referenced this pull request Jul 30, 2021
… in detail/common.h (#3160)

* Moving pragma for C4505 from pybind11.h to existing list in detail/common.h.

* Removing 4 existing suppressions to 1. see what is still needed and 2. capture the MSVC messages.

* It turns out none of the 4 pragmas are needed anymore.
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jul 30, 2021
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