summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-27 17:43:44 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-27 17:43:44 +0000
commitcacfdc02fa4b41d2583febcee45ec33cfd58d736 (patch)
tree308837cc489c3a37ca81ae52d342d7b9bd43b7c7 /gcc/c-decl.c
parentc859a23cca083d056a359d5b40a9d5f27e531f3b (diff)
downloadgcc-cacfdc02fa4b41d2583febcee45ec33cfd58d736.tar.gz
move TS_STATEMENT_LIST to be a substructure of TS_TYPED
gcc/ * c-decl.c (c_push_function_context): Copy the current statement list stack. (add_stmt): Check building_stmt_list_p and push_stmt if necessary. (finish_struct): Call building_stmt_list_p instead of checking cur_stmt_list. * c-parser.c (c_parser_postfix_expression): Likewise. * c-typeck.c (c_end_compound_stmt): Likewise. * print-tree.c (print_node) [STATEMENT_LIST]: Don't print TREE_CHAIN. * tree-iterator.c (stmt_list_cache): Change to a VEC. (alloc_stmt_list): Adjust for stmt_list_cache's new type. (free_stmt_list): Likewise. * tree.h (struct tree_statement_list): Include typed_tree instead of tree_common. * tree.c (initialize_tree_contains_struct): Mark TS_STATEMENT_LIST as TS_TYPED instead of TS_COMMON. gcc/c-family/ * c-common.h (struct stmt_tree_s) [x_cur_stmt_list]: Change to a VEC. (stmt_list_stack): Define. (cur_stmt_list): Adjust for new type of x_cur_stmt_list. * c-semantics.c (push_stmt_list, pop_stmt_list): Likewise. gcc/cp/ * cp-tree.h (building_stmt_tree): Delete. * decl.c (save_function_data): Tweak initializer for x_cur_stmt_list. (build_aggr_init_full_exprs): Call building_stmt_list_p instead of building_stmt_tree. (initialize_local_var): Likewise. (finish_function): Likewise. * decl2.c (finish_anon_union): Likewise. * init.c (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (expand_aggr_init_1): Likewise. * name-lookup.c (do_local_using_decl): Likewise. (do_namespace_alias): Likewise. (do_using_directive): Likewise. (cp_emit_debug_info_for_using): Likewise. * semantics.c (add_stmt): Assert that stmt_list_stack is non-empty. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174343 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index a7cc965f78f..1d43126fd46 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -552,6 +552,8 @@ add_stmt (tree t)
/* Add T to the statement-tree. Non-side-effect statements need to be
recorded during statement expressions. */
+ if (!building_stmt_list_p ())
+ push_stmt_list ();
append_to_statement_list_force (t, &cur_stmt_list);
return t;
@@ -7188,7 +7190,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
/* If we're inside a function proper, i.e. not file-scope and not still
parsing parameters, then arrange for the size of a variable sized type
to be bound now. */
- if (cur_stmt_list && variably_modified_type_p (t, NULL_TREE))
+ if (building_stmt_list_p () && variably_modified_type_p (t, NULL_TREE))
add_stmt (build_stmt (loc,
DECL_EXPR, build_decl (loc, TYPE_DECL, NULL, t)));
@@ -8424,6 +8426,8 @@ c_push_function_context (void)
cfun->language = p;
p->base.x_stmt_tree = c_stmt_tree;
+ c_stmt_tree.x_cur_stmt_list
+ = VEC_copy (tree, gc, c_stmt_tree.x_cur_stmt_list);
p->x_break_label = c_break_label;
p->x_cont_label = c_cont_label;
p->x_switch_stack = c_switch_stack;