-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
-Wimplicit-fallthrough generating warnings #121040
Comments
A potential fix could look something like: #if __has_attribute(__fallthrough__)
# define _Py_FALLTHROUGH __attribute__((__fallthrough__))
#else
# define _Py_FALLTHROUGH do { } while (0)
#endif |
Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if available.
Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if available. Fix warnings when using -Wimplicit-fallthrough compiler flag.
I wrote PR gh-121044 to fix these compiler warnings; the PR adds a new _Py_FALLTHROUGH macro. |
It can not be the ultimate solution.
|
Does MSC implement a flag like
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. |
But it emits the compiler warning so we should provide dummy macro for the MSVC |
You misunderstood the warning. It was only about |
Fix warnings when using -Wimplicit-fallthrough compiler flag. Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if available. Replace "fall through" comments with _Py_FALLTHROUGH. Add _Py__has_attribute() macro. No longer define __has_attribute() macro if it's not defined. Move also _Py__has_builtin() at the top of pyport.h. Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
Warnings were fixed by 12af8ec. I close the issue. |
…h-121041) Remove fallthrough warnings
Fix warnings when using -Wimplicit-fallthrough compiler flag. Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if available. Replace "fall through" comments with _Py_FALLTHROUGH. Add _Py__has_attribute() macro. No longer define __has_attribute() macro if it's not defined. Move also _Py__has_builtin() at the top of pyport.h. Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
…h-121041) Remove fallthrough warnings
Fix warnings when using -Wimplicit-fallthrough compiler flag. Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if available. Replace "fall through" comments with _Py_FALLTHROUGH. Add _Py__has_attribute() macro. No longer define __has_attribute() macro if it's not defined. Move also _Py__has_builtin() at the top of pyport.h. Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
…h-121041) Remove fallthrough warnings
Fix warnings when using -Wimplicit-fallthrough compiler flag. Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if available. Replace "fall through" comments with _Py_FALLTHROUGH. Add _Py__has_attribute() macro. No longer define __has_attribute() macro if it's not defined. Move also _Py__has_builtin() at the top of pyport.h. Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
Bug report
Bug description:
Due to the addition of
-Wimplicit-fallthrough
as aBASEFLAG
new 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
The text was updated successfully, but these errors were encountered: