[cfe-dev] ccache and 'unused argument' warning

Chris Lattner clattner at apple.com
Fri Jun 18 22:30:01 PDT 2010


A user who uses ccache reported that it is apparently doing something that causes it to emit tons of "argument unused during compilation warnings".  A typical invocation is something like this:

ccache clang++ -m32 -mmmx -msse  -pipe -march=pentium-m -I/usr/include/malloc -fasm-blocks -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -Wno-invalid-offsetof -Wno-unknown-pragmas -Wno-unused-parameter -Wno-reorder -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-invalid-offsetof -Wno-write-strings -gdwarf-2 -g2 -O3 -fno-strict-aliasing -DNDEBUG -DGNUC -DPOSIX -D_OSX -DOSX -Ifoo -c foo.cpp -o foo.o 

which produces warnings like this:
clang: warning: argument unused during compilation: '-c'
clang: warning: argument unused during compilation: '-I/usr/include/malloc'
clang: warning: argument unused during compilation: '-isysroot /Developer/SDKs/MacOSX10.5.sdk'
clang: warning: argument unused during compilation: '-DNDEBUG'
clang: warning: argument unused during compilation: '-DGNUC'
clang: warning: argument unused during compilation: '-DPOSIX'
clang: warning: argument unused during compilation: '-D_OSX'
clang: warning: argument unused during compilation: '-DOSX'
clang: warning: argument unused during compilation: '-Ifoo'

etc.  This is apparently local to something that ccache is doing: it must be running clang multiple times, one with some funny options.  The user was alarmed because he didn't think that clang had implemented such exotic options as -D and -I :) due to these warnings.

The question is: is this a ccache bug, or should we hack clang somehow to work better with ccache?  I don't use ccache or know anything about it, so I don't really have an opinion here.

-Chris



More information about the cfe-dev mailing list