[cfe-dev] Clang + ccache == different warnings?

Eli Friedman eli.friedman at gmail.com
Fri Jun 1 13:15:26 PDT 2012

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.


More information about the cfe-dev mailing list