-
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
[lib] Make lib compatible with -Wfall-through
excepting legacy
#2796
Conversation
2cbf7f2
to
7625182
Compare
This feature was also recently added to |
It looks like this section can be simplified with We can definitely add on the section that uses the C/C++ language attribute |
Apparently, the macro determination code in |
|
lib/common/compiler.h
Outdated
# if __has_attribute(__fallthrough__) | ||
# define ZSTD_FALLTHROUGH __attribute__((__fallthrough__)) | ||
# else | ||
# define ZSTD_FALLTHROUGH /* fall-through */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume this will not add a comment where this macro is invoked ?
fce08a7
to
640a81c
Compare
Switch to a macro `ZSTD_FALLTHROUGH;` instead of a comment. On supported compilers this uses an attribute, otherwise it becomes a comment. This is necessary to be compatible with clang's `-Wfall-through`, and gcc's `-Wfall-through=2` which don't support comments. Without this the linux build emits a bunch of warnings. Also add a test to CI to ensure that we don't regress.
640a81c
to
189e87b
Compare
Switch to a macro
ZSTD_FALLTHROUGH;
instead of a comment. On supportedcompilers this uses an attribute, otherwise it becomes a comment.
This is necessary to be compatible with clang's
-Wfall-through
, andgcc's
-Wfall-through=2
which don't support comments. Without this thelinux build emits a bunch of warnings.
Also add a test to CI to ensure that we don't regress.