]> 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>
Sun, 26 Feb 2023 15:56:19 +0000 (16:56 +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__.

ChangeLog
lib/dfa.c

index 3d8446ce5c28ef7ced0baebb479c1a4a01ee07ef..9477335e75428cd23b509a032839cfe13cfaab54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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__.
+
 2023-02-25  Jim Meyering  <meyering@fb.com>
 
        announce-gen: add more info the auto-generated announce template
index 211e1ed18f69a478b2ca0d4f5cbbf8aebe83e766..994900fea2fe73230f538f9055f34129d403e37e 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__ >= 14000000 \
+            : __clang_major__ >= 10))
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
 # else
 #  define FALLTHROUGH ((void) 0)