Skip to content

[clang-tidy] misc-include-cleaner false positive for FILE type header in C89 & C90 #134535

Open
@abdelmaged

Description

@abdelmaged

Source C file:

#include <stdio.h>

void testFileType(FILE *fp) {
}

Using clang-tidy misc-include-cleaner:

$ clang-tidy mytest.c -checks=-*,misc-include-cleaner -- -std=c89
2 warnings generated.
mytest.c:1:1: warning: included header stdio.h is not used directly [misc-include-cleaner]
    1 | #include <stdio.h>
      | ^~~~~~~~~~~~~~~~~~
    2 | 
mytest.c:3:19: warning: no header providing "FILE" is directly included [misc-include-cleaner]
    1 | #include <stdio.h>
    2 | 
    3 | void testFileType(FILE *fp) {
      |                   ^

Issue also reproducible in this link:
https://godbolt.org/z/3aWYjhjdb

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions