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

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 24 09:20:18 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/205590.diff


1 Files Affected:

- (modified) libcxx/include/__configuration/compiler.h (+25) 


``````````diff
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

``````````

</details>


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


More information about the libcxx-commits mailing list