[libcxx-commits] [libcxx] [NFC] Renames a template parameter to avoid clashes with userspace names. (PR #76829)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 3 09:40:03 PST 2024


https://github.com/bgra8 updated https://github.com/llvm/llvm-project/pull/76829

>From bbd14a34180e1976047a801810e3812274f36b96 Mon Sep 17 00:00:00 2001
From: Bogdan Graur <bgraur at google.com>
Date: Wed, 3 Jan 2024 15:52:34 +0000
Subject: [PATCH 1/4] [NFC] Renames a template parameter to avoid clashes with
 userspace names.

---
 libcxx/include/__format/format_arg_store.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index c481992d2d719a..8180e2de8c0f4c 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -228,15 +228,15 @@ _LIBCPP_HIDE_FROM_ABI void __store_basic_format_arg(basic_format_arg<_Context>*
   ([&] { *__data++ = __format::__create_format_arg<_Context>(__args); }(), ...);
 }
 
-template <class _Context, size_t N>
+template <class _Context, size_t _Nargs>
 struct __packed_format_arg_store {
-  __basic_format_arg_value<_Context> __values_[N];
+  __basic_format_arg_value<_Context> __values_[_Nargs];
   uint64_t __types_ = 0;
 };
 
-template <class _Context, size_t N>
+template <class _Context, size_t _Nargs>
 struct __unpacked_format_arg_store {
-  basic_format_arg<_Context> __args_[N];
+  basic_format_arg<_Context> __args_[_Nargs];
 };
 
 } // namespace __format

>From b52a2a5f4c13dec7335a9a3a6df37f61b264c05c Mon Sep 17 00:00:00 2001
From: Bogdan Graur <bgraur at google.com>
Date: Wed, 3 Jan 2024 16:24:32 +0000
Subject: [PATCH 2/4] Code Review adjustments

---
 libcxx/test/libcxx/system_reserved_names.gen.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py
index 8c4be97897f657..531d418e0f3cd6 100644
--- a/libcxx/test/libcxx/system_reserved_names.gen.py
+++ b/libcxx/test/libcxx/system_reserved_names.gen.py
@@ -131,6 +131,7 @@
 #define E SYSTEM_RESERVED_NAME
 #define Ep SYSTEM_RESERVED_NAME
 #define Es SYSTEM_RESERVED_NAME
+#define N SYSTEM_RESERVED_NAME
 #define R SYSTEM_RESERVED_NAME
 #define Rp SYSTEM_RESERVED_NAME
 #define Rs SYSTEM_RESERVED_NAME

>From 86d525ed867b32a69f1b1c1a198b66a9b6996f60 Mon Sep 17 00:00:00 2001
From: Bogdan Graur <bgraur at google.com>
Date: Wed, 3 Jan 2024 16:45:14 +0000
Subject: [PATCH 3/4] Code Review adjustments

---
 libcxx/include/__format/format_arg_store.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index 8180e2de8c0f4c..066cd369eb8918 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -228,15 +228,15 @@ _LIBCPP_HIDE_FROM_ABI void __store_basic_format_arg(basic_format_arg<_Context>*
   ([&] { *__data++ = __format::__create_format_arg<_Context>(__args); }(), ...);
 }
 
-template <class _Context, size_t _Nargs>
+template <class _Context, size_t _Np>
 struct __packed_format_arg_store {
-  __basic_format_arg_value<_Context> __values_[_Nargs];
+  __basic_format_arg_value<_Context> __values_[_Np];
   uint64_t __types_ = 0;
 };
 
-template <class _Context, size_t _Nargs>
+template <class _Context, size_t _Np>
 struct __unpacked_format_arg_store {
-  basic_format_arg<_Context> __args_[_Nargs];
+  basic_format_arg<_Context> __args_[_Np];
 };
 
 } // namespace __format

>From 4cd856a98bba2532956f870b5ee49cc0e3082296 Mon Sep 17 00:00:00 2001
From: Bogdan Graur <bgraur at google.com>
Date: Wed, 3 Jan 2024 16:56:17 +0000
Subject: [PATCH 4/4] Code Review adjustments

---
 libcxx/test/libcxx/system_reserved_names.gen.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py
index 531d418e0f3cd6..8ddd035ff2d258 100644
--- a/libcxx/test/libcxx/system_reserved_names.gen.py
+++ b/libcxx/test/libcxx/system_reserved_names.gen.py
@@ -132,6 +132,8 @@
 #define Ep SYSTEM_RESERVED_NAME
 #define Es SYSTEM_RESERVED_NAME
 #define N SYSTEM_RESERVED_NAME
+#define Np SYSTEM_RESERVED_NAME
+#define Ns SYSTEM_RESERVED_NAME
 #define R SYSTEM_RESERVED_NAME
 #define Rp SYSTEM_RESERVED_NAME
 #define Rs SYSTEM_RESERVED_NAME



More information about the libcxx-commits mailing list