[PATCH] D53956: Fix test assumption that Linux implies glibc.

Dan Albert via Phabricator reviews at reviews.llvm.org
Thu Nov 1 15:38:14 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX345900: Fix test assumption that Linux implies glibc. (authored by danalbert, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53956?vs=172038&id=172255#toc

Repository:
  rCXX libc++

https://reviews.llvm.org/D53956

Files:
  test/support/test_macros.h


Index: test/support/test_macros.h
===================================================================
--- test/support/test_macros.h
+++ test/support/test_macros.h
@@ -91,9 +91,11 @@
 #if (defined(__has_include) && __has_include(<features.h>)) || \
     defined(__linux__)
 #include <features.h>
+#if defined(__GLIBC_PREREQ)
 #define TEST_HAS_GLIBC
 #define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)
 #endif
+#endif
 
 #if TEST_STD_VER >= 11
 #define TEST_ALIGNOF(...) alignof(__VA_ARGS__)
@@ -135,12 +137,16 @@
 #    define TEST_HAS_C11_FEATURES
 #    define TEST_HAS_TIMESPEC_GET
 #  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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53956.172255.patch
Type: text/x-patch
Size: 1370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181101/ba94b014/attachment.bin>


More information about the libcxx-commits mailing list