summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-02-26 16:56:19 +0100
committerBruno Haible <bruno@clisp.org>2023-02-26 16:56:19 +0100
commitc7d7c31ced7575de8078a7c1389049dbe02a8f50 (patch)
tree114d6cda93060a513f5777dc1519ae393fb12e79
parentf4108bb802770feed541f4b168aebbea45146ede (diff)
downloadgnulib-c7d7c31ced7575de8078a7c1389049dbe02a8f50.tar.gz
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__.
-rw-r--r--ChangeLog8
-rw-r--r--lib/dfa.c5
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d8446ce5c..9477335e75 100644
--- 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
diff --git a/lib/dfa.c b/lib/dfa.c
index 211e1ed18f..994900fea2 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__ >= 14000000 \
+ : __clang_major__ >= 10))
# define FALLTHROUGH __attribute__ ((__fallthrough__))
# else
# define FALLTHROUGH ((void) 0)