Skip to content

clang-tidy misc-include-cleaner should not mark standard headers #134557

Open
@H-Wadman

Description

@H-Wadman

Note: I am currently on using clang-tidy provided with the llvm 20.1.2 package from homebrew.

I am currently using clang-tidy with the misc-include-cleaner to, well, keep my includes clean. However I keep getting warnings on standard headers, that in my opinion should not be marked. See for example this case:

Image

This file is including string.h, which is standardised to have NULL defined (see cppreference), but on my current platform (MacOS Sonoma 14.0), the standard library headers define NULL via transitive includes. In fact when I checked the cstring header provided via my llvm 20.1.2 libc++ it also does not define NULL directly. It would be nice (if considered feasible) to take C/C++ standards into account when considering missing includes in order to minimise changes with the sole purpose of satisfying the linter, without improvement to code quality.

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