[PATCH] D137043: [clang] add implicit include for Linux/gnu compatibility
Tao Liang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 31 01:57:05 PDT 2022
Origami404 added a comment.
After digging more deeply into tests, I found that if we decide to make clang include `stdc-predef.h` or other things, the behavior of many libtooling-related tools (e.g. clang-tidy, clangd, and python binding) will be affected.
For example, `clang-tidy/checkers/cppcoreguidelines/macro-usage.cpp` tests improper macro usage. If we #include `stdc-predef.h` implicitly, it will give warnings to macros that are inside this header. Another example is `clang-tidy/checkers/portability/restrict-system-includes-disallow.cpp`, it will give errors for including `stdc-predef.h`.
In my opinion, we may need to spend more time discussing how to make `__STD_C_*` macros available. The way that D34158 <https://reviews.llvm.org/D34158> take will affect too many tools using libtooling, which may not be a problem back in 2017.
By the way, I have made a patch to pass tests about clang-tidy and python binding by adding more `-ffreestanding` flags. But I think it's better to re-think the impact it will make instead of just making the test pass. But I still can not figure out why the `git clang-format` failed on the CI.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137043/new/
https://reviews.llvm.org/D137043
More information about the cfe-commits
mailing list