[cfe-dev] Clang + ccache == different warnings?
matthewbg at google.com
Fri Jun 1 13:24:32 PDT 2012
On Fri, Jun 1, 2012 at 1:17 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Fri, Jun 1, 2012 at 1:15 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>> On Fri, Jun 1, 2012 at 12:08 PM, Larry Gritz <lg at larrygritz.com> wrote:
>> > After compiling my apps with clang 3.1, and fixing all the new warnings
>> > it found that gcc did not care about, I wanted to get clang + ccache working
>> > together. I set up a bash script "~/bin/clang" that looks like this:
>> > #!/bin/bash
>> > ccache /opt/local/bin/clang $@
>> > Obviously this just calls ccache with the clang path and arguments. The
>> > surprising thing is that when I invoke clang this way, several classes of
>> > warnings are flagged that were not noticed when I ran /opt/local/bin/clang.
>> > The above example is on OS X, where I've installed clang 3.1 via
>> > Macports. But I've reproduced the same effect on Linux using clang/llvm
>> > that I compiled from the svn (3.1 branch) as well.
>> > Is this expected behavior? Does anybody have an explanation for what's
>> > going on here?
>> clang has a few warnings which are suppressed for specific patterns in
>> macros; if you pass clang a preprocessed file, it can't see the
>> macros, so the warning output can change a bit.
> Presumably something like ccache could be changed to use a "preprocess
> headers only (& leave in line directives)" option like we're adding to clang
> (under review at the moment)
I'll pick up that review again any day now ;)
(Seriously, I'll try to take a look this weekend.)
More information about the cfe-dev