From: Bruno Haible Date: Sun, 26 Feb 2023 15:56:19 +0000 (+0100) Subject: dfa: Avoid warnings with some Apple clang versions. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5d0fb63a3cd9049232b0046bedb3d121eabacbc2;p=gnulib.git dfa: Avoid warnings with some Apple clang versions. Reported by Werner Lemberg in . * lib/dfa.c (FALLTHROUGH): When __apple_build_version__ is defined, ignore __clang_major__. References: https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2 https://github.com/apple/llvm-project/blob/swift-5.3-RELEASE/clang/test/Sema/fallthrough-attr.c --- diff --git a/ChangeLog b/ChangeLog index e56a9dbc68..0bf3744fce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2023-02-26 Bruno Haible + + dfa: Avoid warnings with some Apple clang versions. + Reported by Werner Lemberg in + . + * lib/dfa.c (FALLTHROUGH): When __apple_build_version__ is defined, + ignore __clang_major__. + References: + https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2 + https://github.com/apple/llvm-project/blob/swift-5.3-RELEASE/clang/test/Sema/fallthrough-attr.c + 2023-02-23 Paul Eggert lseek: avoid SEEK_HOLE bugs in FreeBSD, macOS diff --git a/lib/dfa.c b/lib/dfa.c index 211e1ed18f..20502a802f 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -67,7 +67,10 @@ c_isdigit (char c) #ifndef FALLTHROUGH # if 201710L < __STDC_VERSION__ # define FALLTHROUGH [[__fallthrough__]] -# elif (__GNUC__ >= 7) || (__clang_major__ >= 10) +# elif ((__GNUC__ >= 7) \ + || (defined __apple_build_version__ \ + ? __apple_build_version__ >= 12000000 \ + : __clang_major__ >= 10)) # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0)