Skip to content

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

Merged
rwgk merged 3 commits into
pybind:masterfrom
rwgk:pragma_block_rm_msvc_c4996
Jul 26, 2021
Merged

Removing MSVC C4996 from pragma block at the top of pybind11.h#3129
rwgk merged 3 commits into
pybind:masterfrom
rwgk:pragma_block_rm_msvc_c4996

Conversation

@rwgk

@rwgkrwgk commented Jul 17, 2021

Copy link
Copy Markdown
Collaborator

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

rwgk commented Jul 18, 2021

Copy link
Copy Markdown
CollaboratorAuthor

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.

Comment threadinclude/pybind11/pybind11.h Outdated

PYBIND11_NAMESPACE_BEGIN(detail)

#if defined(_MSC_VER)

@Skylion007Skylion007Jul 19, 2021

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
CollaboratorAuthor

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
Copy Markdown
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
rwgkforce-pushed the pragma_block_rm_msvc_c4996 branch from 267f86c to 2462d28CompareJuly 25, 2021 23:04
@rwgk

rwgk commented Jul 26, 2021

Copy link
Copy Markdown
CollaboratorAuthor

@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

rwgk commented Jul 26, 2021

Copy link
Copy Markdown
CollaboratorAuthor

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

@rwgk
rwgk merged commit ff97f10 into pybind:masterJul 26, 2021
@rwgk
rwgk deleted the pragma_block_rm_msvc_c4996 branch July 26, 2021 18:28
@github-actionsgithub-actionsBot added the needs changelog Possibly needs a changelog entry label Jul 26, 2021
@rwgkrwgk removed the needs changelog Possibly needs a changelog entry label Jul 26, 2021
rwgk added 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 added 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.
@rwgkrwgk mentioned this pull request Feb 10, 2023
Sign up for freeto 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

@rwgk@Skylion007@henryiii