From: Sun Yuechi Date: Mon, 15 Jun 2026 19:41:34 +0000 (+0800) Subject: crimson,mgr: mark assert-only variables [[maybe_unused]] X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d3c8d3fc6566d3c909d36875d9ba05345fc90cb2;p=ceph.git crimson,mgr: mark assert-only variables [[maybe_unused]] 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 --- diff --git a/src/crimson/os/seastore/lba/btree_lba_manager.cc b/src/crimson/os/seastore/lba/btree_lba_manager.cc index 7f1bb7f4486..0d71c0969de 100644 --- a/src/crimson/os/seastore/lba/btree_lba_manager.cc +++ b/src/crimson/os/seastore/lba/btree_lba_manager.cc @@ -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(cache, c); auto iter = btree.make_partial_iter(c, *cursor); diff --git a/src/crimson/os/seastore/omap_manager/log/log_manager.cc b/src/crimson/os/seastore/omap_manager/log/log_manager.cc index f06a45bb2b1..03f16875c5c 100644 --- a/src/crimson/os/seastore/omap_manager/log/log_manager.cc +++ b/src/crimson/os/seastore/omap_manager/log/log_manager.cc @@ -70,7 +70,7 @@ LogManager::omap_set_keys( auto resync_node = [&](LogNodeRef e) -> log_load_extent_iertr::future { 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); diff --git a/src/crimson/os/seastore/transaction_manager.cc b/src/crimson/os/seastore/transaction_manager.cc index f0fd3509cea..f0e586220b9 100644 --- a/src/crimson/os/seastore/transaction_manager.cc +++ b/src/crimson/os/seastore/transaction_manager.cc @@ -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() diff --git a/src/mgr/PyModule.cc b/src/mgr/PyModule.cc index 46dc97073b8..40531f6db8f 100644 --- a/src/mgr/PyModule.cc +++ b/src/mgr/PyModule.cc @@ -163,7 +163,7 @@ std::span 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((const std::byte*)buf, size_t(length)); @@ -183,7 +183,7 @@ std::vector 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{