From: Richard Henderson Date: Wed, 16 Jun 2004 20:51:46 +0000 (-0700) Subject: c-common.def (CASE_LABEL): Remove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c16199578ee7b0bcc94a807373569055678d042;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ba6fa70782..02bd3ba8ff6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2004-06-16 Richard Henderson + + * 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 * c-common.def (ASM_STMT): Remove. diff --git a/gcc/c-common.c b/gcc/c-common.c index 3de00cff869..6ef83f04640 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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 diff --git a/gcc/c-common.def b/gcc/c-common.def index a78cfc16d3d..0c9b9f0a0b8 100644 --- a/gcc/c-common.def +++ b/gcc/c-common.def @@ -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) diff --git a/gcc/c-common.h b/gcc/c-common.h index 6dbb5167f54..740825c21f7 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -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. */ diff --git a/gcc/c-dump.c b/gcc/c-dump.c index db03dfb566b..9e8280774c2 100644 --- a/gcc/c-dump.c +++ b/gcc/c-dump.c @@ -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)); diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c index 3b84cd981de..2e9b4b92b64 100644 --- a/gcc/c-gimplify.c +++ b/gcc/c-gimplify.c @@ -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; diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index e5eb8e3dbb0..a2ef2048874 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -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: diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index 8a67c67a33d..681887f0d02 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -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 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 90636b0cc5c..73aec988d99 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-06-16 Richard Henderson + + * 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 * parser.c (cp_parser_asm_definition): Update commentary. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 863c9a29582..ced8e6aac80 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a1e0a37d8c7..57fb87156d8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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, diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 86c585b2e44..c06810e0a3e 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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; diff --git a/gcc/tree.h b/gcc/tree.h index aa1511fc4de..b43899717f0 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -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)