`-include a.h` probes `a.h.pch` and `a.h.gch`, if not found, falls back to `a.h`. `.pch` is the preferred extension name. Probing .gch is supposed to provide compatibility with build systems that do ``` clang -x c-header a.h -o out/a.h.gch clang -include out/a.h -c a.c # out/a.h.gch is present while out/a.h is absent ``` (not sure what projects actually do this with Clang) But it can often get in the way [^0][^1][^2] when GCC and Clang are mixed as the file format is incompatible with GCC's. Let's deprecate .gch probing. Some tests using `-include` are switched to `.pch`. `test/PCH/pch-dir.c` shows the -Wdeprecated warning. [^0]: https://discourse.llvm.org/t/how-to-have-clang-ignore-gch-directories/51835 [^1]: https://bugreports.qt.io/browse/QTCREATORBUG-22427 [^2]: https://gitlab.kitware.com/cmake/cmake/-/issues/22081
8 lines
197 B
JSON
8 lines
197 B
JSON
[
|
|
{
|
|
"directory": "DIR",
|
|
"command": "clang -x c-header DIR/pch.h -fmodules -gmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -o DIR/pch.h.pch",
|
|
"file": "DIR/pch.h"
|
|
}
|
|
]
|