[libcxx-commits] [PATCH] D108638: [libc++] Assume that compilers support extended constexpr in C++14 mode

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 24 11:10:51 PDT 2021


ldionne updated this revision to Diff 368409.
ldionne added a comment.

Fix issues with wrap_iter constexpr in C++11 and C++03 mode


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108638/new/

https://reviews.llvm.org/D108638

Files:
  libcxx/include/__config
  libcxx/test/libcxx/selftest/test_macros.pass.cpp
  libcxx/test/support/test_macros.h


Index: libcxx/test/support/test_macros.h
===================================================================
--- libcxx/test/support/test_macros.h
+++ libcxx/test/support/test_macros.h
@@ -165,7 +165,6 @@
 
 /* Features that were introduced in C++14 */
 #if TEST_STD_VER >= 14
-#define TEST_HAS_EXTENDED_CONSTEXPR
 #define TEST_HAS_VARIABLE_TEMPLATES
 #endif
 
Index: libcxx/test/libcxx/selftest/test_macros.pass.cpp
===================================================================
--- libcxx/test/libcxx/selftest/test_macros.pass.cpp
+++ libcxx/test/libcxx/selftest/test_macros.pass.cpp
@@ -33,16 +33,6 @@
 void test_libcxx_macros()
 {
 //  ===== C++14 features =====
-//  defined(TEST_HAS_EXTENDED_CONSTEXPR)  != defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
-#ifdef TEST_HAS_EXTENDED_CONSTEXPR
-# ifdef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#  error "TEST_EXTENDED_CONSTEXPR mismatch (1)"
-# endif
-#else
-# ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#  error "TEST_EXTENDED_CONSTEXPR mismatch (2)"
-# endif
-#endif
 
 //  defined(TEST_HAS_VARIABLE_TEMPLATES) != defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
 #ifdef TEST_HAS_VARIABLE_TEMPLATES
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -492,10 +492,6 @@
 #  define _LIBCPP_HAS_BLOCKS_RUNTIME
 #endif
 
-#if !(__has_feature(cxx_relaxed_constexpr))
-#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#endif
-
 #if !(__has_feature(cxx_variable_templates))
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 #endif
@@ -542,11 +538,6 @@
 #  define _LIBCPP_NO_EXCEPTIONS
 #endif
 
-// Determine if GCC supports relaxed constexpr
-#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
-#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#endif
-
 // GCC 5 supports variable templates
 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
@@ -575,7 +566,6 @@
 #error "MSVC versions prior to Visual Studio 2015 are not supported"
 #endif
 
-#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 #define __alignof__ __alignof
 #define _LIBCPP_NORETURN __declspec(noreturn)
@@ -1044,19 +1034,19 @@
 #  define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
 #endif
 
-#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#if _LIBCPP_STD_VER > 11
 #  define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
 #else
 #  define _LIBCPP_CONSTEXPR_AFTER_CXX11
 #endif
 
-#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#if _LIBCPP_STD_VER > 14
 #  define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
 #else
 #  define _LIBCPP_CONSTEXPR_AFTER_CXX14
 #endif
 
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#if _LIBCPP_STD_VER > 17
 #  define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
 #else
 #  define _LIBCPP_CONSTEXPR_AFTER_CXX17
@@ -1096,7 +1086,7 @@
 #  define _LIBCPP_INLINE_VAR
 #endif
 
-#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#if defined(_LIBCPP_DEBUG) && _LIBCPP_STD_VER > 11
 #   define _LIBCPP_CONSTEXPR_IF_NODEBUG
 #else
 #   define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108638.368409.patch
Type: text/x-patch
Size: 3162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210824/0b77538b/attachment.bin>


More information about the libcxx-commits mailing list