]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson,mgr: mark assert-only variables [[maybe_unused]] 69509/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Mon, 15 Jun 2026 19:41:34 +0000 (03:41 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Tue, 16 Jun 2026 07:24:26 +0000 (15:24 +0800)
These variables are only read inside assert(), which is compiled out
under NDEBUG. Mark them [[maybe_unused]] to silence the warnings while
keeping the debug-only assert() style used by the surrounding code:

  src/crimson/os/seastore/lba/btree_lba_manager.cc:1078: unused variable 'orig_len' [-Wunused-variable]
  src/crimson/os/seastore/omap_manager/log/log_manager.cc:73: variable 'ret' set but not used [-Wunused-but-set-variable]
  src/crimson/os/seastore/transaction_manager.cc:382: variable 'intermediate_key' set but not used [-Wunused-but-set-variable]
  src/mgr/PyModule.cc:166,186: unused variable 'r' [-Wunused-variable]

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/crimson/os/seastore/lba/btree_lba_manager.cc
src/crimson/os/seastore/omap_manager/log/log_manager.cc
src/crimson/os/seastore/transaction_manager.cc
src/mgr/PyModule.cc

index 7f1bb7f4486ff1751ff01d8d057952ca1265b1bc..0d71c0969de25ddf81e4faad9e23fe2a285594a8 100644 (file)
@@ -1075,7 +1075,7 @@ BtreeLBAManager::remap_mappings(
   assert(cursor->is_viewable());
   auto orig_indirect = cursor->is_indirect();
   auto orig_laddr = cursor->get_laddr();
-  auto orig_len = cursor->get_length();
+  [[maybe_unused]] auto orig_len = cursor->get_length();
   auto c = get_context(t);
   auto btree = co_await get_btree<LBABtree>(cache, c);
   auto iter = btree.make_partial_iter(c, *cursor);
index f06a45bb2b12f017ebfe1623a877b01b1d304fb7..03f16875c5c38af5fc25d85522a9da07042092fe 100644 (file)
@@ -70,7 +70,7 @@ LogManager::omap_set_keys(
   auto resync_node = [&](LogNodeRef e)
     -> log_load_extent_iertr::future<CachedExtentRef> {
     CachedExtentRef node;
-    Transaction::get_extent_ret ret;
+    [[maybe_unused]] Transaction::get_extent_ret ret;
     // To find mutable extent in the same transaction
     ret = t.get_extent(e->get_paddr(), &node);
     assert(ret == Transaction::get_extent_ret::PRESENT);
index f0fd3509cea5e2479b1ff22fbe7b1e2c2620b9bb..f0e586220b9ef4f6f4607a843529e2f01b6893e1 100644 (file)
@@ -379,7 +379,7 @@ TransactionManager::resolve_cursor_to_mapping(
 
   ceph_assert(direct_cursors.size() == 1);
   auto& direct_cursor = direct_cursors.front();
-  auto intermediate_key = cursor->get_intermediate_key();
+  [[maybe_unused]] auto intermediate_key = cursor->get_intermediate_key();
   assert(!direct_cursor->is_indirect());
   assert(direct_cursor->get_laddr() <= intermediate_key);
   assert(direct_cursor->get_laddr() + direct_cursor->get_length()
index 46dc97073b89ff90f5afaea7580c1a8fbbbb51d2..40531f6db8f768d58bec886e0808139ab36bd227 100644 (file)
@@ -163,7 +163,7 @@ std::span<std::byte const> py_bytes_as_span(PyObject *bytes)
   assert(PyBytes_CheckExact(bytes));
   Py_ssize_t length;
   char *buf;
-  int r = PyBytes_AsStringAndSize(
+  [[maybe_unused]] int r = PyBytes_AsStringAndSize(
     bytes, &buf, &length);
   assert(r == 0);
   return std::span<std::byte const>((const std::byte*)buf, size_t(length));
@@ -183,7 +183,7 @@ std::vector<std::byte> py_bytes_as_vec(PyObject *bytes)
   assert(PyBytes_CheckExact(bytes));
   Py_ssize_t length;
   char *buf;
-  int r = PyBytes_AsStringAndSize(
+  [[maybe_unused]] int r = PyBytes_AsStringAndSize(
     bytes, &buf, &length);
   assert(r == 0);
   return std::vector<std::byte>{