From: Mark Mitchell Date: Thu, 9 Dec 1999 09:07:29 +0000 (+0000) Subject: dump.c (dequeue_and_dump): Abbreviate `class' as `cls', not `csl'. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=373eb3b3b1bc8ceb67c43ada7efd1afa3ee7813f;p=gcc.git dump.c (dequeue_and_dump): Abbreviate `class' as `cls', not `csl'. * 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. From-SVN: r30840 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3de35c600b9..072823f5783 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +1999-12-09 Mark Mitchell + + * 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 * tree.c (walk_tree): Don't recurse into DECL_INITIAL or DECL_SIZE diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index 6e3fbcceab7..c042f0a26df 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -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)); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 028279f8209..8637e3b670a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 83f7698e159..7325653c800 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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; }