[PATCH] D50739: Clean up macros to detect underling C library functionality

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 14 14:43:53 PDT 2018


mclow.lists created this revision.
mclow.lists added reviewers: ldionne, EricWF, dexonsmith.

During the review of https://reviews.llvm.org/D50719, I said:

> The presence/absence of C11 features in the underlying C library does not depend on what version of the C++ language we're compiling with.
>  The tests that use `TEXT_HAS_C11_XXX` should be updated to check `TEST_STD_VER` instead.

This does that.
The detection of C11 features happens no matter what the language level is.
The enabling/disabling of the C++ features is done based on the language level.


https://reviews.llvm.org/D50739

Files:
  include/__config
  include/cstdlib
  test/std/language.support/support.start.term/quick_exit.pass.cpp
  test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
  test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
  test/support/test_macros.h


Index: test/support/test_macros.h
===================================================================
--- test/support/test_macros.h
+++ test/support/test_macros.h
@@ -124,7 +124,7 @@
 
 // Sniff out to see if the underling C library has C11 features
 // Note that at this time (July 2018), MacOS X and iOS do NOT.
-#if __ISO_C_VISIBLE >= 2011 || TEST_STD_VER >= 11
+#if __ISO_C_VISIBLE >= 2011
 #  if defined(__FreeBSD__)
 #    define TEST_HAS_C11_FEATURES
 #  elif defined(__Fuchsia__)
Index: test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
===================================================================
--- test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
+++ test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
@@ -6,7 +6,7 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
+// UNSUPPORTED: c++98, c++03
 
 // test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
 // results in a compile error.
Index: test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
===================================================================
--- test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
+++ test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: c++98, c++03
 
 // test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
 // results in a compile error.
Index: test/std/language.support/support.start.term/quick_exit.pass.cpp
===================================================================
--- test/std/language.support/support.start.term/quick_exit.pass.cpp
+++ test/std/language.support/support.start.term/quick_exit.pass.cpp
@@ -6,7 +6,7 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
+// UNSUPPORTED: c++98, c++03
 
 // test quick_exit and at_quick_exit
 
Index: include/cstdlib
===================================================================
--- include/cstdlib
+++ include/cstdlib
@@ -151,11 +151,11 @@
 using ::wctomb;
 using ::mbstowcs;
 using ::wcstombs;
-#ifdef _LIBCPP_HAS_QUICK_EXIT
+#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT)
 using ::at_quick_exit;
 using ::quick_exit;
 #endif
-#ifdef _LIBCPP_HAS_C11_FEATURES
+#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
 using ::aligned_alloc;
 #endif
 
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -430,7 +430,7 @@
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 #endif
 
-#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+#if __ISO_C_VISIBLE >= 2011
 #  if defined(__FreeBSD__)
 #    define _LIBCPP_HAS_QUICK_EXIT
 #    define _LIBCPP_HAS_C11_FEATURES


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50739.160695.patch
Type: text/x-patch
Size: 3029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180814/8d054d51/attachment-0001.bin>


More information about the cfe-commits mailing list