summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-16 18:21:20 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-16 18:21:20 +0000
commitdaf6dff5ac4c34fd82b7f72f6f40de906e8cdb24 (patch)
treee52131b3bd23ac10dfbc97741cf058791e88679f
parentf3fbd62def4f74f293a6e3a76a04e25cab10de4c (diff)
downloadgcc-daf6dff5ac4c34fd82b7f72f6f40de906e8cdb24.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83255 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/c-common.c4
-rw-r--r--gcc/c-common.def7
-rw-r--r--gcc/c-common.h10
-rw-r--r--gcc/c-dump.c12
-rw-r--r--gcc/c-gimplify.c10
-rw-r--r--gcc/c-parse.in6
-rw-r--r--gcc/c-pretty-print.c31
-rw-r--r--gcc/c-semantics.c1
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/parser.c5
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/cp/semantics.c4
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/tree-inline.c7
16 files changed, 53 insertions, 78 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ace0f8d9a3c..2e04fb23095 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 2b68c0aa5f8..3de00cff869 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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;
}
diff --git a/gcc/c-common.def b/gcc/c-common.def
index 67730fb538c..434af64fb9b 100644
--- a/gcc/c-common.def
+++ b/gcc/c-common.def
@@ -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)
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 59074b57b77..aa2b06fad1b 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -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. */
diff --git a/gcc/c-dump.c b/gcc/c-dump.c
index 3d2004eb04c..b0790efa209 100644
--- a/gcc/c-dump.c
+++ b/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));
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index 484cc7c772f..e0b262d03e8 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -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 ();
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 7589e738ef1..147dbc009f4 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -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;
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c
index 06b8654ab24..c1d9d60ee72 100644
--- a/gcc/c-pretty-print.c
+++ b/gcc/c-pretty-print.c
@@ -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)
{
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index 4a481916700..8a67c67a33d 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -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);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d700297e831..3238043bab8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,13 @@
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
* semantics.c (begin_for_stmt, begin_for_stmt): Do put the init
statement in FOR_INIT_STMT for templates.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 84ce0d74e94..4a402d43895 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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))
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 428762cb437..4d4561cebc2 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c93184aa0c7..0bbec66fa5f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ef82cb1bcb8..1b4f4677016 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 81db7ca6389..86c585b2e44 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index f4277931778..0ed3621e869 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -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));
}