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

Removing MSVC C4996 from pragma block at the top of pybind11.h #3129

Merged
merged 3 commits into from
Jul 26, 2021

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jul 17, 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.

@rwgk rwgk marked this pull request as draft July 18, 2021 17:23
@rwgk
Copy link
Collaborator Author

rwgk commented Jul 18, 2021

I'm having second thoughts after review of this spreadsheet: pybind11.h v2.7.0 pragma block analysis

Marking this PR as draft for now.

@@ -56,6 +57,21 @@

PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

PYBIND11_NAMESPACE_BEGIN(detail)

#if defined(_MSC_VER)
Copy link
Collaborator

@Skylion007 Skylion007 Jul 19, 2021

Choose a reason for hiding this comment

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

Instead of poping the warning, I think the recommended way to handle this error is actually to call the _strdup on MSC: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strdup-wcsdup?view=msvc-160 strdup is an alias to it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The 2nd thoughts I had when marking this PR as draft yesterday:

  • Cluttering pybind11 with MSVC-specific things is ugly.
  • Better to simply disable the warning on the command line?

To me it looks like just another MSVC oddity, dirt that I want to keep out of my house, to use stronger words.

But we have similar pros-and-cons for most of the 11 items that I enumerated here yesterday:
pybind11.h v2.7.0 pragma block analysis

I was thinking of suggesting a focused action meeting to go through the list and decide what to do about each one. I'll ping you and @henryiii on slack about it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should do what MSVC wants; like it or not, they are a major target for us. We should not requires any special flags to build without warnings; this is a header-only library and is not always called through build methods we control.

@rwgk rwgk force-pushed the pragma_block_rm_msvc_c4996 branch from 267f86c to 2462d28 Compare July 25, 2021 23:04
@rwgk
Copy link
Collaborator Author

rwgk commented Jul 26, 2021

@henryiii @Skylion007 Please take another look. The latest version is completely different compared to the initial one.

@rwgk rwgk marked this pull request as ready for review July 26, 2021 17:57
@rwgk
Copy link
Collaborator Author

rwgk commented Jul 26, 2021

Thanks! I'll merge this now, then rebase the other PRs.

@rwgk rwgk merged commit ff97f10 into pybind:master Jul 26, 2021
@rwgk rwgk deleted the pragma_block_rm_msvc_c4996 branch July 26, 2021 18:28
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 26, 2021
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jul 26, 2021
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Jul 28, 2021
… __STDC_LIB_EXT1__ is not defined by the implementation.

Follow-on to PR pybind#3129.
rwgk pushed a commit that referenced this pull request Jul 28, 2021
… __STDC_LIB_EXT1__ is not defined by the implementation. (#3151)

Follow-on to PR #3129.
henryiii pushed a commit to henryiii/pybind11 that referenced this pull request Jul 29, 2021
…d#3129)

* Removing MSVC C4996 from pragma block at the top of pybind11.h

* localtime_thread_safe, PYBIND11_COMPAT_STRDUP

* Adding #include <ctime> (attempt to fix MSVC 2015, 2017 errors).
henryiii pushed a commit to henryiii/pybind11 that referenced this pull request Jul 29, 2021
… __STDC_LIB_EXT1__ is not defined by the implementation. (pybind#3151)

Follow-on to PR pybind#3129.
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.

3 participants