[ccache] Making ccache and clang compatible
max at quendi.de
Thu Aug 16 06:54:55 MDT 2012
sorry for the late reply -- I simply overlooked that this thread was resumed :-(.
On 19.07.2012, at 23:34, Joel Rosdahl wrote:
> On 11 July 2012 14:42, Max Horn <max at quendi.de> wrote:
>> On 11.07.2012, at 02:34, Martin Pool wrote:
>>> 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...
> I agree, as long as it doesn't introduce regression for other compilers.
> Max, do you have a suggestion on which options would make sense to not
> pass to the preprocessor?
Naively, any preprocessor option would be suspect, I guess. Based on the clang manpage, that would include at least these:
I did some testing with the clang on my OS X 10.7.4 box, which is
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
This tells me that the following options cause the warning to appear:
-U, -I, -include
Based on the (Apple) GCC man page, I tested various more options; I am not sure whether these are explicitly supported by Apple the following also all trigger the warning:
imacros, idirafter, iprefix, iwithprefix, iwithprefixbefore, isystem, iquote (all takes a path as argument)
-I-, -C, -CC, -remap, -fno-working-directory,
-MG, -MP, -MD, -MMD,
-MF foobar, -MQ foobar, -MT foobar
-Xpreprocessor foobar, -Wp,foobar,
Interestingly, -imultilib also triggered the warning, but given a bogus path, it also triggered a linker error. This looks like a bug to me, based on the documentation for this switch.
These did not trigger the warning:
-D (to my surprise), -F (also surprised med),
-nostdinc, -nostdlibinc, -nobuiltininc,
-isysroot (agrees with documentation),
More information about the ccache