A statement follows a return, break, continue or goto in the same block and never runs

tx0/cpp:unreachable-coderecommendedwarningmaintainability/dead-codedepth fastsmell

What it finds

return err; cleanup(p);: nothing can reach a statement right after a jump unless it carries a label, so it is dead; often it was meant to come before the jump.

The statement must follow a return, break, continue, goto, or a call of the C library's exit or abort, in the same block, with no directive between, and hold no label anywhere inside, which a switch could jump to. Declarations, empty statements and a break after a return, which some write out of habit, are left alone.

From the rule's source, unreachable_code.rs.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:unreachable-code" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/cpp:unreachable-code] reason="..."

tx0 explain tx0/cpp:unreachable-code shows the same in the terminal. Found a false positive? Report it.