[compiler-rt] [sanitizer] Replace ALIGNED with alignas (PR #98958)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 15:21:03 PDT 2024


================
@@ -34,8 +34,8 @@ namespace __asan {
 // -------------------- User-specified callbacks ----------------- {{{1
 static void (*error_report_callback)(const char*);
 using ErrorMessageBuffer = InternalMmapVectorNoCtor<char, true>;
-static ALIGNED(
-    alignof(ErrorMessageBuffer)) char error_message_buffer_placeholder
+alignas(
----------------
MaskRay wrote:

`alignas` (attribute specifier) must precede `static` (storage class specifier) in the decl-specifier.  Both Clang and GCC have errors if the order is swapped.

I think the relevant rules are here:

https://eel.is/c++draft/dcl.pre#nt:simple-declaration specifies the order: [attribute-specifier-seq](https://eel.is/c++draft/dcl.attr.grammar#nt:attribute-specifier-seq) [decl-specifier-seq](https://eel.is/c++draft/dcl.spec.general#nt:decl-specifier-seq) [init-declarator-list](https://eel.is/c++draft/dcl.decl.general#nt:init-declarator-list) ;



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


More information about the llvm-commits mailing list