A function declared static is defined later without static, which keeps it internal but reads as external
What it finds
static int helper(void); and later int helper(void) { ... }: the definition inherits internal linkage from the declaration, but a reader of the definition alone takes the function for one other files can call.
From the rule's source, static_declared_defined_without.rs.
static int helper(int x); int helper(int x)tx0 reports: helper is declared static but defined without it{ return x + 1;} 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:
[rules]
"tx0/c:static-declared-defined-without" = "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:static-declared-defined-without] reason="..."tx0 explain tx0/c:static-declared-defined-without shows the same in the terminal. Found a false positive? Report it.