A semicolon right after the head of a loop is its whole body, and the block after it runs once

tx0/cpp:empty-loop-bodydefaultwarningreliability/control-flowdepth fastbug

What it finds

while (n--); { total += n; } or for (i = 0; i < n; i++); followed by an indented statement: the semicolon on the line of the loop's head is the body, the loop runs without doing anything, and the statement meant as its body runs once afterwards.

The semicolon must be on the same line as the closing parenthesis, and the next statement either a block or one that starts on a later line indented deeper than the loop. Loops that wait on purpose, while (busy());, are followed by a statement at the same indentation and left alone.

From the rule's source, empty_loop_body.rs.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:empty-loop-body" = "off"

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:empty-loop-body] reason="..."

tx0 explain tx0/cpp:empty-loop-body shows the same in the terminal. Found a false positive? Report it.