]> Savannah Git Hosting - gnulib.git/commitdiff
dfa: Avoid warnings with some Apple clang versions.
authorBruno Haible <bruno@clisp.org>
Sun, 26 Feb 2023 15:56:19 +0000 (16:56 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 2 Mar 2023 21:06:35 +0000 (22:06 +0100)
Reported by Werner Lemberg <wl@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00159.html>.

* 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

ChangeLog
lib/dfa.c

index 4bfb4700bae8aa6c448cf9757a58a9f969ecd499..80d90c01e1e96a95b87567c69b8a71676413b59c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-02-26  Bruno Haible  <bruno@clisp.org>
+
+       dfa: Avoid warnings with some Apple clang versions.
+       Reported by Werner Lemberg <wl@gnu.org> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00159.html>.
+       * 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  <eggert@cs.ucla.edu>
 
        lseek: avoid SEEK_HOLE bugs in FreeBSD, macOS
index 211e1ed18f69a478b2ca0d4f5cbbf8aebe83e766..20502a802facba5e87cd93078618e8ac395d562c 100644 (file)
--- 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)