Commit 8c161995 by Richard Henderson Committed by Richard Henderson

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
parent e130a54b
2004-06-16 Richard Henderson <rth@redhat.com> 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. * c-common.def (ASM_STMT): Remove.
* c-common.h (c_common_stmt_codes): Remove ASM_STMT. * c-common.h (c_common_stmt_codes): Remove ASM_STMT.
* c-dump.c (c_dump_tree): Likewise. * c-dump.c (c_dump_tree): Likewise.
......
...@@ -3770,8 +3770,8 @@ case_compare (splay_tree_key k1, splay_tree_key k2) ...@@ -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 case label was declared using the usual C/C++ syntax, rather than
the GNU case range extension. CASES is a tree containing all the the GNU case range extension. CASES is a tree containing all the
case ranges processed so far; COND is the condition for the case ranges processed so far; COND is the condition for the
switch-statement itself. Returns the CASE_LABEL created, or switch-statement itself. Returns the CASE_LABEL_EXPR created, or
ERROR_MARK_NODE if no CASE_LABEL is created. */ ERROR_MARK_NODE if no CASE_LABEL_EXPR is created. */
tree tree
c_add_case_label (splay_tree cases, tree cond, tree low_value, 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, ...@@ -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 there was an overlap, issue an error. */
if (node) if (node)
{ {
tree duplicate = CASE_LABEL_DECL ((tree) node->value); tree duplicate = CASE_LABEL ((tree) node->value);
if (high_value) if (high_value)
{ {
...@@ -3935,10 +3935,10 @@ match_case_to_enum_1 (tree key, tree type, tree label) ...@@ -3935,10 +3935,10 @@ match_case_to_enum_1 (tree key, tree type, tree label)
if (TYPE_NAME (type) == 0) if (TYPE_NAME (type) == 0)
warning ("%Jcase value `%s' not in enumerated type", warning ("%Jcase value `%s' not in enumerated type",
CASE_LABEL_DECL (label), buf); CASE_LABEL (label), buf);
else else
warning ("%Jcase value `%s' not in enumerated type `%T'", warning ("%Jcase value `%s' not in enumerated type `%T'",
CASE_LABEL_DECL (label), buf, type); CASE_LABEL (label), buf, type);
} }
static int static int
......
...@@ -71,12 +71,6 @@ DEFTREECODE (CONTINUE_STMT, "continue_stmt", 'e', 0) ...@@ -71,12 +71,6 @@ DEFTREECODE (CONTINUE_STMT, "continue_stmt", 'e', 0)
SWITCH_COND, SWITCH_BODY and SWITCH_TYPE, respectively. */ SWITCH_COND, SWITCH_BODY and SWITCH_TYPE, respectively. */
DEFTREECODE (SWITCH_STMT, "switch_stmt", 'e', 3) 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 /* A STMT_EXPR represents a statement-expression. The
STMT_EXPR_STMT is the statement given by the expression. */ STMT_EXPR_STMT is the statement given by the expression. */
DEFTREECODE (STMT_EXPR, "stmt_expr", 'e', 1) DEFTREECODE (STMT_EXPR, "stmt_expr", 'e', 1)
......
...@@ -958,7 +958,6 @@ extern void finish_file (void); ...@@ -958,7 +958,6 @@ extern void finish_file (void);
#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3) #define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
#define SWITCH_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2) #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 /* COMPOUND_STMT accessor. This gives access to the TREE_LIST of
statements associated with a compound statement. The result is the statements associated with a compound statement. The result is the
...@@ -1007,8 +1006,7 @@ enum c_tree_code { ...@@ -1007,8 +1006,7 @@ enum c_tree_code {
CLEANUP_STMT, EXPR_STMT, COMPOUND_STMT, \ CLEANUP_STMT, EXPR_STMT, COMPOUND_STMT, \
DECL_STMT, IF_STMT, FOR_STMT, \ DECL_STMT, IF_STMT, FOR_STMT, \
WHILE_STMT, DO_STMT, RETURN_STMT, \ WHILE_STMT, DO_STMT, RETURN_STMT, \
BREAK_STMT, CONTINUE_STMT, \ BREAK_STMT, CONTINUE_STMT, SWITCH_STMT
SWITCH_STMT, CASE_LABEL
/* TRUE if a code represents a statement. The front end init /* TRUE if a code represents a statement. The front end init
langhook should take care of initialization of this array. */ langhook should take care of initialization of this array. */
......
...@@ -69,14 +69,6 @@ c_dump_tree (void *dump_info, tree t) ...@@ -69,14 +69,6 @@ c_dump_tree (void *dump_info, tree t)
dump_next_stmt (di, t); dump_next_stmt (di, t);
break; 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: case CLEANUP_STMT:
dump_stmt (di, t); dump_stmt (di, t);
dump_child ("decl", CLEANUP_DECL (t)); dump_child ("decl", CLEANUP_DECL (t));
......
...@@ -264,15 +264,6 @@ c_gimplify_stmt (tree *stmt_p) ...@@ -264,15 +264,6 @@ c_gimplify_stmt (tree *stmt_p)
ret = gimplify_decl_stmt (&stmt); ret = gimplify_decl_stmt (&stmt);
break; 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: case CONTINUE_STMT:
stmt = build_bc_goto (bc_continue); stmt = build_bc_goto (bc_continue);
ret = GS_OK; ret = GS_OK;
......
...@@ -1909,33 +1909,6 @@ pp_c_statement (c_pretty_printer *pp, tree stmt) ...@@ -1909,33 +1909,6 @@ pp_c_statement (c_pretty_printer *pp, tree stmt)
} }
break; 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: /* compound-statement:
{ block-item-list(opt) } { block-item-list(opt) }
......
...@@ -297,12 +297,12 @@ build_continue_stmt (void) ...@@ -297,12 +297,12 @@ build_continue_stmt (void)
return (build_stmt (CONTINUE_STMT)); 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 tree
build_case_label (tree low_value, tree high_value, tree label_decl) 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 /* We're about to expand T, a statement. Set up appropriate context
......
2004-06-16 Richard Henderson <rth@redhat.com> 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. * parser.c (cp_parser_asm_definition): Update commentary.
* pt.c (tsubst_expr): Use ASM_EXPR. * pt.c (tsubst_expr): Use ASM_EXPR.
* semantics.c (finish_asm_stmt): Likewise. * semantics.c (finish_asm_stmt): Likewise.
......
...@@ -5720,8 +5720,8 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr) ...@@ -5720,8 +5720,8 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr)
labeled-statement: labeled-statement:
case constant-expression ... constant-expression : statement case constant-expression ... constant-expression : statement
Returns the new CASE_LABEL, for a `case' or `default' label. For Returns the new CASE_LABEL_EXPR, for a `case' or `default' label.
an ordinary label, returns a LABEL_EXPR. */ For an ordinary label, returns a LABEL_EXPR. */
static tree static tree
cp_parser_labeled_statement (cp_parser* parser, tree in_statement_expr) cp_parser_labeled_statement (cp_parser* parser, tree in_statement_expr)
......
...@@ -7972,7 +7972,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -7972,7 +7972,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
} }
break; break;
case CASE_LABEL: case CASE_LABEL_EXPR:
prep_stmt (t); prep_stmt (t);
finish_case_label (tsubst_expr (CASE_LOW (t), args, complain, in_decl), finish_case_label (tsubst_expr (CASE_LOW (t), args, complain, in_decl),
tsubst_expr (CASE_HIGH (t), args, complain, tsubst_expr (CASE_HIGH (t), args, complain,
......
...@@ -2221,8 +2221,8 @@ mark_local_for_remap_r (tree* tp, ...@@ -2221,8 +2221,8 @@ mark_local_for_remap_r (tree* tp,
else if (TREE_CODE (t) == TARGET_EXPR else if (TREE_CODE (t) == TARGET_EXPR
&& nonstatic_local_decl_p (TREE_OPERAND (t, 0))) && nonstatic_local_decl_p (TREE_OPERAND (t, 0)))
decl = TREE_OPERAND (t, 0); decl = TREE_OPERAND (t, 0);
else if (TREE_CODE (t) == CASE_LABEL) else if (TREE_CODE (t) == CASE_LABEL_EXPR)
decl = CASE_LABEL_DECL (t); decl = CASE_LABEL (t);
else else
decl = NULL_TREE; decl = NULL_TREE;
......
...@@ -1066,7 +1066,7 @@ struct tree_vec GTY(()) ...@@ -1066,7 +1066,7 @@ struct tree_vec GTY(())
#define SWITCH_BODY(NODE) TREE_OPERAND ((NODE), 1) #define SWITCH_BODY(NODE) TREE_OPERAND ((NODE), 1)
#define SWITCH_LABELS(NODE) TREE_OPERAND ((NODE), 2) #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. */ of a case label, respectively. */
#define CASE_LOW(NODE) TREE_OPERAND ((NODE), 0) #define CASE_LOW(NODE) TREE_OPERAND ((NODE), 0)
#define CASE_HIGH(NODE) TREE_OPERAND ((NODE), 1) #define CASE_HIGH(NODE) TREE_OPERAND ((NODE), 1)
......
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