Skip to content

Commit

Permalink
[libc] Fix for unused variable warning (llvm#98086)
Browse files Browse the repository at this point in the history
This fixes the `unused variable 'new_inner_size'` warning that arises
when `new_inner_size` is only used by `LIBC_ASSERT` by performing the
calculation directly in the macro.
  • Loading branch information
Caslyn authored and aaryanshukla committed Jul 14, 2024
1 parent 96a2f36 commit 2d2f6c9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions libc/src/__support/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,7 @@ Block<OffsetType, kAlign>::allocate(Block *block, size_t alignment,

if (!info.block->is_usable_space_aligned(alignment)) {
size_t adjustment = info.block->padding_for_alignment(alignment);
size_t new_inner_size = adjustment - BLOCK_OVERHEAD;
LIBC_ASSERT(new_inner_size % ALIGNMENT == 0 &&
LIBC_ASSERT((adjustment - BLOCK_OVERHEAD) % ALIGNMENT == 0 &&
"The adjustment calculation should always return a new size "
"that's a multiple of ALIGNMENT");

Expand Down

0 comments on commit 2d2f6c9

Please sign in to comment.