From abc3231fb25feaa329f1dfc2aa63bf0cfbb13522 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Tue, 28 Feb 2017 03:38:29 +0000 Subject: [PATCH] ICU-12893 U_FALLTHROUGH: separate compiler test from compiler-feature test X-SVN-Rev: 39711 --- icu4c/source/common/unicode/platform.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/icu4c/source/common/unicode/platform.h b/icu4c/source/common/unicode/platform.h index 0ecdb4a0c78..d29ab677e56 100644 --- a/icu4c/source/common/unicode/platform.h +++ b/icu4c/source/common/unicode/platform.h @@ -537,20 +537,22 @@ * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough * @internal */ -#ifdef __cplusplus -# ifdef U_FALLTHROUGH - // Use the predefined value. -# elif defined(__clang__) && \ - (__has_cpp_attribute(clang::fallthrough) || \ - (__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough"))) +#ifndef __cplusplus + // Not for C. +#elif defined(U_FALLTHROUGH) + // Use the predefined value. +#elif defined(__clang__) + // Test for compiler vs. feature separately. + // Other compilers might choke on the feature test. +# if __has_cpp_attribute(clang::fallthrough) || \ + (__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")) # define U_FALLTHROUGH [[clang::fallthrough]] -# else -# define U_FALLTHROUGH # endif -#else -# define U_FALLTHROUGH #endif +#ifndef U_FALLTHROUGH +# define U_FALLTHROUGH +#endif /** @} */ -- 2.40.0