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
Config support for fallthrough attribute #2717
Conversation
hpx/config/attributes.hpp
Outdated
#include <hpx/config/defines.hpp> | ||
|
||
#if defined(HPX_HAVE_CXX17_FALLTHROUGH_ATTRIBUTE) | ||
# define HPX_FALLTHROUGH [[fallthrough]]; |
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'd suggest to remove the semicolon from the macro definition. Let's leave this to the user. This is not a big issue, some compilers warn about duplicate semicolons, though...
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.
Duplicate semicolon because the user may follow the macro with a semicolon?
HPX_FALLTHROUGH;
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.
Yes, that's what I meant. But the main rationale would be to have the semicolon in user code. A casual reader might not 'know' that HPX_FALLTHROUGH
is a macro...
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 agree, thanks for the review! Fixed.
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.
LGTM, thanks!
FWIW: this describes how things are implemented in gcc: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/ |
Adds a feature test for C++17
[[fallthrough]]
and removes gcc 7.1 warnings complaining about a possible fallthrough.