cpp -traditional, *Initialization*:1: warning: "__mips" redefined

Zack Weinberg zack@wolery.cumb.org
Sun Aug 27 13:36:00 GMT 2000

On Sun, Aug 27, 2000 at 08:35:03AM -0400, Kaveh R. Ghazi wrote:
>  > Looks like the traditional preprocessor does all the -D switches and
>  > then goes back and does all the -U switches.  We want them
>  > interleaved.
>  > 
>  > Please try this patch.
> Yes that works.  Thanks.

While trying to write a test case, I discovered that the problem is
deeper than it seems.

$ echo foo | ./xgcc -B./ -E -P -Dfoo=bar -Ufoo -Dfoo=baz -
<command line>: warning: "foo" redefined
$ echo foo | ./cpp0 -P -Dfoo=bar -Ufoo -Dfoo=baz

This is because the specs for invoking cpp have %{D*} %{U*} which of
course shuffles all the -U options after all the -D options.  Worse,
there appears to be no way to write "all options beginning with X and
all options beginning with Y, as they appeared on the command line" in
a spec.

Implementing the proper behavior is of course a simple matter of
programming, but gcc.c is pretty opaque to me, and I don't have any
good ideas for the notation to use.  Suggestions?


More information about the Gcc-patches mailing list