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 Sat, Aug 26, 2000 at 09:39:00AM -0400, Kaveh R. Ghazi wrote:
> Zack,
> 
> 	All of the -traditional tests are failing on mips-sgi-irix6.2.
> See: http://gcc.gnu.org/ml/gcc-testresults/2000-08/msg00214.html
> that's recent, but I believe this problem has been around for a while,
> perhaps as long as the separate traditional preprocessor was added.
...
>  > % gcc -U__unix -D__unix=3 -traditional -c f.c
>  > *Initialization*:1: warning: "__unix" redefined

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.

zw

	* tradcpp.c (main): Process -D and -U at the same time.

===================================================================
Index: tradcpp.c
--- tradcpp.c	2000/08/04 12:45:57	1.10
+++ tradcpp.c	2000/08/26 16:37:17
@@ -711,14 +711,11 @@ main (argc, argv)
      and option processing.  */
   initialize_builtins ();
 
-  /* Do defines specified with -D.  */
+  /* Do defines specified with -D and undefines specified with -U.  */
   for (i = 1; i < argc; i++)
     if (pend_defs[i])
       make_definition ((U_CHAR *)pend_defs[i]);
-
-  /* Do undefines specified with -U.  */
-  for (i = 1; i < argc; i++)
-    if (pend_undefs[i])
+    else if (pend_undefs[i])
       make_undef ((U_CHAR *)pend_undefs[i]);
 
   /* Unless -fnostdinc,

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