From: Richard Kenner Date: Sun, 13 Mar 1994 11:45:59 +0000 (-0500) Subject: (do_spec_1): Don't duplicate a macro starting with '__'. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54a88f9251258e2ce0908499022cbc38152d1b27;p=gcc.git (do_spec_1): Don't duplicate a macro starting with '__'. From-SVN: r6764 --- diff --git a/gcc/gcc.c b/gcc/gcc.c index a41e960920b..6517c7f8767 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3254,23 +3254,30 @@ do_spec_1 (spec, inswitch, soft_matched_part) { if (! strncmp (y, "-D", 2)) { - *x++ = *y++; - *x++ = *y++; + y += 2; if (strncmp (y, "__", 2)) { - /* Stick __ at front of macro name. */ + /* Stick -D__ at front of macro name. */ + *x++ = '-'; + *x++ = 'D'; *x++ = '_'; *x++ = '_'; - } - /* Copy the macro name. */ - while (*y && *y != '=' && *y != ' ' && *y != '\t') - *x++ = *y++; + /* Copy the macro name. */ + while (*y && *y != '=' && *y != ' ' && *y != '\t') + *x++ = *y++; - /* Copy the value given, if any. */ - while (*y && *y != ' ' && *y != '\t') - *x++ = *y++; + /* Copy the value given, if any. */ + while (*y && *y != ' ' && *y != '\t') + *x++ = *y++; + } + else + { + /* Do not copy this macro - we have just done it before */ + while (*y && *y != ' ' && *y != '\t') + y++; + } } else if (*y == ' ' || *y == '\t') /* Copy whitespace to the result. */