c-common.def (CASE_LABEL): Remove.

* c-common.def (CASE_LABEL): Remove.
        * c-common.c (c_add_case_label): Use CASE_LABEL, not CASE_LABEL_DECL.
        (match_case_to_enum_1): Likewise.
        * c-common.h (c_common_stmt_codes): Remove CASE_LABEL.
        * c-dump.c (c_dump_tree): Likewise.
        * c-gimplify.c (c_gimplify_stmt): Likewise.
        * c-pretty-print.c (pp_c_statement): Likewise.
        * c-semantics.c (build_case_label): Use CASE_LABEL_EXPR.
        * tree.h (CASE_LOW): Update commentary.
cp/
        * parser.c (cp_parser_labeled_statement): Update commentary.
        * pt.c (tsubst_expr): Use CASE_LABEL_EXPR.
        * tree.c (mark_local_for_remap_r): Likewise.

From-SVN: r83261
This commit is contained in:
Richard Henderson 2004-06-16 13:51:46 -07:00 committed by Richard Henderson
parent e130a54b78
commit 8c16199578
13 changed files with 32 additions and 66 deletions

View File

@ -1,3 +1,15 @@
2004-06-16 Richard Henderson <rth@redhat.com>
* c-common.def (CASE_LABEL): Remove.
* c-common.c (c_add_case_label): Use CASE_LABEL, not CASE_LABEL_DECL.
(match_case_to_enum_1): Likewise.
* c-common.h (c_common_stmt_codes): Remove CASE_LABEL.
* c-dump.c (c_dump_tree): Likewise.
* c-gimplify.c (c_gimplify_stmt): Likewise.
* c-pretty-print.c (pp_c_statement): Likewise.
* c-semantics.c (build_case_label): Use CASE_LABEL_EXPR.
* tree.h (CASE_LOW): Update commentary.
2004-06-16 Richard Henderson <rth@redhat.com>
* c-common.def (ASM_STMT): Remove.

View File

