Skip to content

Phase 2: -Wignored-qualifiers を潰して -Werror=ignored-qualifiers を有効化 - #68

Merged
thawk105 merged 2 commits into
masterfrom
werror-ignored-qualifiers
May 14, 2026
Merged

Phase 2: -Wignored-qualifiers を潰して -Werror=ignored-qualifiers を有効化#68
thawk105 merged 2 commits into
masterfrom
werror-ignored-qualifiers

Conversation

@thawk105

Copy link
Copy Markdown
Owner

#43 Phase 2 のサブタスク。-Wignored-qualifiers の警告を潰し、ccbench_add_protocol()-Werror=ignored-qualifiers を追加する。

修正概要

GCC 13 build で得た hits は実体 6 箇所 (include/bomb.hh x3 行 + include/bomb_pessimistic.hh x3 行) のみ。複数プロトコルから include されるためコンパイル単位ごとに重複していたが、ユニーク行は次のとおり。

ファイル 関数 修正内容
include/bomb.hh L506 get_i_id_product_start() 値返却の const uint32_t から const 削除
include/bomb.hh L510 get_i_id_material_start() 同上
include/bomb.hh L514 get_i_id_work_start() 同上
include/bomb_pessimistic.hh L540 get_i_id_product_start() 同上
include/bomb_pessimistic.hh L544 get_i_id_material_start() 同上
include/bomb_pessimistic.hh L548 get_i_id_work_start() 同上

いずれも「値返却関数の return type に付いた top-level const」パターン。const uint32_t を値で返しても呼び出し側からは uint32_t と区別がつかず、-Wignored-qualifiers が正しく no-op qualifier として検出していた。真のバグ (UB / 動作差分) を生むコードは無し — 純粋にノイズの削除。

CMake

cmake/ProtocolHelpers.cmaketarget_compile_options 末尾に -Werror=ignored-qualifiers を追加 (既存 7 行は変更なし)。

Test plan

  • GCC 13 Release / -DENABLE_SANITIZER=OFF: 34/34 ビルド成功
  • GCC 11 Debug + ASan: 34/34 ビルド成功
  • CI 緑

Related

thawk105 added 2 commits May 13, 2026 15:47
The three static helpers `get_i_id_product_start/material_start/work_start`
return `uint32_t` by value, but were declared with a top-level `const` on
the return type. GCC's `-Wignored-qualifiers` flags this as a no-op
qualifier (a value-returned `const uint32_t` is no different from
`uint32_t` to the caller). Drop the redundant `const` from the return
type in both bomb.hh and bomb_pessimistic.hh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant