[libcxx-commits] [libcxx] [libc++] Move compiler-specific configuration into <__configuration/compiler.h> (PR #205590)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 24 09:21:35 PDT 2026


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/205590

>From 01ca8437a6def88b71a422cf0c94b11feada28a8 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 24 Jun 2026 18:18:52 +0200
Subject: [PATCH] [libc++] Move compiler-specific configuration into
 <__configuration/compiler.h>

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

diff --git a/libcxx/include/__config b/libcxx/include/__config
index fc7a121d52783..ba79ff652e58b 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -37,31 +37,6 @@
 // defined to XXYYZZ.
 #  define _LIBCPP_VERSION 230000
 
-#  ifndef __has_constexpr_builtin
-#    define __has_constexpr_builtin(x) 0
-#  endif
-
-// This checks wheter a Clang module is built
-#  ifndef __building_module
-#    define __building_module(...) 0
-#  endif
-
-// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
-// the compiler and '1' otherwise.
-#  ifndef __is_identifier
-#    define __is_identifier(__x) 1
-#  endif
-
-#  define __has_keyword(__x) !(__is_identifier(__x))
-
-#  ifndef __has_warning
-#    define __has_warning(...) 0
-#  endif
-
-#  if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L
-#    error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"
-#  endif
-
 #  if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
 #    define _LIBCPP_ABI_VCRUNTIME
 #  endif
diff --git a/libcxx/include/__configuration/compiler.h b/libcxx/include/__configuration/compiler.h
index 4c3dbbfc7d412..264b713d94b6a 100644
--- a/libcxx/include/__configuration/compiler.h
+++ b/libcxx/include/__configuration/compiler.h
@@ -46,6 +46,31 @@
 #    endif
 #  endif
 
+#  ifndef __has_constexpr_builtin
+#    define __has_constexpr_builtin(x) 0
+#  endif
+
+// This checks wheter a Clang module is built
+#  ifndef __building_module
+#    define __building_module(...) 0
+#  endif
+
+// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
+// the compiler and '1' otherwise.
+#  ifndef __is_identifier
+#    define __is_identifier(__x) 1
+#  endif
+
+#  define __has_keyword(__x) !(__is_identifier(__x))
+
+#  ifndef __has_warning
+#    define __has_warning(...) 0
+#  endif
+
+#  if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L
+#    error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"
+#  endif
+
 #endif
 
 #endif // _LIBCPP___CONFIGURATION_COMPILER_H



More information about the libcxx-commits mailing list