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: [980307]: Warning patches #2/5 - enumeration value not handled... (problem on ARM)


 > From: Manfred Hollstein <manfred@s-direktnet.de>
 > 
 > This small patch kills 616 `enumeration value `???' not handled in switch'
 > warnings.
 > 
 > gcc/ChangeLog:
 > 
 > Sun Mar  8 17:06:02 1998  Manfred Hollstein  <manfred@s-direktnet.de>
 > 
 > 	* cse.c (rtx_cost): Add default case in enumeration switch.
 > 
 > 
 > diff -rcp -x CVS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-980307.orig/gcc/cse.c egcs-980307/gcc/cse.c
 > *** egcs-980307.orig/gcc/cse.c	Sun Mar  1 16:09:59 1998
 > --- egcs-980307/gcc/cse.c	Sun Mar  8 11:40:30 1998
 > *************** rtx_cost (x, outer_code)
 > *** 751,756 ****
 > --- 751,759 ----
 >         RTX_COSTS (x, code, outer_code);
 >   #endif 
 >         CONST_COSTS (x, code, outer_code);
 > + 
 > +     default:
 > +       break;
 >       }
 >   
 >     /* Sum the costs of the sub-rtx's, plus cost of this operation,
 > 


	Great work!  There is one issue with the cse.c patch which
merits discussion.

	I submitted a similar change back in December.  It caused a
problem with the arm port because gcc/config/arm/arm.h defines a
default case in RTX_COSTS yielding two default cases.

 > #define RTX_COSTS(X,CODE,OUTER_CODE)            \
 >   default:                                      \
 >    return arm_rtx_costs (X, CODE, OUTER_CODE);

	(See http://www.cygnus.com/ml/egcs-bugs/1997-Dec/0443.html and
http://www.cygnus.com/ml/egcs-bugs/1997-Dec/0446.html.)

	Jeff decided to punt until later.  Now seems like later. :-)
The following patch should work but I'd like someone with the relevant
system type to test it out.  I've tested it on solaris2 (ie, !arm) to
make sure it gets rid of the warnings there in cse.c.  Someone with an
arm should check the other side of things.

	I couldn't find any other platforms which define a default
case, but if I missed any its easily fixed.

		--Kaveh



Mon Mar  9 10:32:24 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* cse.c (rtx_cost): Provide a default case in an enumeration
	switch, but only when !TARGET_PROVIDES_DEFAULT_RTX_COSTS.

	* arm.h (TARGET_PROVIDES_DEFAULT_RTX_COSTS): Define.



diff -rup orig/egcs-980308/gcc/config/arm/arm.h egcs-980308/gcc/config/arm/arm.h
--- orig/egcs-980308/gcc/config/arm/arm.h	Fri Dec 19 11:42:21 1997
+++ egcs-980308/gcc/config/arm/arm.h	Mon Mar  9 10:24:06 1998
@@ -1624,6 +1624,8 @@ extern struct rtx_def *legitimize_pic_ad
   default:					\
    return arm_rtx_costs (X, CODE, OUTER_CODE);
 
+#define TARGET_PROVIDES_DEFAULT_RTX_COSTS 1
+
 /* Moves to and from memory are quite expensive */
 #define MEMORY_MOVE_COST(MODE)  10
 
diff -rup orig/egcs-980308/gcc/cse.c egcs-980308/gcc/cse.c
--- orig/egcs-980308/gcc/cse.c	Sat Feb 28 02:06:27 1998
+++ egcs-980308/gcc/cse.c	Mon Mar  9 10:24:00 1998
@@ -751,6 +751,13 @@ rtx_cost (x, outer_code)
       RTX_COSTS (x, code, outer_code);
 #endif 
       CONST_COSTS (x, code, outer_code);
+
+#ifndef TARGET_PROVIDES_DEFAULT_RTX_COSTS
+/* This macro gets defined if the target platform provides a `default'
+   case, in that case we don't want to provide one here ourselves. */
+    default:
+      break;
+#endif
     }
 
   /* Sum the costs of the sub-rtx's, plus cost of this operation,
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.


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