From 42160251ff02707a295b744e06ab3384ce5509b5 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Wed, 20 Jan 2021 13:49:01 -0500 Subject: [PATCH] Fix warnings -Wunused-variable in release (#4418) 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. --- src/lib/support/Pool.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/support/Pool.cpp b/src/lib/support/Pool.cpp index 9be51d96f30562..b794bb4080f577 100644 --- a/src/lib/support/Pool.cpp +++ b/src/lib/support/Pool.cpp @@ -19,6 +19,8 @@ #include +#include + namespace chip { StaticAllocatorBitmap::StaticAllocatorBitmap(void * storage, std::atomic * usage, size_t capacity, @@ -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--; }