From: Jan Janssen Date: Sat, 28 May 2022 09:41:10 +0000 (+0200) Subject: meson: Document why -Wimplicit-fallthrough is not used with clang X-Git-Tag: v252-rc1~909^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c0f5d58c9ab77fd9a12ba83ee0171d836b66d0b1;p=thirdparty%2Fsystemd.git meson: Document why -Wimplicit-fallthrough is not used with clang This changes the macro to ensure proper fallthrough attributes are used with clang in case this option is added in the future. --- diff --git a/meson.build b/meson.build index f416b4f234b..38ebe509f64 100644 --- a/meson.build +++ b/meson.build @@ -351,6 +351,9 @@ possible_common_cc_flags = [ '-Werror=shift-overflow=2', '-Werror=undef', '-Wfloat-equal', + # gperf prevents us from enabling this because it does not emit fallthrough + # attribute with clang. + #'-Wimplicit-fallthrough', '-Wimplicit-fallthrough=5', '-Winit-self', '-Wlogical-op', diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index eb43cf3647c..59d63e8e5da 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -40,7 +40,7 @@ # define _alloc_(...) __attribute__((__alloc_size__(__VA_ARGS__))) #endif -#if __GNUC__ >= 7 +#if __GNUC__ >= 7 || __clang__ # define _fallthrough_ __attribute__((__fallthrough__)) #else # define _fallthrough_