-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
/std:c++20 instead of /std:c++17 used for _wmimodule.cpp, but seems unnecessary #99191
Comments
I guess that /std:c++17 is fine and maybe @zooba just picked the default when he created the new project. |
Basically, Argument Clinic generates files that aren't valid C++ prior to C++20, because it uses designated initializers. Since I know I'm releasing with a compiler that supports them, I opt-in, but to allow other people to build and debug, it's easy enough to create a METH_O API directly around the I don't think we have any way to detect the compiler version in the build files, but if there is, we could make the option conditional on having an old compiler. |
Oh wow, now I recall all issues that I had when I wrote Lib/test/test_cppext.py! See Lib/test/_testcppext.cpp: it doesn't use designated initializers for this reason. test_cppext checks the compatibility of the public Python C API with C++03 and C++11. |
For the specific case of _wmimodule.cpp, it's a single function which uses Argument Clinic. This function has a single argument. Writing the code by hand to parse its only argument should be easy, if someone has issues with C++17 and older. |
Ah, thanks for the clarification!
Isn't this what the current code already does, on versions of MSVC older than 19.29 (that don't support C++20)? Though, I am curious—why indirectly check via this, and not
Yeah, they're static, and while there's The one point of note is that it means that compilers that don't support C++20 will fall back to C++14 instead, rather than C++17 (though at least as of now, this doesn't appear to make an easily noticeable difference); perhaps |
I wasn't aware of that variable, that's why.
If that works, it's fine by me. But I thought the complaint was about additional warnings being seen by users on old versions of MSVC? Contradictory options usually result in more warnings (though this one may have been seen as a reasonable exception... the MSVC team is slowly learning that projects are built on purpose by people who aren't all on a homogenous setup maintained by their IT admin ;) ) |
Oh; I'd seen the docs say "If CL encounters conflicting options, it uses the rightmost option" and I didn't see any additional warnings when I tested it on VS 2017, but it turns out that was just because that However, I could make a PR to change the check to |
This seems like goodness regardless of any other changes. Ideally I'd prefer to feature test, but we may as well test the correct version if we're having a version test. |
Sorry for the delay; finally opened PR #100381 to implement that. |
@python/windows-team
I noticed the VS project file
_wmi.cxproj
for_wmimodule.cpp
added for 3.12 to support using WMI on Windows to getplatform
data in issue #89545 / PR #96289 specifies C++20 mode via the compiler flag/std:c++20
. The flag (and partially-complete C++20 support) was only added in VS 2019 16.11, and produces a compiler warning in VS 2017 15.9 stating the flag was ignored.This is the only file that requires it and there were no relevant hints in the issue, PR, or commit history as to why it was required. Despite the flag being ignored, there were no compiler errors or other warnings, and both the full test suite (minus a couple clearly unrelated issues) and running
test_wmi
andtest_platform
with-u all
passed, and the same was true when I recompiled it with/std:c++17
(added in VS 2017 15.8 and used a couple other files), which naturally avoids the warning.Therefore, it would seems specifying C++20 is unnecessary, and it can be changed to
/std:c++17
to avoid compiler warnings and use a consistent C++ standard version with the other files, unless there's something I'm missing here (entirely possible, of course). Any reason this was added?Linked PRs
The text was updated successfully, but these errors were encountered: