[libcxx-commits] [libcxx] [libc++] Move constexpr/explicit macros to <__configuration/language.h> (PR #205535)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 24 04:48:42 PDT 2026


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/205535

These macros are essentially a property of the language mode we're in, so move them to `<__configuration/language.h>`.


>From 40227ff1b33b295d91fc27229d2d1e4e62e4fdbe Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 24 Jun 2026 13:48:03 +0200
Subject: [PATCH] [libc++] Move constexpr/explicit macros to
 <__configuration/language.h>

---
 libcxx/include/__config                   | 36 -----------------------
 libcxx/include/__configuration/language.h | 36 +++++++++++++++++++++++
 2 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/libcxx/include/__config b/libcxx/include/__config
index fdd0558fbec6f..714cd0fd26b36 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -238,42 +238,6 @@ typedef __char32_t char32_t;
 #    define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 0
 #  endif
 
-#  if _LIBCPP_STD_VER <= 11
-#    define _LIBCPP_EXPLICIT_SINCE_CXX14
-#  else
-#    define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit
-#  endif
-
-#  if _LIBCPP_STD_VER >= 14
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr
-#  else
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX14
-#  endif
-
-#  if _LIBCPP_STD_VER >= 17
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr
-#  else
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX17
-#  endif
-
-#  if _LIBCPP_STD_VER >= 20
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr
-#  else
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX20
-#  endif
-
-#  if _LIBCPP_STD_VER >= 23
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr
-#  else
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX23
-#  endif
-
-#  if _LIBCPP_STD_VER >= 26
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr
-#  else
-#    define _LIBCPP_CONSTEXPR_SINCE_CXX26
-#  endif
-
 // Thread API
 // clang-format off
 #  if _LIBCPP_HAS_THREADS &&                                                                                           \
diff --git a/libcxx/include/__configuration/language.h b/libcxx/include/__configuration/language.h
index 3137ba2ea27ef..1205934334852 100644
--- a/libcxx/include/__configuration/language.h
+++ b/libcxx/include/__configuration/language.h
@@ -56,4 +56,40 @@
 #  define _LIBCPP_HAS_CHAR8_T 1
 #endif
 
+#if _LIBCPP_STD_VER <= 11
+#  define _LIBCPP_EXPLICIT_SINCE_CXX14
+#else
+#  define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit
+#endif
+
+#if _LIBCPP_STD_VER >= 14
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr
+#else
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX14
+#endif
+
+#if _LIBCPP_STD_VER >= 17
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr
+#else
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX17
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr
+#else
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX20
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr
+#else
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX23
+#endif
+
+#if _LIBCPP_STD_VER >= 26
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr
+#else
+#  define _LIBCPP_CONSTEXPR_SINCE_CXX26
+#endif
+
 #endif // _LIBCPP___CONFIGURATION_LANGUAGE_H



More information about the libcxx-commits mailing list