Support for objective-C PCH
Neil Booth
neil@daikokuya.co.uk
Fri Mar 7 06:51:00 GMT 2003
Geoffrey Keating wrote:-
> +get_ident()
> +{
> + static char result[IDENT_LENGTH];
> + static const char template[IDENT_LENGTH] = "gpch.010";
> +
> + memcpy (result, template, IDENT_LENGTH);
> + if (strcmp (lang_hooks.name, "GNU C") == 0)
> + result[4] = 'C';
> + else if (strcmp (lang_hooks.name, "GNU C++") == 0)
> + result[4] = '+';
> + else if (strcmp (lang_hooks.name, "GNU Objective-C") == 0)
> + result[4] = 'o';
> + else if (strcmp (lang_hooks.name, "GNU Objective-C++") == 0)
> + result[4] = 'O';
> + else
> + abort ();
> + return result;
> +}
Can I suggest you use c_language_kind? It seems less
fragile than string comparisons.
> + {"@objective-c-header",
> + "%{E|M|MM:%(trad_capable_cpp)\
> + -lang-objc %(cpp_options) %(cpp_debug_options)}\
> + %{!E:%{!M:%{!MM:\
> + %{traditional|ftraditional|traditional-cpp:\
> +%eGNU Objective C no longer supports traditional compilation}\
> + %{save-temps:cc1obj -E %(cpp_options) %b.mi \n\
> + cc1obj -fpreprocessed %b.mi %(cc1_options) %{gen-decls}\
> + -o %g.s %{!o*:--output-pch=%i.pch}\
> + %W{o*:--output-pch=%*}%V}\
> + %{!save-temps:\
> + cc1obj %(cpp_unique_options) %(cc1_options) %{gen-decls}\
> + -o %g.s %{!o*:--output-pch=%i.pch}\
> + %W{o*:--output-pch=%*}%V}}}}", 0},
Shouldn't this handle -fno-integrated-cpp too? A SPEC hairball 8-)
Neil.
More information about the Gcc-patches
mailing list