[ccache] Making ccache and clang compatible

Max Horn max at quendi.de
Wed Jul 11 06:42:46 MDT 2012

On 11.07.2012, at 02:34, Martin Pool wrote:

> On 5 July 2012 21:35, Mike Frysinger <vapier at gentoo.org> wrote:
>> On Wednesday 04 July 2012 09:53:46 Max Horn wrote:
>>> Using ccache with clang tends to generate tons of warnings, which can
>> range
>>> from simply being annoying, to causing autoconf failures. This is because
>>> ccache runs the compiler with "-E" on preprocessed input, but also passes
>>> -I, -isystem etc. flags on to the compiler. In clang, this triggers
>>> warnings about unused arguments.
>> err, -I/-isystem/-D/-U/etc... are preprocessor flags and are valid when
>> running
>> in preprocessor mode (-E).  i don't know if clang is broken, or your
>> analysis
>> is incorrect, but certainly that behavior you describe is wrong.
>> -mike
> I agree with you there, Mike,

As do I, actually -- sorry, my email was indeed nonsense and confused. What I *meant* was that on the second run (the one without -E, with preprocessed data as input), clang prints out warnings.

Now, I am not saying that ccache is doing anything wrong here, and one may argue about the usefulness of this clang warning. But it is here, and it affects people who would otherwise love to use ccache with clang (and that's not just me ;).

> but I think the bug originally described in <
> https://bugzilla.samba.org/show_bug.cgi?id=8460> could possibly be valid.
> If you are compiling from a .i or .ii file, the -D and -I options can't
> have any effect.  It's reasonable for clang to emit a warning about it, and
> it would be reasonable for ccache to strip those options when compiling a
> preprocessed file.

Aye, if that would be acceptable for the ccache authors, that would be the best solution I think. It would certainly be much cleaner than trying to detect clang and passing options to it to disable that warning...

Thanks a lot,

More information about the ccache mailing list