From: Kefu Chai Date: Wed, 22 Aug 2018 13:45:41 +0000 (+0800) Subject: test,common: silence -Wunused-variable warnings X-Git-Tag: v14.0.1~505^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1f9ee225873c48831bbfaf8841aab1c68fefc450;p=ceph-ci.git test,common: silence -Wunused-variable warnings if compiled with -NDEBUG, assert() is optimised out. Signed-off-by: Kefu Chai --- diff --git a/src/common/Cond.h b/src/common/Cond.h index 949f2933432..00c6cdcce26 100644 --- a/src/common/Cond.h +++ b/src/common/Cond.h @@ -30,7 +30,7 @@ class Cond { public: Cond() : waiter_mutex(NULL) { - int r = pthread_cond_init(&_c,NULL); + [[maybe_unused]] int r = pthread_cond_init(&_c,NULL); assert(r == 0); } virtual ~Cond() { diff --git a/src/common/config_obs_mgr.h b/src/common/config_obs_mgr.h index 2da4cb0f059..170b4d63bd8 100644 --- a/src/common/config_obs_mgr.h +++ b/src/common/config_obs_mgr.h @@ -67,7 +67,7 @@ void ObserverMgr::add_observer(ConfigObs* observer) template void ObserverMgr::remove_observer(ConfigObs* observer) { - bool found_obs = false; + [[maybe_unused]] bool found_obs = false; for (auto o = observers.begin(); o != observers.end(); ) { if (o->second == observer) { observers.erase(o++); diff --git a/src/include/on_exit.h b/src/include/on_exit.h index 6510feffb9c..47d222c7cc1 100644 --- a/src/include/on_exit.h +++ b/src/include/on_exit.h @@ -15,7 +15,7 @@ class OnExitManager { typedef void (*callback_t)(void *arg); OnExitManager() { - int ret = pthread_mutex_init(&lock_, NULL); + [[maybe_unused]] int ret = pthread_mutex_init(&lock_, NULL); assert(ret == 0); } diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index 4e8a21f00fb..fdcbdd3c245 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -2577,8 +2577,8 @@ TEST(BufferList, crc32c_append_perf) { // track usage of cached crcs buffer::track_cached_crc(true); - int base_cached = buffer::get_cached_crc(); - int base_cached_adjusted = buffer::get_cached_crc_adjusted(); + [[maybe_unused]] int base_cached = buffer::get_cached_crc(); + [[maybe_unused]] int base_cached_adjusted = buffer::get_cached_crc_adjusted(); bufferlist bla; bla.push_back(a);