Skip to content

Commit

Permalink
scudo: Replace ALIGNED macro with standard alignas specifier.
Browse files Browse the repository at this point in the history
alignas was introduced in C++11 and is already being used throughout LLVM.

Differential Revision: https://reviews.llvm.org/D77823
  • Loading branch information
pcc committed Apr 9, 2020
1 parent 55efb68 commit 9c86b83
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/atomic_helpers.h
Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions compiler-rt/lib/scudo/standalone/internal_defs.h
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/primary32.h
Expand Up @@ -225,7 +225,7 @@ class SizeClassAllocator32 {
u64 LastReleaseAtNs;
};

struct ALIGNED(SCUDO_CACHE_LINE_SIZE) SizeClassInfo {
struct alignas(SCUDO_CACHE_LINE_SIZE) SizeClassInfo {
HybridMutex Mutex;
SinglyLinkedList<TransferBatch> FreeList;
uptr CurrentRegion;
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/primary64.h
Expand Up @@ -231,7 +231,7 @@ class SizeClassAllocator64 {
u64 LastReleaseAtNs;
};

struct ALIGNED(SCUDO_CACHE_LINE_SIZE) RegionInfo {
struct alignas(SCUDO_CACHE_LINE_SIZE) RegionInfo {
HybridMutex Mutex;
SinglyLinkedList<TransferBatch> FreeList;
RegionStats Stats;
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/tests/mutex_test.cpp
Expand Up @@ -52,7 +52,7 @@ class TestData {
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;
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/tsd.h
Expand Up @@ -23,7 +23,7 @@

namespace scudo {

template <class Allocator> struct ALIGNED(SCUDO_CACHE_LINE_SIZE) TSD {
template <class Allocator> struct alignas(SCUDO_CACHE_LINE_SIZE) TSD {
typename Allocator::CacheT Cache;
typename Allocator::QuarantineCacheT QuarantineCache;
u8 DestructorIterations;
Expand Down

0 comments on commit 9c86b83

Please sign in to comment.