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

Correct options on Eigen::MappedSparseMatrix & adding MSVC C4127 suppression around Eigen includes. #3352

Merged
merged 3 commits into from
Oct 11, 2021

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Oct 11, 2021

Description

This PR combines the original change from PR #3343 (by @cantonios, with extra line breaks) with newly added MSVC warning suppressions to enable full testing with Eigen 3.4.0.

Suggested changelog entry:

A long-standing bug in eigen.h was fixed (originally PR #3343). The bug was unmasked by newly added ``static_assert``s in the Eigen 3.4.0 release.

@Skylion007
Copy link
Collaborator

Looks like it needs to be around the offending test_eigen.cpp . Disappointing.

@rwgk
Copy link
Collaborator Author

rwgk commented Oct 11, 2021

Looks like it needs to be around the offending test_eigen.cpp . Disappointing.

Indeed, BUT apparently MSVC 2015 only. That's good enough for me: I'll add the C4127 at the top of test_eigen.cpp, but for MSVC 2015 only. We'll still have plenty of coverage for C4127 issues in the test code itself via the more modern MSVC versions.

@rwgk rwgk requested review from henryiii and Skylion007 October 11, 2021 19:25
Comment on lines +16 to +18
#if _MSC_VER < 1910 // VS 2015's MSVC
# pragma warning(disable: 4127) // C4127: conditional expression is constant
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need this here? Isn't it suppressed in the include in pybind11? If that doesn't work, why are we suppressing it in the include?

Copy link
Collaborator

@Skylion007 Skylion007 Oct 11, 2021

Choose a reason for hiding this comment

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

@henryiii It works except for MSCV2015. So we need to do both.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Of course. 🤦 Okay.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For MSVC 2015 only the suppression in eigen.h is not sufficient:
https://github.com/pybind/pybind11/runs/3862647055?check_suite_focus=true

The suppression in eigen.h is for all MSVC versions, but only applies to the Eigen includes.
The suppression here is only for MSVC 2015, but global to this .cpp file.

…o not run past 99 columns (our desired but currently not enforced limit).
@henryiii henryiii closed this Oct 11, 2021
@henryiii henryiii reopened this Oct 11, 2021
@rwgk
Copy link
Collaborator Author

rwgk commented Oct 11, 2021

Appveyor is happy now (yay!) but there is a known flake (sigh).

@henryiii
Copy link
Collaborator

Known flakes are fine, not blockers.

@rwgk rwgk changed the title Adding MSVC C4127 suppression around Eigen includes. Correct options on Eigen::MappedSparseMatrix & adding MSVC C4127 suppression around Eigen includes. Oct 11, 2021
@rwgk
Copy link
Collaborator Author

rwgk commented Oct 11, 2021

Thanks all! @cantonios I'm including your change here to keep things simple.

@rwgk rwgk marked this pull request as ready for review October 11, 2021 20:12
@rwgk rwgk merged commit 7c58058 into pybind:master Oct 11, 2021
@rwgk rwgk deleted the eigen_c4127 branch October 11, 2021 20:13
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Oct 11, 2021
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Dec 21, 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.

3 participants