From 09de1c3273a2de91780df64ec54d25679c3e51f5 Mon Sep 17 00:00:00 2001 From: Christian Eltzschig Date: Tue, 20 Apr 2021 19:20:16 +0200 Subject: [PATCH] iox-#743 IOX_FALLTHROUGH is noop for clang on linux Signed-off-by: Christian Eltzschig --- .../include/iceoryx_utils/cxx/attributes.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/iceoryx_utils/include/iceoryx_utils/cxx/attributes.hpp b/iceoryx_utils/include/iceoryx_utils/cxx/attributes.hpp index bba621724b..4755ac15b1 100644 --- a/iceoryx_utils/include/iceoryx_utils/cxx/attributes.hpp +++ b/iceoryx_utils/include/iceoryx_utils/cxx/attributes.hpp @@ -55,13 +55,17 @@ namespace cxx // [[fallthrough]] supported since gcc 7 (https://gcc.gnu.org/projects/cxx-status.html) /// [[fallthrough]] supported since clang 3.9 (https://clang.llvm.org/cxx_status.html) /// activate keywords for gcc>=7 or clang>=4 -#if (defined(__GNUC__) && __GNUC__ >= 7) || (defined(__clang__) && __clang_major__ >= 4) -#define IOX_FALLTHROUGH [[fallthrough]] // NOLINT -#elif defined(_WIN32) +#if defined(_WIN32) // On WIN32 we are using C++17 which makes the keyword [[fallthrough]] available #define IOX_FALLTHROUGH [[fallthrough]] // NOLINT -// on an unknown platform we use for now nothing since we do not know what is supported there +#elif defined(__APPLE__) && defined(__clang__) +// On APPLE we are using C++17 which makes the keyword [[fallthrough]] available +#define IOX_FALLTHROUGH [[fallthrough]] // NOLINT +#elif (defined(__GNUC__) && __GNUC__ >= 7) && !defined(__clang__) +// clang prints a warning therefore we exclude it here +#define IOX_FALLTHROUGH [[fallthrough]] // NOLINT #else +// on an unknown platform we use for now nothing since we do not know what is supported there #define IOX_FALLTHROUGH #endif