On Mon, May 17, 2010 at 05:27, Bernhard Bauer <[email protected]> wrote:
> On Sunday, May 16, 2010, Joel Rosdahl  wrote:
>> On 2010-05-12 15:52, Bernhard Bauer wrote:
>>> attached are some patches needed to make compiling under Mac OS X with
>>> Xcode/distcc work.
>>
>> Thanks!
>>
>>> 0001-Add-Objective-C-to-the-mapping-from-source-files-to-.patch
>>
>> Sure. Applied.
>>
>>> 0002-Add-fpreprocessed-option-for-compiling-preprocessed-.patch
>>
>> Is this needed because GCC doesn't add -fpreprocessed implicitly like it
>> does for .i/.ii/.mi files?
>>
>> The patch looks OK, except that it seems that -fpreprocessed was added
>> in GCC 3.0, so GCC 2.95 wouldn't be supported anymore if we add the flag
>> unconditionally. I don't know if anyone still uses GCC 2.95, but maybe
>> we could do it like this instead:
>>
>> --- a/ccache.c
>> +++ b/ccache.c
>> @@ -497,6 +497,14 @@ static void to_cache(ARGS *args)
>>         putenv("DEPENDENCIES_OUTPUT");
>>
>>         if (compile_preprocessed_source_code) {
>> +               char *p = strrchr(i_tmpfile, '.');
>> +               if (p && strcmp(p, ".mii") == 0) {
>> +                       /*
>> +                        * GCC doesn't add -fpreprocessed implicitly for .mii
>> +                        * files, so we have to add it ourselves.
>> +                        */
>> +                       args_add(args, "-fpreprocessed");
>> +               }
>>                 args_add(args, i_tmpfile);
>>         } else {
>>                 args_add(args, input_file);
>>
>> What do you think?
>
> Or maybe it got confused by the -x option added by xcodebuild (for
> which I used Dirk Best's preliminary patch, so I didn't repeat it
> here). I'll find out which one is the case.

Turns out, the -x option was overriding the language auto-detection
based on the filename. I ended up rewriting the -x patch similar to
the way you suggested to Dirk, so now it supports properly changing
the language for preprocessed files, using a table mapping from file
extension to language, and one mapping from language to preprocessed
language (and it incorporates the first patch from my original mail).

You can find the patch at http://github.com/sheepmaster/ccache/commits/gcc_x .

Bernhard.
_______________________________________________
ccache mailing list
[email protected]
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to