#35911 Warn on and add missing [[noreturn]]
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #35911 Warn on and add missing [[noreturn]] | CI failing | 0 | Mild | 37 + 63 tests | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Enables the -Wmissing-noreturn compiler warning flag in CMake and annotates non-returning functions, methods, and lambdas across the codebase with [[noreturn]]. It also suppresses Clang's -Wc++23-lambda-attributes warning on annotated lambdas and migrates bare C exit and abort calls (abort(), exit(), _Exit()) to their std:: counterparts in <cstdlib>.
Problem: Functions that never return (such as unconditional throwers, exit handlers, and fatal assert stubs) lack [[noreturn]] annotations, which can lead to compiler analysis false positives such as spurious missing-return warnings. Without an enforced compiler warning flag, newly added non-returning functions easily omit the attribute.
Evidence of importance:
- PR description: "Missing [[noreturn]] attributes can cause compiler false positives and other issues; see discussion in https://github.com/bitcoin/bitcoin/pull/35896#discussion_r3726612556."
- Commit 934c041f07 adds -Wmissing-noreturn to warning flags to enforce the attribute systematically.
Scope: Touches bundled third-party or extracted libraries (src/ipc/libmultiprocess commit marked [nomerge], and src/util/subprocess.h), which the author has submitted upstream.
Risk of a mistake: low (build, validation, gui, tests). Mistakes are limited to compile-time attribute and warning flag changes or minor std:: namespace qualification on abort/exit calls.
Changed since the previous assessment: Expanded the standard library refactor commit to replace bare abort() and _Exit() calls across validation, sync, and txdb with std::abort() and std::_Exit(), alongside the previous std::exit() replacements.
Reviewability
Ready · CI failing
CI is red; check whether the failure is the PR's before a deep review.
Agreement
Mild
objection that needs an answer has none yet (maflcko)
Thread notes: Initial record for draft PR #35911. Concept ACKs from hebasto and stickies-v, plus approval from maflcko. Open compilation/warning issues remain on fuzz tests and Windows (MSVC/clang-cl), and the PR is drafted awaiting upstream subtree updates.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| maflcko (member) | objection, correctness | compiler errors in fuzz tests under clang due to noreturn/unreachable code warnings | open · v1, not yet re-checked | answered | no | 2026-08-06: 'This one is wrong: /home/runner/work/bitcoin/bitcoin/src/test/fuzz/fuzz.cpp:168:1: error: function declared 'noreturn' should not return [-Werror,-Winvalid-noreturn]' |
| maflcko (member) | objection, correctness | compilation failures on Windows with clang-cl and MSVC | open · v1, not yet re-checked | answered | no | 2026-08-31: 'Looks like this still fails to compile on Windows for both clang-cl and MSVC?' |
Support:
- maflcko (member) (ACK, 2026-08-06): Nice. lgtm. Left some style nits, but feel free to ignore. [not substantive]
- hebasto (member) (Concept ACK, 2026-08-06): Concept ACK. [not substantive]
- stickies-v (member) (Concept ACK, 2026-08-11): Concept ACK [not substantive]
Participants:
- Sjors (member, question, 1 statements 2026-08-06 to 2026-08-06): asked about potential false positives from the warning flag, cited outdated docs
- hebasto (member, support, 2 statements 2026-08-06 to 2026-08-06): Concept ACK; asked to split a commit into a separate PR
- maflcko (member, objection, 7 statements 2026-08-06 to 2026-08-31): supported overall ('Nice. lgtm'), but reported compiler errors in fuzz.cpp and Windows build failures
- stickies-v (member, support, 1 statements 2026-08-11 to 2026-08-11): Concept ACK
Files
118 lines under test/bench/ci.
- src/test/fuzz/fuzz.cpp +50/-41
- src/sync.cpp +8/-7
- src/bitcoind.cpp +7/-6
- src/test/util/net.h +3/-3
- CMakeLists.txt +5/-0
- src/qt/bitcoin.cpp +3/-2
- src/validation.h +3/-2
- src/protocol.cpp +3/-1
- src/test/threadpool_tests.cpp +3/-1
- src/test/util/setup_common.cpp +2/-2
- src/test/util/net.cpp +0/-3
- src/test/util_tests.cpp +2/-1
- src/interfaces/init.h +1/-1
- src/interfaces/mining.h +1/-1
- src/ipc/libmultiprocess/include/mp/proxy-types.h +1/-1
- src/ipc/libmultiprocess/test/mp/test/foo.h +1/-1
- src/qt/bitcoin.h +1/-1
- src/rpc/mining.cpp +1/-1
- src/test/fuzz/dbwrapper.cpp +1/-1
- src/test/fuzz/threadpool.cpp +1/-1
- src/test/fuzz/util/net.h +1/-1
- src/txdb.cpp +1/-1
- src/util/subprocess.h +1/-1
- src/test/fuzz/util/net.cpp +0/-1
Card
The short text the ranking pass compares across PRs.
Enables the -Wmissing-noreturn compiler warning flag in CMake and annotates non-returning functions, methods, and lambdas across the codebase with [[noreturn]]. It also migrates bare C runtime abort and exit calls to std::abort, std::exit, and std::_Exit, while suppressing Clang -Wc++23-lambda-attributes warnings on annotated lambdas. This prevents compiler analysis false positives, such as spurious missing-return warnings, where the compiler cannot tell that a branch unconditionally terminates.
Data
thread read through 2026-08-31 (18 statements), head f60775233b
Discussion read under schema 1 rules: suggestions and questions may be missing, and an objection may combine several harms (schema history).
labels: CI failed · draft
Categories
Build and CI
P3 · cleanup (ranking pass: Moved down from 32: prevents spurious diagnostics only; weaker payoff than -Wunused's cited bug class)
Enables the -Wmissing-noreturn compiler warning flag in CMake and annotates non-returning functions to prevent compiler analysis false positives. While systematic warning enforcement improves code hygiene and avoids spurious missing-return diagnostics, it is developer-focused and reasonably deferrable.
Membership: Modifies CMakeLists.txt to enable the -Wmissing-noreturn compiler warning flag and suppress Clang warnings on annotated lambdas.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 1