[compiler-rt] [tsan] Fix alignas specifier in tsan_platform_mac.cpp (PR #99252)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 16:01:50 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Paul Kirth (ilovepi)

<details>
<summary>Changes</summary>

Placing the `alignas` specifier after the declaration causes the following:

```
error: 'alignas' attribute cannot be applied to types

```
Breakages can be seen at:
https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-mac-x64/b8742225171944684321/overview
https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8742225171944684321/+/u/clang/install/stdout

This patch corrects the placement, which follows the convention and
style of other `alignas` directives in compiler-rt.


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


1 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp (+3-3) 


``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
index c8a66e60a69f1..6add1e8fc27b8 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
@@ -45,9 +45,9 @@
 
 namespace __tsan {
 
-#if !SANITIZER_GO
-static char main_thread_state[sizeof(ThreadState)] alignas(
-    SANITIZER_CACHE_LINE_SIZE);
+#  if !SANITIZER_GO
+alignas(SANITIZER_CACHE_LINE_SIZE) static char main_thread_state[sizeof(
+    ThreadState)];
 static ThreadState *dead_thread_state;
 static pthread_key_t thread_state_key;
 

``````````

</details>


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


More information about the llvm-commits mailing list