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

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 16:01:19 PDT 2024


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

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.


>From 2ac171932048f692d104f5cf2b015ea39864a8e6 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Tue, 16 Jul 2024 16:01:05 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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;
 



More information about the llvm-commits mailing list