[libcxx-commits] [libcxx] [libc++] Move _LIBCPP_CONCAT{, 3} to <__configuration/utility.h> (PR #205533)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 24 05:48:54 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>

The macro is already used in `<__configuration/attributes.h>` and just happens to work because we include both headers. `<__configuration/utility.h>` seems like the obvious place to put the macros.


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


2 Files Affected:

- (modified) libcxx/include/__config (+1-4) 
- (modified) libcxx/include/__configuration/utility.h (+4) 


``````````diff
diff --git a/libcxx/include/__config b/libcxx/include/__config
index fdd0558fbec6f..9bf64629080af 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -28,6 +28,7 @@
 #  include <__configuration/language.h>
 #  include <__configuration/namespace.h>
 #  include <__configuration/platform.h>
+#  include <__configuration/utility.h>
 
 // The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html
 
@@ -36,10 +37,6 @@
 // defined to XXYYZZ.
 #  define _LIBCPP_VERSION 230000
 
-#  define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
-#  define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
-#  define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z))
-
 #  ifndef __has_constexpr_builtin
 #    define __has_constexpr_builtin(x) 0
 #  endif
diff --git a/libcxx/include/__configuration/utility.h b/libcxx/include/__configuration/utility.h
index 81e91887614d3..2f06af151dd05 100644
--- a/libcxx/include/__configuration/utility.h
+++ b/libcxx/include/__configuration/utility.h
@@ -19,4 +19,8 @@
 #define _LIBCPP_TOSTRING2(x) #x
 #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
 
+#define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
+#define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
+#define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z))
+
 #endif // _LIBCPP___CONFIGURATION_UTILITY_H

``````````

</details>


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


More information about the libcxx-commits mailing list