bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Port FALLTHROUGH to Apple Clang before 6


From: Kirill A. Korinsky
Subject: [PATCH] Port FALLTHROUGH to Apple Clang before 6
Date: Fri, 25 Feb 2022 18:11:44 +0100

Apple uses it's own version of clang and original fix at
605e20a698d3f7296cda18ac7dd84b1a8f388b50 doesn't work for it.

Unfortunately clang from macOS Lion:
 clang --version
 Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
 Target: x86_64-apple-darwin11.4.2
 Thread model: posix

had wrong predefined macroses:
 clang -dM -E -x c /dev/null | grep __clang
 #define __clang__ 1
 #define __clang_major__ 4
 #define __clang_minor__ 1
 #define __clang_patchlevel__ 0
 #define __clang_version__ "4.1 ((tags/Apple/clang-421.11.66))"

The first version of Apple's Clang which is based on LLVM 3.5 was 6.0:
 clang --version
 Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
 Target: x86_64-apple-darwin13.3.0
 Thread model: posix
---
 m4/gnulib-common.m4 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index dbc407961..2609807f1 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -69,7 +69,8 @@ AC_DEFUN([gl_COMMON_BODY], [
 [/* Attributes.  */
 #if (defined __has_attribute \
      && (!defined __clang_minor__ \
-         || 3 < __clang_major__ + (5 <= __clang_minor__)))
+         || 3 < __clang_major__ + (5 <= __clang_minor__)) \
+     && (!defined __APPLE__ || 6 < __clang_major__))
 # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
 #else
 # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
-- 
2.35.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]