[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:19:39 PDT 2026


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

These macros are essentially there to query compiler features, so they should be moved into `<__configuration/compiler.h>`.


>From d7767e6a61cc242f9aa5617d0a14772dab1b90ee 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/__configuration/compiler.h | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)

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