Skip to content

Commit b4e0890

Browse files
authored
[NFC] [scudo] move static_assert closer to class it relates to (#84257)
delete other static_assert
1 parent 8846b91 commit b4e0890

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,16 +1553,6 @@ class Allocator {
15531553
constexpr u32 kFramesPerStack = 16;
15541554
static_assert(isPowerOfTwo(kFramesPerStack));
15551555

1556-
// We need StackDepot to be aligned to 8-bytes so the ring we store after
1557-
// is correctly assigned.
1558-
static_assert(sizeof(StackDepot) % alignof(atomic_u64) == 0);
1559-
1560-
// Make sure the maximum sized StackDepot fits withint a uintptr_t to
1561-
// simplify the overflow checking.
1562-
static_assert(sizeof(StackDepot) + UINT32_MAX * sizeof(atomic_u64) *
1563-
UINT32_MAX * sizeof(atomic_u32) <
1564-
UINTPTR_MAX);
1565-
15661556
if (AllocationRingBufferSize > kMaxU32Pow2 / kStacksPerRingBufferEntry)
15671557
return;
15681558
u32 TabSize = static_cast<u32>(roundUpPowerOfTwo(kStacksPerRingBufferEntry *

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ class alignas(atomic_u64) StackDepot {
199199
void enable() NO_THREAD_SAFETY_ANALYSIS { RingEndMu.unlock(); }
200200
};
201201

202+
// We need StackDepot to be aligned to 8-bytes so the ring we store after
203+
// is correctly assigned.
204+
static_assert(sizeof(StackDepot) % alignof(atomic_u64) == 0);
205+
202206
} // namespace scudo
203207

204208
#endif // SCUDO_STACK_DEPOT_H_

0 commit comments

Comments
 (0)