nelhage / llama

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include system headers in dependency list for preprocessing

nvartolomei opened this issue · comments

Currently system and transitive headers are excluded:

preprocessor.Args = append(preprocessor.Args, "-MM", "-MF", "-", comp.Input)

I'm trying to build https://github.com/clickhouse/clickhouse and it uses -isystem includes extensively for dependencies. Almost all dependencies are vendored in contrib/ with an option to fallback to system provided library.

It seems that -isystem include is also used to hide some warnings from dependencies as the project is configured with aggressive warnings.

What do you think about changing -MM to -M and provide an option (maybe enabled by default) to exclude transferring includes outside of project root (what would this be?).

Oof, yeah, I fretted over this when I wrote -MM and then didn't find a super clean solution and deferred it.

I think the best answer here might be to use -M, and then to exclude everything inside the default search path, as determined by $CC -Wp,-v -xc -E -o/dev/null /dev/null. Ideally we'd cache that result somewhere, though, since I don't want to add another compiler invocation to every build. We could add a dedicated RPC to the daemon, I suppose.

Does that seem likely to work?