diff --git a/rmw_cyclonedds_cpp/src/fallthrough_macro.hpp b/rmw_cyclonedds_cpp/src/fallthrough_macro.hpp index ceb02d2..47330ea 100644 --- a/rmw_cyclonedds_cpp/src/fallthrough_macro.hpp +++ b/rmw_cyclonedds_cpp/src/fallthrough_macro.hpp @@ -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_