Repository navigation
-Wimplicit-fallthrough generating warnings #121040
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jun 26, 2024 A potential fix could look something like:
#if __has_attribute(__fallthrough__) # define _Py_FALLTHROUGH __attribute__((__fallthrough__)) #else # define _Py_FALLTHROUGH do { } while (0) #endif
A potential fix could look something like: (...)
I wrote PR gh-121044 to fix these compiler warnings; the PR adds a new _Py_FALLTHROUGH macro.
A potential fix could look something like:
It can not be the ultimate solution.
- Should check MSVC is accept this macro. (or do nothing if the compiler is MSVC)
- Even if we added the macro for our codebase, vendored libraries like libexpat should follow the new compiler rule.
Should check MSVC is accept this macro. (or do nothing if the compiler is MSVC)
Does MSC implement a flag like
-Wimplicit-fallthrough? If not, I don't think that we should care about MSC in _Py_FALLTHROUGH macro.Even if we added the macro for our codebase, vendored libraries like libexpat should follow the new compiler rule.
If you want to use this compiler flag, you can use system libraries, instead of building embedded copies of libexpat and libmpdecimal.
If you want to use this compiler flag, you can use system libraries, instead of building embedded copies of libexpat and libmpdecimal.
IIUC, the original intention was to adopt that compiler flag as default, not optional.
Does MSC implement a flag like -Wimplicit-fallthrough? If not, I don't think that we should care about MSC in _Py_FALLTHROUGH macro.
But it emits the compiler warning so we should provide dummy macro for the MSVC
see: https://github.com/python/cpython/pull/121044/files#r1654967484But it emits the compiler warning so we should provide dummy macro for the MSVC
see: https://github.com/python/cpython/pull/121044/files#r1654967484You misunderstood the warning. It was only about
__has_attribute(). I fixed this issue.- added a commit that references this issue
on Jun 27, 2024 Warnings were fixed by 12af8ec. I close the issue.
Bug report
Bug description:
Due to the addition of
-Wimplicit-fallthroughas aBASEFLAGnew warnings are generated.This should be reverted until tooling is created to track these new warnings per #112301
Warnings can be found in builds https://buildbot.python.org/all/#/builders/721/builds/1465/steps/3/logs/warnings__143_ from #121030
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs