correct fallthrough macro (#154)
* correct fallthrough macro Signed-off-by: Karsten Knese <karsten@openrobotics.org>
This commit is contained in:
parent
f6866c5fc1
commit
f41de1673a
1 changed files with 5 additions and 2 deletions
|
@ -15,15 +15,18 @@
|
|||
#ifndef FALLTHROUGH_MACRO_HPP_
|
||||
#define FALLTHROUGH_MACRO_HPP_
|
||||
|
||||
#if __has_cpp_attribute(fallthrough) || (__cplusplus >= 201603L)
|
||||
#if __cplusplus >= 201603L
|
||||
// C++17
|
||||
#define FALLTHROUGH [[fallthrough]]
|
||||
#elif __has_cpp_attribute(clang::fallthrough)
|
||||
// Clang
|
||||
#define FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif __has_cpp_attribute(gnu::fallthrough)
|
||||
// gcc with gnu extension
|
||||
#define FALLTHROUGH [[gnu::fallthrough]]
|
||||
#else
|
||||
// gcc
|
||||
#define FALLTHROUGH /* fallthrough */
|
||||
#define FALLTHROUGH /* FALLTHROUGH */
|
||||
#endif
|
||||
|
||||
#endif // FALLTHROUGH_MACRO_HPP_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue