-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 large pragma warning
block from pybind11.h to a separate header file.
#2873
Conversation
No. The idea is to unblock doing the right thing on the smart_holder branch (including iwyu cleanup).
Yes and no. Roughly (no opinions, just pros-and-cons):
In any case, that's clearly a question for a separate PR. This PR is just slightly shifting the status-quo, in a way that's immediately helpful. A small step to make things a little better, not an attempt to be perfect. If you want it all at once you may wind up just dwelling on highly localized issues. Note that I am/will be using 2.5 other build tools (blaze/bazel, scons). |
More importantly and crucially, this completely ignores the popping part of the "ignore these warnings": pybind11/include/pybind11/pybind11.h Lines 2284 to 2288 in 74a767d
If you push something onto a stack, better pop it as well in the same scope/context/file.
How exactly did it bite you, if I can ask? I suppose this would happen when you don't include
Agreed with @bstaletic (except that I'm not sure how ignoring these in CMake would interact with user code; @henryiii will know, once he has time again, back from much more important things than pybind11 :-) ). |
@YannickJadoul I updated the PR description to include a link to the CI failures. |
@YannickJadoul asked:
Yes, exactly. See the CI failures. Slightly oversimplified: I'm getting punished for wanting to make the smart_holder code I agree it would be nice to clean up the use of Imagine we had the code refactored as suggested there, the |
I am not in favor of this change. Warnings must be added and popped from the same file. Eventually, a "warn what you use" style would be better, where warnings are removed and popped back just where they are needed (except for a few nonsense warnings that could remain project-wide). Honestly, I bet a few of these could be removed. If someone "IWYU"'s pybind11, this will add warnings from detail/common.h that then never get cleared, masking user code bugs. (We don't really support that, AFAIK, but it highlights why it's wrong to move these). These are just warnings. If you want to do fast development, don't build with warnings turned into errors - problem solved! If you want to put something in master, no warning suppressions can be allowed to leak, and warnings are turned into errors so we don't spew warnings in user code without failing tests (nobody reads test logs unless there's a red ❌). |
Thanks @henryiii I agree with everything you write and request, but my situation is not such that I can jump on tackling every piece of tech debt that I happen to encounter, like this one. Looking at this PR in isolation, you're absolutely right, I'd say the same things. But when I created this PR ~6 weeks ago, I was sitting on the 200+ commits mega PR #2672 that in the meantime has become the start of the smart_holder branch. This PR here is currently a tiny part of the bigger picture, an attempt to keep the smart_holder branch and master in sync as much as my resources allow. There is no evidence that this change breaks anything, but it was necessary for the smart_holder work, in large part to meet the IWYU requests related to PR #2841. I understand, if the smart_holder work is not a shared perspective, it makes sense to reject the change here and demand immediate cleanup of things that I happen to stumble over, at the time when I stumble over them. I wish I had infinite resources to do cleanups on the go, but it's really only me and one other person attempting to integrate pybind11 into PyCLIF. Recurring requests for collateral cleanups is not something we can absorb without help or proper planning and prioritization. That's why I put together the suggested roadmap. I didn't get any feedback. — Many times I was thinking of looking for help inside Google, but I always held off because I heard concerns about an apparent Google takeover. So I feel really boxed in. I will have to plow on with the pybind11 integration into PyCLIF, to see what other major roadblocks I need to work on (the smart_holder work took the better part of 3 months; yesterday we discovered that pybind11 doesn't have support for the I'll change this PR to draft and will keep it around for reference for a while (or until it becomes obsolete). If someone else picks up the cleanup of the warning pragmas in the meantime, I'll do my best to integrate those changes into the smart_holder branch. |
2bb63d0
to
1780d05
Compare
Hi @henryiii, I changed this PR to use a more conservative approach: the |
pragma warning
block from pybind11.h to detail/common.hpragma warning
block from pybind11.h to a separate header file.
…h (fixes MSVC and GCC failures after iwyu cleanup under PR pybind#2672).
1780d05
to
9417ffe
Compare
I removed this from the 2.7 milestone list and marked it as draft for now, although it's one of the biggest diffs between master and smart_holder. But it can wait. I didn't have any merge conflicts because of this diff. |
This PR has become obsolete with the work started under PR #3127. |
I'm sorry @YannickJadoul, I misunderstood this pointer back in February. You are absolutely right. My 2nd attempt, moving the block to a separate file, also wasn't correct of course in hindsight. Unfortunately it took me way too long (yesterday) to realize where the For general reference, if someone looks here in the future, I'm in the middle of a 3rd attempt to enable IWYU cleanup and refactoring of header files. For that I built this list of source code locations from where the suppressed warnings originate, plus an overview spreadsheet. Based on that, currently I don't see an easy way to do it correctly. |
Fixes widespread MSVC and GCC failures (link below) after
iwyu
cleanup under PR #2672.Changelog not needed.
This really bit me, hard, when I was trying to make sense of the error messages, after getting these CI failures:
https://github.com/pybind/pybind11/runs/1965988924