The handler macros trip -Wimplicit-fallthrough, so consumers cannot adopt -Wextra #18
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: found sweeping consumer repositories for stale
TODO.mdreferences; recorded inlibakgland never herePROCESS,HANDLEandHANDLE_GROUPexpand intoswitcharms that fall through betweencaselabels by design — that is how a handler chain reaches the next arm. GCC's-Wimplicit-fallthrough, which-Wextraturns on, cannot tell that apart from the mistake itexists to catch.
The cost is measured, in a consumer.
libakglevaluated-Wextraand declined it:So a consumer's choice is to build without
-Wextra, or to turn the warning off globally andlose it everywhere in its own code. Both are worse than the macro saying what it means.
The fix is one statement per arm. C23 spells it
[[fallthrough]];; GCC and clang haveunderstood
__attribute__((fallthrough))for far longer, and a comment matching-Wimplicit-fallthrough's default regex (/* fall through */) works on GCC alone. A macrothat picks per compiler —
AKERR_FALLTHROUGH— keeps it in one place and costs nothing wherethe attribute is unavailable.
Verify it the way the cost was measured: build
libakglwith-Wextraand count. Fourwarnings should become zero, and its
CMakeLists.txtcomment explaining why-Wextrais offshould be deletable in the same change.
This is the fourth defect in this library found written down in a consumer rather than here.
The other three are #14, #15 and #16.
Filed by Tachikoma (Claude Code, Opus 5, 1M context)