@ -3770,8 +3770,8 @@ case_compare (splay_tree_key k1, splay_tree_key k2)
case label was declared using the usual C/C++ syntax, rather than
the GNU case range extension. CASES is a tree containing all the
case ranges processed so far; COND is the condition for the
switch-statement itself. Returns the CASE_LABEL created, or
ERROR_MARK_NODE if no CASE_LABEL is created. */
switch-statement itself. Returns the CASE_LABEL_EXPR created, or
ERROR_MARK_NODE if no CASE_LABEL_EXPR is created. */
tree
c_add_case_label (splay_tree cases, tree cond, tree low_value,
@ -3870,7 +3870,7 @@ c_add_case_label (splay_tree cases, tree cond, tree low_value,
/* If there was an overlap, issue an error. */
if (node)
{
tree duplicate = CASE_LABEL_DECL ((tree) node->value);
tree duplicate = CASE_LABEL ((tree) node->value);
if (high_value)
{
@ -3935,10 +3935,10 @@ match_case_to_enum_1 (tree key, tree type, tree label)
if (TYPE_NAME (type) == 0)
warning ("%Jcase value `%s' not in enumerated type",
CASE_LABEL_DECL (label), buf);
CASE_LABEL (label), buf);
else
warning ("%Jcase value `%s' not in enumerated type `%T'",
CASE_LABEL_DECL (label), buf, type);
CASE_LABEL (label), buf, type);
}
static int

View File

@ -71,12 +71,6 @@ DEFTREECODE (CONTINUE_STMT, "continue_stmt", 'e', 0)
SWITCH_COND, SWITCH_BODY and SWITCH_TYPE, respectively. */
DEFTREECODE (SWITCH_STMT, "switch_stmt", 'e', 3)
/* Used to represent a CASE_LABEL. The operands are CASE_LOW and
CASE_HIGH, respectively. If CASE_LOW is NULL_TREE, the label is a
'default' label. If CASE_HIGH is NULL_TREE, the label is a normal case
label. The CASE_LABEL_DECL is a LABEL_DECL for this node. */
DEFTREECODE (CASE_LABEL, "case_label", 'e', 3)
/* A STMT_EXPR represents a statement-expression. The
STMT_EXPR_STMT is the statement given by the expression. */
DEFTREECODE (STMT_EXPR, "stmt_expr", 'e', 1)

View File

@ -958,7 +958,6 @@ extern void finish_file (void);
#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
#define SWITCH_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
#define CASE_LABEL_DECL(NODE) TREE_OPERAND (CASE_LABEL_CHECK (NODE), 2)
/* COMPOUND_STMT accessor. This gives access to the TREE_LIST of
statements associated with a compound statement. The result is the
@ -1007,8 +1006,7 @@ enum c_tree_code {
CLEANUP_STMT, EXPR_STMT, COMPOUND_STMT, \
DECL_STMT, IF_STMT, FOR_STMT, \
WHILE_STMT, DO_STMT, RETURN_STMT, \
BREAK_STMT, CONTINUE_STMT, \
SWITCH_STMT, CASE_LABEL
BREAK_STMT, CONTINUE_STMT, SWITCH_STMT
/* TRUE if a code represents a statement. The front end init
langhook should take care of initialization of this array. */

View File

@ -69,14 +69,6 @@ c_dump_tree (void *dump_info, tree t)
dump_next_stmt (di, t);
break;
case CASE_LABEL:
/* Note that a case label is not like other statements; there is
no way to get the line-number of a case label. */
dump_child ("low", CASE_LOW (t));
dump_child ("high", CASE_HIGH (t));
dump_next_stmt (di, t);
break;
case CLEANUP_STMT:
dump_stmt (di, t);
dump_child ("decl", CLEANUP_DECL (t));

View File

@ -264,15 +264,6 @@ c_gimplify_stmt (tree *stmt_p)
ret = gimplify_decl_stmt (&stmt);
break;
case CASE_LABEL:
{
tree label = create_artificial_label ();
stmt = build (CASE_LABEL_EXPR, void_type_node,
CASE_LOW (stmt), CASE_HIGH (stmt), label);
ret = GS_OK;
}
break;
case CONTINUE_STMT:
stmt = build_bc_goto (bc_continue);
ret = GS_OK;

View File

@ -1907,33 +1907,6 @@ pp_c_statement (c_pretty_printer *pp, tree stmt)
pp_c_right_brace (pp);
pp_needs_newline (pp) = true;
}
break;
/* labeled-statement:
identifier : statement
case constant-expression : statement
default : statement */
case CASE_LABEL:
if (pp_needs_newline (pp))
pp_newline_and_indent (pp, -3);
else
pp_indentation (pp) -= 3;
if (CASE_LOW (stmt) == NULL_TREE)
pp_identifier (pp, "default");
else
{
pp_c_identifier (pp, "case");
pp_c_whitespace (pp);
pp_conditional_expression (pp, CASE_LOW (stmt));
if (CASE_HIGH (stmt))
{
pp_identifier (pp, "...");
pp_conditional_expression (pp, CASE_HIGH (stmt));
}
}
pp_colon (pp);
pp_indentation (pp) += 3;
pp_needs_newline (pp) = true;
break;
/* compound-statement:

View File

@ -297,12 +297,12 @@ build_continue_stmt (void)
return (build_stmt (CONTINUE_STMT));
}
/* Create a CASE_LABEL tree node and return it. */
/* Create a CASE_LABEL_EXPR tree node and return it. */
tree
build_case_label (tree low_value, tree high_value, tree label_decl)
{
return build_stmt (CASE_LABEL, low_value, high_value, label_decl);
return build_stmt (CASE_LABEL_EXPR, low_value, high_value, label_decl);
}
/* We're about to expand T, a statement. Set up appropriate context

View File

@ -1,3 +1,9 @@
2004-06-16 Richard Henderson <rth@redhat.com>
* parser.c (cp_parser_labeled_statement): Update commentary.
* pt.c (tsubst_expr): Use CASE_LABEL_EXPR.
* tree.c (mark_local_for_remap_r): Likewise.
2004-06-16 Richard Henderson <rth@redhat.com>
* parser.c (cp_parser_asm_definition): Update commentary.

View File

@ -5720,8 +5720,8 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr)
labeled-statement:
case constant-expression ... constant-expression : statement
Returns the new CASE_LABEL, for a `case' or `default' label. For
an ordinary label, returns a LABEL_EXPR. */
Returns the new CASE_LABEL_EXPR, for a `case' or `default' label.
For an ordinary label, returns a LABEL_EXPR. */
static tree
cp_parser_labeled_statement (cp_parser* parser, tree in_statement_expr)

View File

@ -7972,7 +7972,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
}
break;
case CASE_LABEL:
case CASE_LABEL_EXPR:
prep_stmt (t);
finish_case_label (tsubst_expr (CASE_LOW (t), args, complain, in_decl),
tsubst_expr (CASE_HIGH (t), args, complain,

View File

@ -2221,8 +2221,8 @@ mark_local_for_remap_r (tree* tp,
else if (TREE_CODE (t) == TARGET_EXPR
&& nonstatic_local_decl_p (TREE_OPERAND (t, 0)))
decl = TREE_OPERAND (t, 0);
else if (TREE_CODE (t) == CASE_LABEL)
decl = CASE_LABEL_DECL (t);
else if (TREE_CODE (t) == CASE_LABEL_EXPR)
decl = CASE_LABEL (t);
else
decl = NULL_TREE;

View File

@ -1066,7 +1066,7 @@ struct tree_vec GTY(())
#define SWITCH_BODY(NODE) TREE_OPERAND ((NODE), 1)
#define SWITCH_LABELS(NODE) TREE_OPERAND ((NODE), 2)
/* CASE_LABEL accessors. These give access to the high and low values
/* CASE_LABEL_EXPR accessors. These give access to the high and low values
of a case label, respectively. */
#define CASE_LOW(NODE) TREE_OPERAND ((NODE), 0)
#define CASE_HIGH(NODE) TREE_OPERAND ((NODE), 1)