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] · -Wmissing-noreturn suppression skips native clang-cl

Native clang-cl skips the suppression for documented Release builds with BUILD_FUZZ_BINARY=ON and BUILD_FOR_FUZZING=OFF, exposing an inferred warning or warnings-as-errors build failure; this configuration was not built.

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

Details and suggested fix

test_fuzz receives the new -Wmissing-noreturn flag through core_interface even on the MSVC path, but native clang-cl does not define __GNUC__, so neither diagnostic pragma runs. With BUILD_FOR_FUZZING=OFF outside Debug, both build constants are false and the if constexpr in initialize() unconditionally calls std::exit(). The missing-noreturn diagnostic is therefore unsuppressed and becomes an error with CMAKE_COMPILE_WARNING_AS_ERROR=ON. Windows fuzz CI instead enables BUILD_FOR_FUZZING, so it does not cover this case. Guard both the push and pop with #if defined(__GNUC__) || defined(__clang__); Clang accepts the GCC diagnostic pragmas. Keep initialize() without an unconditional [[noreturn]], because it can return in fuzz and Debug builds.


Optional improvements

Link

[suggestion] · [[noreturn]] on the IPC stubs conflicts with returning proxies

Generated IPC overrides of makeMiningOld2 and submitSolutionOld7 can return after a successful reply, conflicting with the new [[noreturn]] contract; no current in-tree C++ caller of that path was found.

Location: src/interfaces/init.h:51 (head).

Details and suggested fix

Both methods appear in the wrapped Cap'n Proto schemas. ProxyClientBase inherits the C++ interface, and the generator emits overrides that call clientInvoke() and then complete normally, including return result for submitSolutionOld7. A successful reply reaches the end of clientInvoke() without throwing. If such a call goes through the annotated base declaration, returning violates its [[noreturn]] promise and has undefined behavior. Today's server throws from the base stubs, but that does not constrain a different peer's response. Drop these two attributes and locally suppress -Wmissing-noreturn if necessary. This preserves the server's error behavior without imposing a contract the generated clients cannot guarantee. Compiler-specific optimization effects were not tested.


Coverage details

Earlier concerns

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