[NFC] [scudo] move static_assert closer to class it relates to (#84257)

delete other static_assert
This commit is contained in:
Florian Mayer 2024-03-11 11:46:45 -07:00 committed by GitHub
parent 8846b91e15
commit b4e0890458
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 10 deletions

View File

@ -1553,16 +1553,6 @@ private:
constexpr u32 kFramesPerStack = 16;
static_assert(isPowerOfTwo(kFramesPerStack));
// We need StackDepot to be aligned to 8-bytes so the ring we store after
// is correctly assigned.
static_assert(sizeof(StackDepot) % alignof(atomic_u64) == 0);
// Make sure the maximum sized StackDepot fits withint a uintptr_t to
// simplify the overflow checking.
static_assert(sizeof(StackDepot) + UINT32_MAX * sizeof(atomic_u64) *
UINT32_MAX * sizeof(atomic_u32) <
UINTPTR_MAX);
if (AllocationRingBufferSize > kMaxU32Pow2 / kStacksPerRingBufferEntry)
return;
u32 TabSize = static_cast<u32>(roundUpPowerOfTwo(kStacksPerRingBufferEntry *

View File

@ -199,6 +199,10 @@ public:
void enable() NO_THREAD_SAFETY_ANALYSIS { RingEndMu.unlock(); }
};
// We need StackDepot to be aligned to 8-bytes so the ring we store after
// is correctly assigned.
static_assert(sizeof(StackDepot) % alignof(atomic_u64) == 0);
} // namespace scudo
#endif // SCUDO_STACK_DEPOT_H_