This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, committed] PPC405 atomic support (PR target/21760)
David Edelsohn <dje@watson.ibm.com> writes:
> >>>>> Andreas Schwab writes:
>
> >> + /* If configured for PPC405, support PPC405CR Erratum77. */
> >> + #define PPC405_CPU_DEFAULT ("405")
> >> + #if #TARGET_CPU_DEFAULT == #PPC405_CPU_DEFAULT
>
> Andreas> What is this expression supposed to do? It doesn't match
> anything defined by C89.
>
> The expression is comparing the stringified value of the macros.
I'm pretty sure that doesn't work, and in fact should be an error;
even C99 says that "The expression that controls conditional inclusion
shall be an integer constant expression" (and I think the "shall" in
this location requires a diagnostic). I filed
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22168>
to track it.
I think you might be able to get away with
#define ppc405_is_default (strcmp(TARGET_CPU_DEFAULT, "405") == 0)
with no cost at runtime, since gcc will fold the strcmp.