correct fallthrough macro (#154)

* correct fallthrough macro

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
This commit is contained in:
Karsten Knese 2020-04-14 15:41:11 -07:00 committed by GitHub
parent f6866c5fc1
commit f41de1673a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,15 +15,18 @@
#ifndef FALLTHROUGH_MACRO_HPP_ #ifndef FALLTHROUGH_MACRO_HPP_
#define FALLTHROUGH_MACRO_HPP_ #define FALLTHROUGH_MACRO_HPP_
#if __has_cpp_attribute(fallthrough) || (__cplusplus >= 201603L) #if __cplusplus >= 201603L
// C++17 // C++17
#define FALLTHROUGH [[fallthrough]] #define FALLTHROUGH [[fallthrough]]
#elif __has_cpp_attribute(clang::fallthrough) #elif __has_cpp_attribute(clang::fallthrough)
// Clang // Clang
#define FALLTHROUGH [[clang::fallthrough]] #define FALLTHROUGH [[clang::fallthrough]]
#elif __has_cpp_attribute(gnu::fallthrough)
// gcc with gnu extension
#define FALLTHROUGH [[gnu::fallthrough]]
#else #else
// gcc // gcc
#define FALLTHROUGH /* fallthrough */ #define FALLTHROUGH /* FALLTHROUGH */
#endif #endif
#endif // FALLTHROUGH_MACRO_HPP_ #endif // FALLTHROUGH_MACRO_HPP_