]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/rgw: annotating variables with maybe_unused
authorRonen Friedman <rfriedma@redhat.com>
Wed, 5 Jul 2023 11:01:10 +0000 (06:01 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Wed, 5 Jul 2023 11:01:10 +0000 (06:01 -0500)
Some variables in test/rgw/rgw_cr_test.cc are only used in
asserts, while this file is also used in builds without
NDEBUG set.
Adding the [[maybe_unused]] attribute clears the compilation
warnings.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/test/rgw/rgw_cr_test.cc

index 37120925291a30df0609043c706e2a9177743396..2c250b390a986f6ba8f9117a754284e80a5f0582 100644 (file)
@@ -55,12 +55,14 @@ struct TempPool {
     fmt::format("{}-{}-{}", ::time(nullptr), ::getpid(),num++);
 
   TempPool() {
-    auto r = store->getRados()->get_rados_handle()->pool_create(name.c_str());
+    [[maybe_unused]] auto r =
+        store->getRados()->get_rados_handle()->pool_create(name.c_str());
     assert(r == 0);
   }
 
   ~TempPool() {
-    auto r = store->getRados()->get_rados_handle()->pool_delete(name.c_str());
+    [[maybe_unused]] auto r =
+        store->getRados()->get_rados_handle()->pool_delete(name.c_str());
     assert(r == 0);
   }
 
@@ -70,8 +72,9 @@ struct TempPool {
 
   operator librados::IoCtx() {
     librados::IoCtx ioctx;
-    auto r = store->getRados()->get_rados_handle()->ioctx_create(name.c_str(),
-                                                                ioctx);
+    [[maybe_unused]] auto r =
+        store->getRados()->get_rados_handle()->ioctx_create(name.c_str(),
+                                                            ioctx);
     assert(r == 0);
     return ioctx;
   }