bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] libc-config: port to Apple’s Clang variant


From: Paul Eggert
Subject: [PATCH] libc-config: port to Apple’s Clang variant
Date: Mon, 3 Feb 2020 19:02:21 -0800

* lib/libc-config.h (__glibc_clang_prereq):
Port to Apple’s Clang variant, which uses a different
numbering scheme for __clang_major__.
---
 ChangeLog         |  7 +++++++
 lib/libc-config.h | 13 +++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2a86791a8..5afe01563 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-02-03  Paul Eggert  <address@hidden>
+
+       libc-config: port to Apple’s Clang variant
+       * lib/libc-config.h (__glibc_clang_prereq):
+       Port to Apple’s Clang variant, which uses a different
+       numbering scheme for __clang_major__.
+
 2020-02-02  Bruno Haible  <address@hidden>
 
        Document the new modules list-c++, set-c++, oset-c++, map-c++, omap-c++.
diff --git a/lib/libc-config.h b/lib/libc-config.h
index 889e01638..4ae8665bb 100644
--- a/lib/libc-config.h
+++ b/lib/libc-config.h
@@ -55,8 +55,17 @@
 
 #ifndef __glibc_clang_prereq
 # if defined __clang_major__ && defined __clang_minor__
-#  define __glibc_clang_prereq(maj, min) \
-     ((maj) < __clang_major__ + ((min) <= __clang_minor__))
+#  ifdef __apple_build_version__
+/* Apple for some reason renumbers __clang_major__ and __clang_minor__.
+   Gnulib code uses only __glibc_clang_prereq (3, 5); map it to
+   6000000 <= __apple_build_version__.  Support for other calls to
+   __glibc_clang_prereq can be added here as needed.  */
+#   define __glibc_clang_prereq(maj, min) \
+      ((maj) == 3 && (min) == 5 ? 6000000 <= __apple_build_version__ : 0)
+#  else
+#   define __glibc_clang_prereq(maj, min) \
+      ((maj) < __clang_major__ + ((min) <= __clang_minor__))
+#  endif
 # else
 #  define __glibc_clang_prereq(maj, min) 0
 # endif
-- 
2.24.1




reply via email to

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