diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-12-09 09:07:29 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-12-09 09:07:29 +0000 |
commit | 373eb3b3b1bc8ceb67c43ada7efd1afa3ee7813f (patch) | |
tree | d56bb27a0f31567f3a539e3e352af77e67e1fce3 | |
parent | 14ddd2a181950ca10a3bb0feecae553fe9a3ab37 (diff) | |
download | gcc-373eb3b3b1bc8ceb67c43ada7efd1afa3ee7813f.zip gcc-373eb3b3b1bc8ceb67c43ada7efd1afa3ee7813f.tar.gz gcc-373eb3b3b1bc8ceb67c43ada7efd1afa3ee7813f.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/dump.c | 2 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 33 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 25 |
4 files changed, 43 insertions, 27 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3de35c6..072823f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index 6e3fbcc..c042f0a 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 028279f..8637e3b 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 83f7698..7325653 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; } |