[PATCH] D41892: libcxx: Stop providing a definition of __GLIBC_PREREQ.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 17:12:28 PST 2018
pcc created this revision.
pcc added reviewers: EricWF, mclow.lists.
An application may determine whether the C standard library is glibc
by testing whether __GLIBC_PREREQ is defined. This breaks if libc++
provides its own definition. Instead, define our own macro in our
namespace with the desired semantics.
https://reviews.llvm.org/D41892
Files:
libcxx/include/__config
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -184,9 +184,11 @@
// Need to detect which libc we're using if we're on Linux.
#if defined(__linux__)
#include <features.h>
-#if !defined(__GLIBC_PREREQ)
-#define __GLIBC_PREREQ(a, b) 0
-#endif // !defined(__GLIBC_PREREQ)
+#if defined(__GLIBC_PREREQ)
+#define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
+#else
+#define _LIBCPP_GLIBC_PREREQ(a, b) 0
+#endif // defined(__GLIBC_PREREQ)
#endif // defined(__linux__)
#ifdef __LITTLE_ENDIAN__
@@ -416,10 +418,10 @@
#define _LIBCPP_HAS_C11_FEATURES
#elif defined(__linux__)
#if !defined(_LIBCPP_HAS_MUSL_LIBC)
-#if __GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
+#if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
#define _LIBCPP_HAS_QUICK_EXIT
#endif
-#if __GLIBC_PREREQ(2, 17)
+#if _LIBCPP_GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
#else // defined(_LIBCPP_HAS_MUSL_LIBC)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41892.129193.patch
Type: text/x-patch
Size: 1014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180110/e5c1f045/attachment.bin>
More information about the llvm-commits
mailing list