* c-common.def (GOTO_STMT, LABEL_STMT): Remove.
* c-common.c (c_add_case_label): Use LABEL_EXPR.
* c-common.h (GOTO_FAKE_P, LABEL_STMT_LABEL): Remove.
(c_common_stmt_codes): Remove GOTO_STMT, LABEL_STMT.
* c-dump.c (c_dump_tree): Likewise.
* c-gimplify.c (c_gimplify_stmt): Likewise.
* c-pretty-print.c (pp_c_statement): Likewise.
* c-parse.in (stmt): Use GOTO_EXPR.
(label): Use LABEL_EXPR.
* c-semantics.c (build_stmt): Set TREE_TYPE to void.
* tree-inline.c (copy_body_r): Don't build empty BLOCKs.
cp/
* decl.c (finish_destructor_body): Use LABEL_EXPR.
* parser.c (cp_parser_statement): Update commentary.
* pt.c (tsubst_expr): Use LABEL_EXPR, GOTO_EXPR.
* semantics.c (finish_goto_stmt, finish_label_stmt): Likewise.
* tree.c (mark_local_for_remap_r): Likewise.
From-SVN: r83255
+2004-06-16 Richard Henderson <rth@redhat.com>
+
+ * c-common.def (GOTO_STMT, LABEL_STMT): Remove.
+ * c-common.c (c_add_case_label): Use LABEL_EXPR.
+ * c-common.h (GOTO_FAKE_P, LABEL_STMT_LABEL): Remove.
+ (c_common_stmt_codes): Remove GOTO_STMT, LABEL_STMT.
+ * c-dump.c (c_dump_tree): Likewise.
+ * c-gimplify.c (c_gimplify_stmt): Likewise.
+ * c-pretty-print.c (pp_c_statement): Likewise.
+ * c-parse.in (stmt): Use GOTO_EXPR.
+ (label): Use LABEL_EXPR.
+ * c-semantics.c (build_stmt): Set TREE_TYPE to void.
+ * tree-inline.c (copy_body_r): Don't build empty BLOCKs.
+
2004-06-16 J"orn Rennecke <joern.rennecke@superh.com>
* cfgcleanup.c (try_simplify_condjump): Update test to make
return case_label;
error_out:
- /* Add a label so that the back-end doesn't think that the beginning o
+ /* Add a label so that the back-end doesn't think that the beginning of
the switch is unreachable. Note that we do not add a case label, as
that just leads to duplicates and thence to aborts later on. */
if (!cases->root)
{
tree t = create_artificial_label ();
- add_stmt (build_stmt (LABEL_STMT, t));
+ add_stmt (build_stmt (LABEL_EXPR, t));
}
return error_mark_node;
}
SWITCH_COND, SWITCH_BODY and SWITCH_TYPE, respectively. */
DEFTREECODE (SWITCH_STMT, "switch_stmt", 'e', 3)
-/* Used to represent a 'goto' statement. The operand is GOTO_DESTINATION. */
-DEFTREECODE (GOTO_STMT, "goto_stmt", 'e', 1)
-
-/* Used to represent a 'label' statement. The operand is a LABEL_DECL
- and can be obtained through the macro LABEL_STMT_LABEL. */
-DEFTREECODE (LABEL_STMT, "label_stmt", 'e', 1)
-
/* Used to represent an inline assembly statement. */
DEFTREECODE (ASM_STMT, "asm_stmt", 'e', 4)
#define SWITCH_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
#define CASE_LABEL_DECL(NODE) TREE_OPERAND (CASE_LABEL_CHECK (NODE), 2)
-/* True for goto created artificially by the compiler. */
-#define GOTO_FAKE_P(NODE) (TREE_LANG_FLAG_0 (GOTO_STMT_CHECK (NODE)))
-
/* COMPOUND_STMT accessor. This gives access to the TREE_LIST of
statements associated with a compound statement. The result is the
first statement in the list. Succeeding nodes can be accessed by
#define STMT_EXPR_NO_SCOPE(NODE) \
TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE))
-/* LABEL_STMT accessor. This gives access to the label associated with
- the given label statement. */
-#define LABEL_STMT_LABEL(NODE) TREE_OPERAND (LABEL_STMT_CHECK (NODE), 0)
-
/* COMPOUND_LITERAL_EXPR accessors. */
#define COMPOUND_LITERAL_EXPR_DECL_STMT(NODE) \
TREE_OPERAND (COMPOUND_LITERAL_EXPR_CHECK (NODE), 0)
DECL_STMT, IF_STMT, FOR_STMT, \
WHILE_STMT, DO_STMT, RETURN_STMT, \
BREAK_STMT, CONTINUE_STMT, \
- SWITCH_STMT, GOTO_STMT, LABEL_STMT, \
- ASM_STMT, CASE_LABEL
+ SWITCH_STMT, ASM_STMT, CASE_LABEL
/* 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 GOTO_STMT:
- dump_stmt (di, t);
- dump_child ("dest", GOTO_DESTINATION (t));
- dump_next_stmt (di, t);
- break;
-
case IF_STMT:
dump_stmt (di, t);
dump_child ("cond", IF_COND (t));
dump_next_stmt (di, t);
break;
- case LABEL_STMT:
- dump_stmt (di, t);
- dump_child ("labl", LABEL_STMT_LABEL (t));
- dump_next_stmt (di, t);
- break;
-
case RETURN_STMT:
dump_stmt (di, t);
dump_child ("expr", RETURN_STMT_EXPR (t));
ret = gimplify_decl_stmt (&stmt);
break;
- case LABEL_STMT:
- stmt = build1 (LABEL_EXPR, void_type_node, LABEL_STMT_LABEL (stmt));
- ret = GS_OK;
- break;
-
- case GOTO_STMT:
- stmt = build1 (GOTO_EXPR, void_type_node, GOTO_DESTINATION (stmt));
- ret = GS_OK;
- break;
-
case CASE_LABEL:
{
tree label = create_artificial_label ();
if (decl != 0)
{
TREE_USED (decl) = 1;
- $$ = add_stmt (build_stmt (GOTO_STMT, decl));
+ $$ = add_stmt (build_stmt (GOTO_EXPR, decl));
}
else
$$ = NULL_TREE;
pedwarn ("ISO C forbids `goto *expr;'");
stmt_count++;
$3 = convert (ptr_type_node, $3);
- $$ = add_stmt (build_stmt (GOTO_STMT, $3)); }
+ $$ = add_stmt (build_stmt (GOTO_EXPR, $3)); }
| ';'
{ $$ = NULL_TREE; }
@@ifobjc
if (label)
{
decl_attributes (&label, $4, 0);
- $$ = add_stmt (build_stmt (LABEL_STMT, label));
+ $$ = add_stmt (build_stmt (LABEL_EXPR, label));
}
else
$$ = NULL_TREE;
identifier : statement
case constant-expression : statement
default : statement */
- case LABEL_STMT:
case CASE_LABEL:
if (pp_needs_newline (pp))
pp_newline_and_indent (pp, -3);
else
pp_indentation (pp) -= 3;
- if (code == LABEL_STMT)
- pp_c_tree_decl_identifier (pp, LABEL_STMT_LABEL (stmt));
- else if (code == CASE_LABEL)
+ if (CASE_LOW (stmt) == NULL_TREE)
+ pp_identifier (pp, "default");
+ else
{
- 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_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_identifier (pp, "...");
+ pp_conditional_expression (pp, CASE_HIGH (stmt));
}
}
pp_colon (pp);
break;
case RETURN_STMT:
- case GOTO_STMT:
{
- tree e = code == RETURN_STMT
- ? RETURN_STMT_EXPR (stmt)
- : GOTO_DESTINATION (stmt);
+ tree e = RETURN_STMT_EXPR (stmt);
if (pp_needs_newline (pp))
pp_newline_and_indent (pp, 0);
- pp_c_identifier (pp, code == RETURN_STMT ? "return" : "goto");
+ pp_c_identifier (pp, "return");
pp_c_whitespace (pp);
if (e)
{
va_start (p, code);
ret = make_node (code);
+ TREE_TYPE (ret) = void_type_node;
length = TREE_CODE_LENGTH (code);
annotate_with_locus (ret, input_location);
+2004-06-16 Richard Henderson <rth@redhat.com>
+
+ * decl.c (finish_destructor_body): Use LABEL_EXPR.
+ * parser.c (cp_parser_statement): Update commentary.
+ * pt.c (tsubst_expr): Use LABEL_EXPR, GOTO_EXPR.
+ * semantics.c (finish_goto_stmt, finish_label_stmt): Likewise.
+ * tree.c (mark_local_for_remap_r): Likewise.
+
2004-06-16 Richard Henderson <rth@redhat.com>
PR c++/16012
/* Any return from a destructor will end up here; that way all base
and member cleanups will be run when the function returns. */
- add_stmt (build_stmt (LABEL_STMT, dtor_label));
+ add_stmt (build_stmt (LABEL_EXPR, dtor_label));
/* In a virtual destructor, we must call delete. */
if (DECL_VIRTUAL_P (current_function_decl))
case constant-expression ... constant-expression : statement
Returns the new CASE_LABEL, for a `case' or `default' label. For
- an ordinary label, returns a LABEL_STMT. */
+ an ordinary label, returns a LABEL_EXPR. */
static tree
cp_parser_labeled_statement (cp_parser* parser, tree in_statement_expr)
jump-statement:
goto * expression ;
- Returns the new BREAK_STMT, CONTINUE_STMT, RETURN_STMT, or
- GOTO_STMT. */
+ Returns the new BREAK_STMT, CONTINUE_STMT, RETURN_STMT, or GOTO_EXPR. */
static tree
cp_parser_jump_statement (cp_parser* parser)
in_decl));
break;
- case LABEL_STMT:
+ case LABEL_EXPR:
prep_stmt (t);
- finish_label_stmt (DECL_NAME (LABEL_STMT_LABEL (t)));
+ finish_label_stmt (DECL_NAME (LABEL_EXPR_LABEL (t)));
break;
- case GOTO_STMT:
+ case GOTO_EXPR:
prep_stmt (t);
tmp = GOTO_DESTINATION (t);
if (TREE_CODE (tmp) != LABEL_DECL)
check_goto (destination);
- return add_stmt (build_stmt (GOTO_STMT, destination));
+ return add_stmt (build_stmt (GOTO_EXPR, destination));
}
/* COND is the condition-expression for an if, while, etc.,
finish_label_stmt (tree name)
{
tree decl = define_label (input_location, name);
- return add_stmt (build_stmt (LABEL_STMT, decl));
+ return add_stmt (build_stmt (LABEL_EXPR, decl));
}
/* Finish a series of declarations for local labels. G++ allows users
if (TREE_CODE (t) == DECL_STMT
&& nonstatic_local_decl_p (DECL_STMT_DECL (t)))
decl = DECL_STMT_DECL (t);
- else if (TREE_CODE (t) == LABEL_STMT)
- decl = LABEL_STMT_LABEL (t);
+ else if (TREE_CODE (t) == LABEL_EXPR)
+ decl = LABEL_EXPR_LABEL (t);
else if (TREE_CODE (t) == TARGET_EXPR
&& nonstatic_local_decl_p (TREE_OPERAND (t, 0)))
decl = TREE_OPERAND (t, 0);
abort ();
#endif
- /* If this is a RETURN_STMT, change it into an EXPR_STMT and a
- GOTO_STMT with the RET_LABEL as its target. */
+ /* If this is a RETURN_EXPR, change it into a MODIFY_EXPR and a
+ GOTO_EXPR with the RET_LABEL as its target. */
if (TREE_CODE (*tp) == RETURN_EXPR && id->ret_label)
{
tree return_stmt = *tp;
if (TREE_CODE (assignment) == RESULT_DECL)
gimplify_stmt (&assignment);
- *tp = build (BIND_EXPR, void_type_node, NULL_TREE, NULL_TREE,
- make_node (BLOCK));
+ *tp = build (BIND_EXPR, void_type_node, NULL, NULL, NULL);
append_to_statement_list (assignment, &BIND_EXPR_BODY (*tp));
append_to_statement_list (goto_stmt, &BIND_EXPR_BODY (*tp));
}