* 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
+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.
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,
/* 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)
{
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
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)
#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
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. */
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));
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;
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:
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
+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.
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)
}
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,
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;
#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)