Skip to content

Commit 9c86b83

Browse files
committed
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
1 parent 55efb68 commit 9c86b83

File tree

6 files changed

+5
-8
lines changed

6 files changed

+5
-8
lines changed

compiler-rt/lib/scudo/standalone/atomic_helpers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct atomic_u32 {
5151
struct atomic_u64 {
5252
typedef u64 Type;
5353
// On 32-bit platforms u64 is not necessarily aligned on 8 bytes.
54-
ALIGNED(8) volatile Type ValDoNotUse;
54+
alignas(8) volatile Type ValDoNotUse;
5555
};
5656

5757
struct atomic_uptr {

compiler-rt/lib/scudo/standalone/internal_defs.h

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
#define WEAK __attribute__((weak))
3434
#define ALWAYS_INLINE inline __attribute__((always_inline))
3535
#define ALIAS(X) __attribute__((alias(X)))
36-
// Please only use the ALIGNED macro before the type. Using ALIGNED after the
37-
// variable declaration is not portable.
38-
#define ALIGNED(X) __attribute__((aligned(X)))
3936
#define FORMAT(F, A) __attribute__((format(printf, F, A)))
4037
#define NOINLINE __attribute__((noinline))
4138
#define NORETURN __attribute__((noreturn))

compiler-rt/lib/scudo/standalone/primary32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class SizeClassAllocator32 {
225225
u64 LastReleaseAtNs;
226226
};
227227

228-
struct ALIGNED(SCUDO_CACHE_LINE_SIZE) SizeClassInfo {
228+
struct alignas(SCUDO_CACHE_LINE_SIZE) SizeClassInfo {
229229
HybridMutex Mutex;
230230
SinglyLinkedList<TransferBatch> FreeList;
231231
uptr CurrentRegion;

compiler-rt/lib/scudo/standalone/primary64.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class SizeClassAllocator64 {
231231
u64 LastReleaseAtNs;
232232
};
233233

234-
struct ALIGNED(SCUDO_CACHE_LINE_SIZE) RegionInfo {
234+
struct alignas(SCUDO_CACHE_LINE_SIZE) RegionInfo {
235235
HybridMutex Mutex;
236236
SinglyLinkedList<TransferBatch> FreeList;
237237
RegionStats Stats;

compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TestData {
5252
static const scudo::u32 Size = 64U;
5353
typedef scudo::u64 T;
5454
scudo::HybridMutex &Mutex;
55-
ALIGNED(SCUDO_CACHE_LINE_SIZE) T Data[Size];
55+
alignas(SCUDO_CACHE_LINE_SIZE) T Data[Size];
5656
};
5757

5858
const scudo::u32 NumberOfThreads = 8;

compiler-rt/lib/scudo/standalone/tsd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace scudo {
2525

26-
template <class Allocator> struct ALIGNED(SCUDO_CACHE_LINE_SIZE) TSD {
26+
template <class Allocator> struct alignas(SCUDO_CACHE_LINE_SIZE) TSD {
2727
typename Allocator::CacheT Cache;
2828
typename Allocator::QuarantineCacheT QuarantineCache;
2929
u8 DestructorIterations;

0 commit comments

Comments
 (0)