From ca217b3bb0c4fa5fa9cab334f300f0df529c3926 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 27 Mar 2023 19:22:35 +0200 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ lib/fnmatch.c | 2 +- lib/fts.c | 2 +- lib/regex_internal.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac69cde6e2..89736b2d99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-03-27 Paul Eggert + + 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 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) -- 2.39.5