[clang] [Driver] -include: deprecate probing .gch (PR #67084)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 12:32:19 PDT 2023


MaskRay wrote:

> > Having a `-Wdeprecated-include-gch` looks good to me.
> 
> But do we intend to remove it later? That will break the drop-in ability of Clang, and probably a lot of people's builds.
> 
> > The inconvenience probing .gch happens when GCC and Clang .pch files are mismatched
> 
> To solve this, couldn't the driver peek at the magic at the start of the file or something like that?

This is feasible but not elegant, and likely unnecessary.

I have tried many keywords to figure out `-o .*\.gch` users and the number is likely extremely small. Among them, there are many that place the `-include` header and `.gch` file in the same directory, and these users won't be affected at all (a lot of distributions do not use a separate build directory)
https://sourcegraph.com/search?q=context:global+-o%5B+%5D.*%5C.gch&patternType=regexp&sm=1&groupBy=repo

Many modern build systems (Bazel, Buck) require the full set of output files.
As an opt-in feature, PCH is typically not modeled at all, at least for the majority of packages.

https://github.com/llvm/llvm-project/pull/67084


More information about the cfe-commits mailing list