[libcxx-commits] [libcxx] [libc++] Move _LIBCPP_CONCAT{, 3} to <__configuration/utility.h> (PR #205533)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 24 04:41:32 PDT 2026
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/205533
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.
>From 2397aed1b0fc27fda2331a88275a2a905bdf9e0a Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 24 Jun 2026 13:40:08 +0200
Subject: [PATCH] [libc++] Move _LIBCPP_CONCAT{,3} to
<__configuration/utility.h>
---
libcxx/include/__config | 5 +----
libcxx/include/__configuration/utility.h | 4 ++++
2 files changed, 5 insertions(+), 4 deletions(-)
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
More information about the libcxx-commits
mailing list