This is the mail archive of the gcc@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: CHILL warning question ...


 > From: Dave Brolley <brolley@cygnus.com>
 > 
 > Kaveh R. Ghazi wrote:
 > 
 > >          The file ch/expr.c has ~160 "enumeration value not handled in
 > > switch" warnings which all stem from two switches.  (If you do a recent
 > > egcs bootstrap you'll see them, the switches *end* on lines 3542
 > 
 > This one should have "default: abort();" added since there are no
 > additional cases to handle and falling through will result in
 > returning an uninitialized "result"
 > 
 > > and
 > > 3620.
 > 
 > Same for this one.
 > 
 > >          I wasn't sure which one applied here.  Also, the second switch
 > > gets additional warnings of the type: "case value `??' not in enumerated
 > > type `chill_tree_code', which I found odd.  Would you please advise on
 > > how to proceed?
 > 
 > This is because all of the case values are from enum tree_code. I
 > grepped thru the code and it looks like the following functions should
 > all take "enum tree_code" instead of "enum chill_tree_code":
 > 
 > build_compare_expr, build_compare_discrete_expr, build_compare_set_expr,
 > build_compare_string_expr
 > 
 > Dave

	Okay based on the above, I checked in the following patch.

		--Kaveh


Tue Sep 29 21:34:11 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* ch-tree.h (build_compare_expr): Change first argument's type
	from `enum chill_tree_code' to `enum tree_code'.
	(build_compare_discrete_expr): Likewise.

	* expr.c (build_compare_set_expr): Likewise.
	(build_compare_string_expr): Likewise.
	(build_compare_expr): Likewise.
	(build_compare_discrete_expr): Likewise.  Also add default case in
	switch statement.
	(compare_int_csts): Add default case in switch statement.


diff -rup orig/egcs-CVS19980928/gcc/ch/ch-tree.h egcs-CVS19980928/gcc/ch/ch-tree.h
--- orig/egcs-CVS19980928/gcc/ch/ch-tree.h	Mon Sep 28 20:23:02 1998
+++ egcs-CVS19980928/gcc/ch/ch-tree.h	Tue Sep 29 21:23:20 1998
@@ -895,9 +895,9 @@ extern tree build_chill_compound_expr   
 extern tree build_chill_descr                   PROTO((tree));
 extern void build_chill_descr_type              PROTO((void));
 extern void build_chill_inttime_type            PROTO((void));
-extern tree build_compare_expr			PROTO((enum chill_tree_code,
+extern tree build_compare_expr			PROTO((enum tree_code,
 						       tree, tree));
-extern tree build_compare_discrete_expr		PROTO((enum chill_tree_code,
+extern tree build_compare_discrete_expr		PROTO((enum tree_code,
 						       tree, tree));
 extern tree check_case_selector                 PROTO((tree));
 extern tree check_case_selector_list            PROTO((tree));
diff -rup orig/egcs-CVS19980928/gcc/ch/expr.c egcs-CVS19980928/gcc/ch/expr.c
--- orig/egcs-CVS19980928/gcc/ch/expr.c	Mon Sep 28 20:23:04 1998
+++ egcs-CVS19980928/gcc/ch/expr.c	Tue Sep 29 21:26:24 1998
@@ -3125,7 +3125,7 @@ fold_set_expr (code, op0, op1)
  */
 static tree
 build_compare_set_expr (code, op0, op1)
-     enum chill_tree_code code;
+     enum tree_code code;
      tree op0, op1;
 {
   tree result_type = NULL_TREE;
@@ -3380,7 +3380,7 @@ build_concat_expr (op0, op1)
  */
 static tree
 build_compare_string_expr (code, op0, op1)
-     enum chill_tree_code code;
+     enum tree_code code;
      tree op0, op1;
 {
   if (op0 == NULL_TREE || TREE_CODE (op0) == ERROR_MARK)
@@ -3539,6 +3539,8 @@ compare_int_csts (op, val1, val2)
       if (op == NE_EXPR)
 	result = !result;
       break;
+    default:
+      abort();
     }
   return result;
 }
@@ -3549,7 +3551,7 @@ compare_int_csts (op, val1, val2)
 
 tree
 build_compare_discrete_expr (op, val1, val2)
-     enum chill_tree_code op;
+     enum tree_code op;
      tree val1, val2;
 {
   tree type1 = TREE_TYPE (val1);
@@ -3617,6 +3619,8 @@ build_compare_discrete_expr (op, val1, v
 	case NE_EXPR:
 	  tmp = build_compare_expr (EQ_EXPR, val1, val2);
 	  return build_chill_unary_op (TRUTH_NOT_EXPR, tmp);
+	default:
+	  abort();
 	}
     }
   if (TYPE_PRECISION (type1) > TYPE_PRECISION (type2))
@@ -3628,7 +3632,7 @@ build_compare_discrete_expr (op, val1, v
 
 tree
 build_compare_expr (op, val1, val2)
-     enum chill_tree_code op;
+     enum tree_code op;
      tree val1, val2;
 {
   tree tmp;


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