A function definition has empty parentheses instead of (void)
What it finds
int f() { ... }: before C23, empty parentheses declare a function whose parameters are not given, so calls with arguments compile without a word. int f(void) says that it takes none, which the definition already means.
Only definitions are reported: for them, the fix to (void) keeps what the program does and lets the compiler check the calls. A declaration with empty parentheses may stand for a function defined elsewhere with parameters, so it is left alone.
From the rule's source, empty_parameter_list.rs.
int declared(); int count()tx0 reports: count is defined with () instead of (void){ return 0;} static int (*pick())(int)tx0 reports: pick is defined with () instead of (void){ return 0;} int none(void){ return declared();} int old(a) int a;{ return a;} 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:empty-parameter-list" = "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:empty-parameter-list] reason="..."tx0 explain tx0/c:empty-parameter-list shows the same in the terminal. Found a false positive? Report it.