[ccache] Making ccache and clang compatible

Lubos Lunak l.lunak at suse.cz
Wed Jul 11 07:07:35 MDT 2012


On Wednesday 11 of July 2012, Max Horn wrote:
> 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:
> >> 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,

 But you probably could. -I, -D, -U etc. are preprocessor options and not 
compiler options, and the preprocessor is (at least in the separate 
compilation steps theory) not run when the driver is fed preprocessed source.

> > 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.

 The best option is to use CCACHE_CPP2 with Clang. Giving Clang preprocessed 
source causes a number of small problems, such as some warnings not being 
suppressed or error/warning messages quoting modified source code. As a 
side-effect, this problem with preprocessor options will not exist with 
CCACHE_CPP2 either. It is a question how much not using CCACHE_CPP2 with 
Clang would improve performance anyway.

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the ccache mailing list