From: Markus Scherer Date: Tue, 28 Feb 2017 03:38:29 +0000 (+0000) Subject: ICU-12893 U_FALLTHROUGH: separate compiler test from compiler-feature test X-Git-Tag: release-59-rc~136 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=abc3231fb25feaa329f1dfc2aa63bf0cfbb13522;p=icu ICU-12893 U_FALLTHROUGH: separate compiler test from compiler-feature test X-SVN-Rev: 39711 --- 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 /** @} */