[libcxx] r345900 - Fix test assumption that Linux implies glibc.

Dan Albert danalbert at google.com
Thu Nov 1 15:35:51 PDT 2018

Author: danalbert
Date: Thu Nov  1 15:35:51 2018
New Revision: 345900

URL: http://llvm.org/viewvc/llvm-project?rev=345900&view=rev
Fix test assumption that Linux implies glibc.

This fixes an regression when using bionic introduced in r345173.

I need to follow up and figure out what exactly is implied by
TEST_HAS_C11_FEATURES and see what the correct configuration is for
bionic (new versions should have everything the tests care about,
versions that predate C11 certainly don't), but this gets the tests
back to the old behavior.

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, ldionne, libcxx-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D53956


Modified: libcxx/trunk/test/support/test_macros.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=345900&r1=345899&r2=345900&view=diff
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Thu Nov  1 15:35:51 2018
@@ -91,9 +91,11 @@
 #if (defined(__has_include) && __has_include(<features.h>)) || \
 #include <features.h>
+#if defined(__GLIBC_PREREQ)
 #define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)
 #if TEST_STD_VER >= 11
 #define TEST_ALIGNOF(...) alignof(__VA_ARGS__)
@@ -135,12 +137,16 @@
 #    define TEST_HAS_C11_FEATURES
 #  elif defined(__linux__)
-#    if !defined(_LIBCPP_HAS_MUSL_LIBC)
-#      if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 17)
+// This block preserves the old behavior used by include/__config:
+// _LIBCPP_GLIBC_PREREQ would be defined to 0 if __GLIBC_PREREQ was not
+// available. The configuration here may be too vague though, as Bionic, uClibc,
+// newlib, etc may all support these features but need to be configured.
+#    if defined(TEST_GLIBC_PREREQ)
+#      if TEST_GLIBC_PREREQ(2, 17)
 #        define TEST_HAS_TIMESPEC_GET
 #        define TEST_HAS_C11_FEATURES
 #      endif
-#    else // defined(_LIBCPP_HAS_MUSL_LIBC)
+#    elif defined(_LIBCPP_HAS_MUSL_LIBC)
 #      define TEST_HAS_C11_FEATURES
 #      define TEST_HAS_TIMESPEC_GET
 #    endif

More information about the libcxx-commits mailing list