This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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
foo
$ echo foo | ./cpp0 -P -Dfoo=bar -Ufoo -Dfoo=baz
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?

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]