[PATCH] [libcxx] Change _LIBCXX_CONSTEXPR_AFTER_CXX11 to check for relaxed constexpr rules

Eric Fiselier eric at efcs.ca
Mon Jul 14 19:21:09 PDT 2014


Changed the name _LIBCPP_HAS_NO_RELAXED_CONSTEXPR -> _LIBCPP_HAS_NO_CXX14_CONSTEXPR

http://reviews.llvm.org/D4396

Files:
  include/__config

Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -313,6 +313,10 @@
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #endif
 
+#if !(__has_feature(cxx_relaxed_constexpr))
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#endif
+
 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
 #if defined(__FreeBSD__)
 #define _LIBCPP_HAS_QUICK_EXIT
@@ -386,6 +390,9 @@
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #endif
 
+// No version of GCC supports relaxed constexpr rules
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+
 #define _NOEXCEPT throw()
 #define _NOEXCEPT_(x)
 #define _NOEXCEPT_OR_FALSE(x) false
@@ -455,6 +462,7 @@
 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
 #define _LIBCPP_HAS_NO_CONSTEXPR
+#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #define _LIBCPP_HAS_NO_UNICODE_CHARS
 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -646,15 +654,19 @@
 #endif
 
 #if _LIBCPP_STD_VER <= 11
-#define _LIBCPP_CONSTEXPR_AFTER_CXX11
 #define _LIBCPP_EXPLICIT_AFTER_CXX11
 #define _LIBCPP_DEPRECATED_AFTER_CXX11
 #else
-#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
 #endif
 
+#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
+#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
+#else
+#define _LIBCPP_CONSTEXPR_AFTER_CXX11
+#endif
+
 #ifndef _LIBCPP_HAS_NO_ASAN
 extern "C" void __sanitizer_annotate_contiguous_container(
   const void *, const void *, const void *, const void *);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4396.11412.patch
Type: text/x-patch
Size: 1627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140715/72a16339/attachment.bin>


More information about the cfe-commits mailing list