A .c source file is included into another file
What it finds
#include "parser.c": a source file included into another is compiled twice if the build also compiles it on its own, which gives duplicate definitions, and its static functions and variables leak into the including file. A header with declarations is the usual way to share code. Some projects build one file from many on purpose.
From the rule's source, source_file_included.rs.
#include "parser.c"tx0 reports: a source file is included here#include "parser.h"#include <stdio.h>int x; 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:source-file-included" = "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:source-file-included] reason="..."tx0 explain tx0/c:source-file-included shows the same in the terminal. Found a false positive? Report it.