[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    [PATCH] D53956: Fix test assumption that Linux implies glibc.
From:       Dan Albert via Phabricator via cfe-commits <cfe-commits () lists ! llvm ! org>
Date:       2018-10-31 22:52:15
Message-ID: differential-rev-PHID-DREV-fnpe4fnzcu3g2fne6ztg-req () reviews ! llvm ! org
[Download RAW message or body]

danalbert created this revision.
danalbert added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne, christof.

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.


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



["D53956.172038.patch" (text/x-patch)]

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

[Attachment #4 (text/plain)]

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic