Control is transferred with setjmp and longjmp

tx0/c:setjmp-longjmpstrictwarningmaintainability

What it finds

longjmp jumps back into a function that called setjmp, past every function in between, which do not get to free what they hold, and local variables changed since the setjmp have unreliable values unless they are volatile.

From the rule's source, setjmp_longjmp.rs.

Example from the rule's tests
#include <setjmp.h> static jmp_buf env; void fail(void){  longjmp(env, 1);tx0 reports: longjmp transfers control past the functions in between}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

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

tx0.toml
[rules]
"tx0/c:setjmp-longjmp" = "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/c:setjmp-longjmp] reason="..."

tx0 explain tx0/c:setjmp-longjmp shows the same in the terminal. Found a false positive? Report it.