From d371c5765e07730b544c5b560f2abd40fb4e64b8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 9 Aug 2020 20:09:36 +0200 Subject: [PATCH] Silence warnings from clang 10 with -Wimplicit-fallthrough. * lib/dfa.c (FALLTHROUGH): Use __attribute__ __fallthrough__ also on clang >= 10. * lib/fnmatch.c (FALLTHROUGH): Likewise. * lib/fts.c (FALLTHROUGH): Likewise. * tests/macros.h (FALLTHROUGH): Likewise. * lib/regex_internal.h (FALLTHROUGH): Likewise. * config/srclist.txt: Mark it as needing sync with glibc. --- ChangeLog | 11 +++++++++++ config/srclist.txt | 2 +- lib/dfa.c | 6 +++--- lib/fnmatch.c | 6 +++--- lib/fts.c | 6 +++--- lib/regex_internal.h | 6 +++--- tests/macros.h | 6 +++--- 7 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1fd086405..10697a729f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2020-08-09 Bruno Haible + + Silence warnings from clang 10 with -Wimplicit-fallthrough. + * lib/dfa.c (FALLTHROUGH): Use __attribute__ __fallthrough__ also on + clang >= 10. + * lib/fnmatch.c (FALLTHROUGH): Likewise. + * lib/fts.c (FALLTHROUGH): Likewise. + * tests/macros.h (FALLTHROUGH): Likewise. + * lib/regex_internal.h (FALLTHROUGH): Likewise. + * config/srclist.txt: Mark it as needing sync with glibc. + 2020-08-09 Bruno Haible stdbool tests: Enable the stricter tests also on clang. diff --git a/config/srclist.txt b/config/srclist.txt index 58b34d79ec..429cb949e7 100644 --- a/config/srclist.txt +++ b/config/srclist.txt @@ -58,7 +58,7 @@ $LIBCSRC posix/regcomp.c lib $LIBCSRC posix/regex.c lib $LIBCSRC posix/regex.h lib $LIBCSRC posix/regex_internal.c lib -$LIBCSRC posix/regex_internal.h lib +#$LIBCSRC posix/regex_internal.h lib $LIBCSRC posix/regexec.c lib $LIBCSRC time/timegm.c lib $LIBCSRC time/mktime.c lib diff --git a/lib/dfa.c b/lib/dfa.c index e79d882d76..1f0587a7a3 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -64,10 +64,10 @@ isasciidigit (char c) #ifndef FALLTHROUGH # if 201710L < __STDC_VERSION__ # define FALLTHROUGH [[__fallthrough__]] -# elif __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else +# elif (__GNUC__ >= 7) || (__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) +# else +# define FALLTHROUGH ((void) 0) # endif #endif diff --git a/lib/fnmatch.c b/lib/fnmatch.c index 4d017cfebe..30144286f3 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -64,10 +64,10 @@ extern int fnmatch (const char *pattern, const char *string, int flags); #endif #ifdef _LIBC -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else +# if (__GNUC__ >= 7) || (__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) +# else +# define FALLTHROUGH ((void) 0) # endif #else # include "attribute.h" diff --git a/lib/fts.c b/lib/fts.c index a34092ca25..a7deaa0401 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -201,10 +201,10 @@ enum Fts_stat #endif #ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else +# if (__GNUC__ >= 7) || (__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) +# else +# define FALLTHROUGH ((void) 0) # endif #endif diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 8c42586c42..df5303cb4d 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -841,10 +841,10 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) #endif /* RE_ENABLE_I18N */ #ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else +# if (__GNUC__ >= 7) || (__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) +# else +# define FALLTHROUGH ((void) 0) # endif #endif diff --git a/tests/macros.h b/tests/macros.h index c72cc92289..bbc340d41a 100644 --- a/tests/macros.h +++ b/tests/macros.h @@ -22,10 +22,10 @@ #include #ifndef FALLTHROUGH -# if __GNUC__ < 7 -# define FALLTHROUGH ((void) 0) -# else +# if (__GNUC__ >= 7) || (__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) +# else +# define FALLTHROUGH ((void) 0) # endif #endif -- 2.39.5