Skip to content

Commit

Permalink
Fix warnings -Wunused-variable in release (#4418)
Browse files Browse the repository at this point in the history
This fixes the following warning in release

src/lib/support/Pool.cpp:69:10: error: unused variable 'value' [-Werror,-Wunused-variable]
    auto value = mUsage[word].fetch_and(~(kBit1 << offset));

Switch to nlassert since this macro doesn't cause unused variable
warnings when assertions are disabled.
  • Loading branch information
mspang authored and pull[bot] committed Jan 26, 2021
1 parent 40b8055 commit 4216025
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/support/Pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include <support/Pool.h>

#include <nlassert.h>

namespace chip {

StaticAllocatorBitmap::StaticAllocatorBitmap(void * storage, std::atomic<tBitChunkType> * usage, size_t capacity,
Expand Down Expand Up @@ -67,7 +69,7 @@ void StaticAllocatorBitmap::Deallocate(void * element)
assert(index < Capacity());

auto value = mUsage[word].fetch_and(~(kBit1 << offset));
assert((value & (kBit1 << offset)) != 0); // assert fail when free an unused slot
nlASSERT((value & (kBit1 << offset)) != 0); // assert fail when free an unused slot
mAllocated--;
}

Expand Down

0 comments on commit 4216025

Please sign in to comment.