From 2b0bc33c636d71bd7fa1258289d3379fb810c8c5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 26 Feb 2023 16:56:19 +0100 Subject: [PATCH] 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 --- ChangeLog | 11 +++++++++++ lib/dfa.c | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4bfb4700ba..80d90c01e1 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) -- 2.39.5