Commit 373eb3b3 by Mark Mitchell Committed by Mark Mitchell

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
parent 14ddd2a1
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
......
......@@ -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));
......
......@@ -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);
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment