From ddf8ff2b7d345ad7b263d904be761670ec1c51a1 Mon Sep 17 00:00:00 2001 From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Wed, 12 Sep 2018 10:17:35 -0700 Subject: [PATCH] ICU-13812 Define U_FALLTHROUGH for GCC 7+ for ICU4C. (#100) Currently U_FALLTHROUGH is not defined for GCC, meaning that any switch case statements with fall-throughs will generate warnings when building ICU4C. In GCC 7, they added support for: "_attribute_((fallthrough))" which we can now use for U_FALLTHROUGH, which eliminates many warnings when building with GCC. --- icu4c/source/common/unicode/platform.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/icu4c/source/common/unicode/platform.h b/icu4c/source/common/unicode/platform.h index db34613b614..4c1603554fb 100644 --- a/icu4c/source/common/unicode/platform.h +++ b/icu4c/source/common/unicode/platform.h @@ -517,6 +517,8 @@ namespace std { (__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")) # define U_FALLTHROUGH [[clang::fallthrough]] # endif +#elif defined(__GNUC__) && (__GNUC__ >= 7) +# define U_FALLTHROUGH __attribute__((fallthrough)) #endif #ifndef U_FALLTHROUGH -- 2.50.1