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 <sunyuechi@iscas.ac.cn>
This commit is contained in:
Sun Yuechi 2026-06-16 03:41:34 +08:00
parent 1265c6b5cd
commit d3c8d3fc65
4 changed files with 5 additions and 5 deletions

View 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);

View 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);

View 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()

View 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>{