Warn on and add missing [[noreturn]]

bitcoin/bitcoin: PR #35911

1 minor finding · 1 suggestion

Earlier concerns neither republished nor resolved: 3 suggestions. See the Run archive for their assessments.

Findings

Link

[minor] · clang-cl skips the fuzzing -Wmissing-noreturn suppression

clang-cl Release fuzz builds with BUILD_FUZZ_BINARY=ON and BUILD_FOR_FUZZING=OFF are expected to warn under -Wmissing-noreturn, or fail with CMAKE_COMPILE_WARNING_AS_ERROR=ON; this diagnostic was not reproduced.

Location: src/test/fuzz/fuzz.cpp:135 (head).

Details and suggested fix

Both diagnostic guards test only __GNUC__, which clang-cl does not define, although CMake enables the warning outside if(MSVC). In this documented compile/link-only configuration, G_FUZZING_BUILD and G_ABORT_ON_FAILED_ASSUME are both false, so the if constexpr branch in initialize() always calls std::exit(). The suppression intended for this build is therefore absent. Windows fuzz CI selects BUILD_FOR_FUZZING=ON and does not cover this configuration. Change both guards to #if defined(__GNUC__) || defined(__clang__) so clang-cl, which honors these GCC diagnostic pragmas, receives the existing suppression.


Optional improvements

Link

[suggestion] · Helper relocation obscures the pragma change in 6884249d

An unchanged helper relocation adds roughly 80 diff lines around the pragma change in 6884249d, making the suppression boundaries harder to validate.

Location: src/test/fuzz/fuzz.cpp:93 at 6884249df1b7 (commit) (commit).

Details and suggested fix

In 6884249df1b7bc9e589eeb0594613a222467bceb, read_stdin(), read_file(), g_input_path and signal_handler() move before initialize() so they remain outside the suppressed region. They are unchanged from its direct parent, 3c5e7a9b76f9d2e6eb9a9c89fc86ba3b98ffcbb7, which already added [[noreturn]] to signal_handler(). Split the relocation into a pure-move commit followed by a pragma-only commit. Keep both after that parent and before e7567b4d524cb09cb208160b465837381259ab88, which enables -Wmissing-noreturn. This preserves the final tree and prerequisites while making the suppression-only patch directly reviewable.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.