[libcxx-commits] [libcxx] Avoid using `__shifted` as an identifier (PR #82248)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 19 05:36:05 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Amirreza Ashouri (AMP999)

<details>
<summary>Changes</summary>

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

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


2 Files Affected:

- (modified) libcxx/src/ryu/d2fixed.cpp (+2-2) 
- (modified) libcxx/test/libcxx/system_reserved_names.gen.py (+4-1) 


``````````diff
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..46c6f3b803bd16 100644
--- a/libcxx/test/libcxx/system_reserved_names.gen.py
+++ b/libcxx/test/libcxx/system_reserved_names.gen.py
@@ -160,7 +160,7 @@
 // Test to make sure curses has no conflicting macros with the standard library
 #define move SYSTEM_RESERVED_NAME
 #define erase SYSTEM_RESERVED_NAME
-#define refresh SYSTEM_RESERVED_NAME
+#define refresh SYSTEM_RESERVED_NAMEz
 
 #include <{header}>
 
@@ -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
 """)

``````````

</details>


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


More information about the libcxx-commits mailing list