From: Paul Eggert <eggert@cs.ucla.edu> Date: Mon, 27 Mar 2023 17:22:35 +0000 (+0200) Subject: Support FALLTHROUGH macro better in glibc+clang. X-Git-Tag: v1.0~1560 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ca217b3bb0c4fa5fa9cab334f300f0df529c3926;p=gnulib.git Support FALLTHROUGH macro better in glibc+clang. * lib/fnmatch.c (FALLTHROUGH): Use __attribute__ ((__fallthrough__)) also in clang >= 10. * lib/fts.c (FALLTHROUGH): Likewise. * lib/regex_internal.h (FALLTHROUGH): Likewise. --- diff --git a/ChangeLog b/ChangeLog index ac69cde6e2..89736b2d99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-03-27 Paul Eggert <eggert@cs.ucla.edu> + + Support FALLTHROUGH macro better in glibc+clang. + * lib/fnmatch.c (FALLTHROUGH): Use __attribute__ ((__fallthrough__)) + also in clang >= 10. + * lib/fts.c (FALLTHROUGH): Likewise. + * lib/regex_internal.h (FALLTHROUGH): Likewise. + 2023-03-27 Bruno Haible <bruno@clisp.org> wcsstr: Ensure worst-case linear execution time. diff --git a/lib/fnmatch.c b/lib/fnmatch.c index 7c9c4e0f24..32cfb48d0f 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -64,7 +64,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags); #endif #ifdef _LIBC -# if __GNUC__ >= 7 +# if __glibc_has_attribute (__fallthrough__) # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) diff --git a/lib/fts.c b/lib/fts.c index 794a4f75d7..3fffb45d70 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -203,7 +203,7 @@ enum Fts_stat #endif #ifdef _LIBC -# if __GNUC__ >= 7 +# if __glibc_has_attribute (__fallthrough__) # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 149ec2e868..ae9257eac0 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -822,7 +822,7 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) } #ifdef _LIBC -# if __GNUC__ >= 7 +# if __glibc_has_attribute (__fallthrough__) # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0)