Phase 4: -Wunused-parameter を潰して -Werror=unused-parameter を有効化#55
Merged
Conversation
GCC 13 -Wunused-parameter で 120 件 (10 protocol への展開込み、ユニークな
ソース位置は 21 箇所) の警告が出ていた。`ccbench_add_protocol()` の
target_compile_options に -Werror=unused-parameter を追加し、各ヒットを
潰した。スコープ過大化を避けるため API 形状は保ち、引数名隠し or
[[maybe_unused]] 属性で対応。引数自体の削除はしていない。
[[maybe_unused]] (signature 形状を保ったまま属性で抑制): 13 箇所
- include/tpcc/tpcc_query.hh: `Delivery::generate` の `opt` は
FIXED_WAREHOUSE_PER_THREAD define 時のみ未使用 — conditional
compile によるもので [[maybe_unused]] が適切。
- include/bomb.hh, include/bomb_pessimistic.hh: `decideType` の
Xoroshiro128Plus 引数 (現状の thid ベース分岐では使用していない)、
`request_dispatcher` の `thid`。
- include/tpcc.hh: `TPCCWorkload::prepare` の Param ポインタ。
- cc/ermia/include/tuple.hh, cc/si/include/tuple.hh,
cc/oze/include/tuple.hh: `Tuple::init` の `void* param`
(sister overload との signature 整合のためのプレースホルダ)。
- cc/cicada/include/tuple.hh, cc/mvto/include/tuple.hh:
`Tuple::init(thid, ver, initial_wts, body)` の `thid` と `body`。
- cc/oze/transaction.cc: `validation_worker` の `worker_id`
(#if DEBUG_MSG の中でしか使われない)。
- cc/ss2pl/util.cc: `partTableInit` (空関数) の全引数。
引数名隠し (`/*name*/` コメント): 8 箇所
- include/masstree_wrapper.hh: DefaultScanCallback の on_resp_node /
invoke と SearchRangeScanner::visit_leaf。Masstree のインター
フェース契約上、シグネチャは固定。
- cc/{cicada,ermia,mocc,oze,si,silo,tictoc}/include/scan_callback.hh:
TxScanCallback::invoke のデフォルト実装 (`return true;`) 4 引数。
protocol ごとに同一内容のヘッダが 7 ファイルあるので個別に修正。
cc/cicada/include/tuple.hh:94 と cc/mvto/include/tuple.hh:61 の
`init(thid, ver, initial_wts, TupleBody&& body)` は `body` を受け
取って捨てているが、対の overload `init(thid, body, param)` では
inline_ver_.body_ や latest_->body_ に std::move している。
意図と一致しているか別途確認すべきだが、scope を保つため本 PR では
[[maybe_unused]] でマークするに留めた。
`-Werror=unused-parameter` を ccbench_add_protocol() の
target_compile_options 末尾に追加。
- GCC 13 (CI と同じ) Release -DENABLE_SANITIZER=OFF: 34/34 ビルド成功
- GCC 11 Debug + ASan: 34/34 ビルド成功
0d4f18d to
f37c20b
Compare
Closed
4 tasks
This was referenced May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#43 Phase 4 のサブタスク。GCC 13
-Wunused-parameterで出ていた 120 件 (10 protocol 展開込み、ユニークなソース位置は 21 箇所) を潰し、ccbench_add_protocol()に-Werror=unused-parameterを追加する。修正概要
スコープ過大化を避けるため API 形状は保ち、引数名隠しか
[[maybe_unused]]属性で対応。引数自体の削除はしていない。[[maybe_unused]]属性Delivery::generateのopt(FIXED_WAREHOUSE_PER_THREAD 条件分岐)、BoMB::Query::decideTypeの Xoroshiro128Plus、request_dispatcherのthid、TPCCWorkload::prepareのParam*、ermia/si/oze のTuple::initのvoid* param、cicada/mvto のTuple::initのthidとbody、oze のvalidation_workerのworker_id(#if DEBUG_MSG)、ss2pl/util.cc の空関数partTableInit/*name*/)include/masstree_wrapper.hhのDefaultScanCallbackとSearchRangeScanner::visit_leaf(Masstree インターフェース契約)、cc/{cicada,ermia,mocc,oze,si,silo,tictoc}/include/scan_callback.hhのTxScanCallback::invokeデフォルト実装 (7 ファイル各 4 引数)潜在バグ候補 (本 PR では触らない)
cc/cicada/include/tuple.hh:94とcc/mvto/include/tuple.hh:61のinit(thid, ver, initial_wts, TupleBody&& body)はbodyを受け取って捨てている。対になっている overload
init(thid, body, param)ではinline_ver_.body_やlatest_->body_にstd::moveしているため、unused にしている方は意図的でない可能性がある。scope を保つため本 PR では
[[maybe_unused]]でマークするに留めたが、別 PR で要レビュー。
CMake
target_compile_options(${target} PRIVATE -Werror=maybe-uninitialized -Werror=unused-but-set-variable - -Werror=unused-label) + -Werror=unused-label + -Werror=unused-parameter)Test plan
-DENABLE_SANITIZER=OFF: 34/34Related