This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Support for objective-C PCH
Neil Booth <neil at daikokuya dot co dot uk> writes:
> 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.
I would have, but c_language_kind gives me only two choices: C or C++.
I need to key off which executable is actually in use.
> > + {"@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-)
I'm not completely sure I can cope with an extra '}' in that expression.
Let's try and see if my eyes start hurting... %-)
--
- Geoffrey Keating <geoffk at geoffk dot org>