c-common.def (GOTO_STMT, LABEL_STMT): Remove.
* 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
This commit is contained in:
parent
2f52c5316a
commit
9e14e18fd1
|
@ -1,3 +1,17 @@
|
|||
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
|
||||
|
|
|
@ -3900,13 +3900,13 @@ c_add_case_label (splay_tree cases, tree cond, tree low_value,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -71,13 +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 '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)
|
||||
|
||||
|
|
|
@ -961,9 +961,6 @@ extern void finish_file (void);
|
|||
#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
|
||||
|
@ -981,10 +978,6 @@ extern void finish_file (void);
|
|||
#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)
|
||||
|
@ -1016,8 +1009,7 @@ enum c_tree_code {
|
|||
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. */
|
||||
|
|
12
gcc/c-dump.c
12
gcc/c-dump.c
|
@ -129,12 +129,6 @@ c_dump_tree (void *dump_info, tree t)
|
|||
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));
|
||||
|
@ -143,12 +137,6 @@ c_dump_tree (void *dump_info, tree 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));
|
||||
|
|
|
@ -264,16 +264,6 @@ c_gimplify_stmt (tree *stmt_p)
|
|||
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 ();
|
||||
|
|
|
@ -2292,7 +2292,7 @@ stmt:
|
|||
if (decl != 0)
|
||||
{
|
||||
TREE_USED (decl) = 1;
|
||||
$$ = add_stmt (build_stmt (GOTO_STMT, decl));
|
||||
$$ = add_stmt (build_stmt (GOTO_EXPR, decl));
|
||||
}
|
||||
else
|
||||
$$ = NULL_TREE;
|
||||
|
@ -2302,7 +2302,7 @@ stmt:
|
|||
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
|
||||
|
@ -2379,7 +2379,7 @@ label: CASE expr_no_commas ':'
|
|||
if (label)
|
||||
{
|
||||
decl_attributes (&label, $4, 0);
|
||||
$$ = add_stmt (build_stmt (LABEL_STMT, label));
|
||||
$$ = add_stmt (build_stmt (LABEL_EXPR, label));
|
||||
}
|
||||
else
|
||||
$$ = NULL_TREE;
|
||||
|
|
|
@ -1913,28 +1913,22 @@ pp_c_statement (c_pretty_printer *pp, tree stmt)
|
|||
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);
|
||||
|
@ -2098,14 +2092,11 @@ pp_c_statement (c_pretty_printer *pp, tree stmt)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -188,6 +188,7 @@ build_stmt (enum tree_code code, ...)
|
|||
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);
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
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
|
||||
|
|
|
@ -10569,7 +10569,7 @@ finish_destructor_body (void)
|
|||
|
||||
/* 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))
|
||||
|
|
|
@ -5721,7 +5721,7 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr)
|
|||
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)
|
||||
|
@ -6241,8 +6241,7 @@ cp_parser_for_init_statement (cp_parser* parser)
|
|||
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)
|
||||
|
|
|
@ -7979,12 +7979,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
|
|||
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)
|
||||
|
|
|
@ -435,7 +435,7 @@ finish_goto_stmt (tree destination)
|
|||
|
||||
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.,
|
||||
|
@ -1086,7 +1086,7 @@ tree
|
|||
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
|
||||
|
|
|
@ -2216,8 +2216,8 @@ mark_local_for_remap_r (tree* tp,
|
|||
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);
|
||||
|
|
|
@ -467,8 +467,8 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
|
|||
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;
|
||||
|
@ -489,8 +489,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
|
|||
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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue