This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: cpp -traditional, *Initialization*:1: warning: "__mips" redefined
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: cpp -traditional, *Initialization*:1: warning: "__mips" redefined
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Sun, 27 Aug 2000 13:36:48 -0700
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <200008271235.IAA27613@caip.rutgers.edu>
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