From 9c86b83ffc8ffe31d979a5fe18445e943ba7a118 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 9 Apr 2020 13:37:27 -0700 Subject: [PATCH] scudo: Replace ALIGNED macro with standard alignas specifier. alignas was introduced in C++11 and is already being used throughout LLVM. Differential Revision: https://reviews.llvm.org/D77823 --- compiler-rt/lib/scudo/standalone/atomic_helpers.h | 2 +- compiler-rt/lib/scudo/standalone/internal_defs.h | 3 --- compiler-rt/lib/scudo/standalone/primary32.h | 2 +- compiler-rt/lib/scudo/standalone/primary64.h | 2 +- compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp | 2 +- compiler-rt/lib/scudo/standalone/tsd.h | 2 +- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler-rt/lib/scudo/standalone/atomic_helpers.h b/compiler-rt/lib/scudo/standalone/atomic_helpers.h index 6c84ba86..1ea1a86 100644 --- a/compiler-rt/lib/scudo/standalone/atomic_helpers.h +++ b/compiler-rt/lib/scudo/standalone/atomic_helpers.h @@ -51,7 +51,7 @@ struct atomic_u32 { struct atomic_u64 { typedef u64 Type; // On 32-bit platforms u64 is not necessarily aligned on 8 bytes. - ALIGNED(8) volatile Type ValDoNotUse; + alignas(8) volatile Type ValDoNotUse; }; struct atomic_uptr { diff --git a/compiler-rt/lib/scudo/standalone/internal_defs.h b/compiler-rt/lib/scudo/standalone/internal_defs.h index c61f8e6..a884f1f 100644 --- a/compiler-rt/lib/scudo/standalone/internal_defs.h +++ b/compiler-rt/lib/scudo/standalone/internal_defs.h @@ -33,9 +33,6 @@ #define WEAK __attribute__((weak)) #define ALWAYS_INLINE inline __attribute__((always_inline)) #define ALIAS(X) __attribute__((alias(X))) -// Please only use the ALIGNED macro before the type. Using ALIGNED after the -// variable declaration is not portable. -#define ALIGNED(X) __attribute__((aligned(X))) #define FORMAT(F, A) __attribute__((format(printf, F, A))) #define NOINLINE __attribute__((noinline)) #define NORETURN __attribute__((noreturn)) diff --git a/compiler-rt/lib/scudo/standalone/primary32.h b/compiler-rt/lib/scudo/standalone/primary32.h index 9dac498..293b561 100644 --- a/compiler-rt/lib/scudo/standalone/primary32.h +++ b/compiler-rt/lib/scudo/standalone/primary32.h @@ -225,7 +225,7 @@ private: u64 LastReleaseAtNs; }; - struct ALIGNED(SCUDO_CACHE_LINE_SIZE) SizeClassInfo { + struct alignas(SCUDO_CACHE_LINE_SIZE) SizeClassInfo { HybridMutex Mutex; SinglyLinkedList FreeList; uptr CurrentRegion; diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h index 8e0224e..b92ca2d 100644 --- a/compiler-rt/lib/scudo/standalone/primary64.h +++ b/compiler-rt/lib/scudo/standalone/primary64.h @@ -231,7 +231,7 @@ private: u64 LastReleaseAtNs; }; - struct ALIGNED(SCUDO_CACHE_LINE_SIZE) RegionInfo { + struct alignas(SCUDO_CACHE_LINE_SIZE) RegionInfo { HybridMutex Mutex; SinglyLinkedList FreeList; RegionStats Stats; diff --git a/compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp b/compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp index ce715a1..ed56cb5 100644 --- a/compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp @@ -52,7 +52,7 @@ private: static const scudo::u32 Size = 64U; typedef scudo::u64 T; scudo::HybridMutex &Mutex; - ALIGNED(SCUDO_CACHE_LINE_SIZE) T Data[Size]; + alignas(SCUDO_CACHE_LINE_SIZE) T Data[Size]; }; const scudo::u32 NumberOfThreads = 8; diff --git a/compiler-rt/lib/scudo/standalone/tsd.h b/compiler-rt/lib/scudo/standalone/tsd.h index 20f0d69..b3701c6 100644 --- a/compiler-rt/lib/scudo/standalone/tsd.h +++ b/compiler-rt/lib/scudo/standalone/tsd.h @@ -23,7 +23,7 @@ namespace scudo { -template struct ALIGNED(SCUDO_CACHE_LINE_SIZE) TSD { +template struct alignas(SCUDO_CACHE_LINE_SIZE) TSD { typename Allocator::CacheT Cache; typename Allocator::QuarantineCacheT QuarantineCache; u8 DestructorIterations; -- 2.7.4