[libcxx-commits] [libcxx] Avoid using `__shifted` as an identifier (PR #82248)
Amirreza Ashouri via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 20 02:40:58 PST 2024
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/82248
>From 3983a7bcb3900eba8b652497eca17232fcfe0ee9 Mon Sep 17 00:00:00 2001
From: Amirreza Ashouri <ar.ashouri999 at gmail.com>
Date: Mon, 19 Feb 2024 15:37:27 +0330
Subject: [PATCH 1/2] Avoid using `__shifted` as an identifier
According to https://hex-rays.com/products/ida/support/idadoc/1695.shtml, `__shifted` is a
reserved keyword in https://github.com/widberg/llvm-project-widberg-extensions.
`libcxx/src/ryu/d2fixed.cpp` tries to use `__shifted` as an identifier, causing
a compile failure in Compiler Explorer's build work flow:
https://github.com/compiler-explorer/compiler-workflows/actions/runs/7908979550/job/21589200908
---
libcxx/src/ryu/d2fixed.cpp | 4 ++--
libcxx/test/libcxx/system_reserved_names.gen.py | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libcxx/src/ryu/d2fixed.cpp b/libcxx/src/ryu/d2fixed.cpp
index 4cfc39535988e2..3d6e27756bcd49 100644
--- a/libcxx/src/ryu/d2fixed.cpp
+++ b/libcxx/src/ryu/d2fixed.cpp
@@ -82,9 +82,9 @@ inline constexpr int __POW10_ADDITIONAL_BITS = 120;
const uint64_t __multiplied = __umul256_hi128_lo64(__vHi, __vLo, 0x89705F4136B4A597u, 0x31680A88F8953031u);
// For uint32_t truncation, see the __mod1e9() comment in d2s_intrinsics.h.
- const uint32_t __shifted = static_cast<uint32_t>(__multiplied >> 29);
+ const uint32_t __shiftedValue = static_cast<uint32_t>(__multiplied >> 29);
- return static_cast<uint32_t>(__vLo) - 1000000000 * __shifted;
+ return static_cast<uint32_t>(__vLo) - 1000000000 * __shiftedValue;
}
#endif // ^^^ intrinsics available ^^^
diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py
index 0d935a18addeee..ab849664d05551 100644
--- a/libcxx/test/libcxx/system_reserved_names.gen.py
+++ b/libcxx/test/libcxx/system_reserved_names.gen.py
@@ -172,4 +172,7 @@
static_assert(__builtin_strcmp(STRINGIFY(move), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
static_assert(__builtin_strcmp(STRINGIFY(erase), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
static_assert(__builtin_strcmp(STRINGIFY(refresh), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
+
+// __shifted is a reserved keyword on the LLVM Widberg compiler
+#define __shifted SYSTEM_RESERVED_NAME
""")
>From ef8c8ecfc5542dd488a709c15c0d867811a50a7f Mon Sep 17 00:00:00 2001
From: Amirreza Ashouri <ar.ashouri999 at gmail.com>
Date: Tue, 20 Feb 2024 14:10:10 +0330
Subject: [PATCH 2/2] Resolve darker's issue.
---
libcxx/test/libcxx/system_reserved_names.gen.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py
index ab849664d05551..6ded37b0fb48a6 100644
--- a/libcxx/test/libcxx/system_reserved_names.gen.py
+++ b/libcxx/test/libcxx/system_reserved_names.gen.py
@@ -17,7 +17,8 @@
from libcxx.header_information import lit_header_restrictions, public_headers
for header in public_headers:
- print(f"""\
+ print(
+ f"""\
//--- {header}.compile.pass.cpp
{lit_header_restrictions.get(header, '')}
@@ -175,4 +176,5 @@
// __shifted is a reserved keyword on the LLVM Widberg compiler
#define __shifted SYSTEM_RESERVED_NAME
-""")
+"""
+ )
More information about the libcxx-commits
mailing list