OSDN Git Service

* dump.c (dequeue_and_dump): Abbreviate `class' as `cls', not
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Dec 1999 09:07:29 +0000 (09:07 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Dec 1999 09:07:29 +0000 (09:07 +0000)
`csl'.

* semantics.c (finish_switch_cond): Do conversions here, not ...
* typeck.c (c_expand_start_case): Here.

* semantics.c (do_poplevel): Remove unused variable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30840 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/dump.c
gcc/cp/semantics.c
gcc/cp/typeck.c

index 3de35c6..072823f 100644 (file)
@@ -1,3 +1,13 @@
+1999-12-09  Mark Mitchell  <mark@codesourcery.com>
+
+       * dump.c (dequeue_and_dump): Abbreviate `class' as `cls', not
+       `csl'.
+
+       * semantics.c (finish_switch_cond): Do conversions here, not ...
+       * typeck.c (c_expand_start_case): Here.
+
+       * semantics.c (do_poplevel): Remove unused variable.
+       
 1999-12-06  Mark Mitchell  <mark@codesourcery.com>
 
        * tree.c (walk_tree): Don't recurse into DECL_INITIAL or DECL_SIZE
index 6e3fbcc..c042f0a 100644 (file)
@@ -482,7 +482,7 @@ dequeue_and_dump (di)
        {
          dump_string (di, "ptrmem");
          dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
-         dump_child ("csl", TYPE_PTRMEM_CLASS_TYPE (t));
+         dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
        }
       else
        dump_child ("ptd", TREE_TYPE (t));
index 028279f..8637e3b 100644 (file)
@@ -592,7 +592,37 @@ finish_switch_cond (cond, switch_stmt)
      tree switch_stmt;
 {
   if (building_stmt_tree ())
-    FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
+    {
+      if (!processing_template_decl)
+       {
+         /* Convert the condition to an integer or enumeration type.  */
+         cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, 1);
+         if (cond == NULL_TREE)
+           {
+             error ("switch quantity not an integer");
+             cond = error_mark_node;
+           }
+         if (cond != error_mark_node)
+           {
+             tree idx;
+             tree type;
+             
+             cond = default_conversion (cond);
+             type = TREE_TYPE (cond);
+             idx = get_unwidened (cond, 0);
+             /* We can't strip a conversion from a signed type to an unsigned,
+                because if we did, int_fits_type_p would do the wrong thing
+                when checking case values for being in range,
+                and it's too hard to do the right thing.  */
+             if (TREE_UNSIGNED (TREE_TYPE (cond)) 
+                 == TREE_UNSIGNED (TREE_TYPE (idx)))
+               cond = idx;
+
+             cond = fold (build1 (CLEANUP_POINT_EXPR, type, cond));
+           }
+       }
+      FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
+    }
   else if (cond != error_mark_node)
     {
       emit_line_note (input_filename, lineno);
@@ -1337,7 +1367,6 @@ do_poplevel ()
   if (stmts_are_full_exprs_p)
     {
       tree scope_stmts;
-      int keep = kept_level_p ();
 
       if (building_stmt_tree () && !processing_template_decl)
        scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
index 83f7698..7325653 100644 (file)
@@ -6874,30 +6874,7 @@ tree
 c_expand_start_case (exp)
      tree exp;
 {
-  tree type, idx;
-
-  exp = build_expr_type_conversion (WANT_INT | WANT_ENUM, exp, 1);
-  if (exp == NULL_TREE)
-    {
-      error ("switch quantity not an integer");
-      exp = error_mark_node;
-    }
-  if (exp == error_mark_node)
-    return error_mark_node;
-
-  exp = default_conversion (exp);
-  type = TREE_TYPE (exp);
-  idx = get_unwidened (exp, 0);
-  /* We can't strip a conversion from a signed type to an unsigned,
-     because if we did, int_fits_type_p would do the wrong thing
-     when checking case values for being in range,
-     and it's too hard to do the right thing.  */
-  if (TREE_UNSIGNED (TREE_TYPE (exp)) == TREE_UNSIGNED (TREE_TYPE (idx)))
-    exp = idx;
-
-  expand_start_case
-    (1, fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp)),
-     type, "switch statement");
+  expand_start_case (1, exp, TREE_TYPE (exp), "switch statement");
 
   return exp;
 }