From f41de1673a445e80d76dafbfc261676ba559bb4f Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Tue, 14 Apr 2020 15:41:11 -0700 Subject: [PATCH] correct fallthrough macro (#154) * correct fallthrough macro Signed-off-by: Karsten Knese --- rmw_cyclonedds_cpp/src/fallthrough_macro.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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_