diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2010-06-30 12:20:54 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@gcc.gnu.org> | 2010-06-30 12:20:54 +0000 |
commit | 1d468b06b93557dedbb74e130a4b7b830876038d (patch) | |
tree | fdc8a31036095a1dc3ec7c1c5847b98e9374af60 /gcc | |
parent | 533374223d1c9eedba6d7ec1631835427aa1ca08 (diff) | |
download | gcc-1d468b06b93557dedbb74e130a4b7b830876038d.zip gcc-1d468b06b93557dedbb74e130a4b7b830876038d.tar.gz gcc-1d468b06b93557dedbb74e130a4b7b830876038d.tar.bz2 |
c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block.
gcc/
* c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block.
gcc/cp/
* parser.c (cp_parser_omp_for_loop): Use a VEC for for_block.
From-SVN: r161599
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c-parser.c | 12 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 14 |
4 files changed, 20 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20716b5..4603e24 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2010-06-30 Nathan Froyd <froydnj@codesourcery.com> + + * c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block. + 2010-06-30 Richard Guenther <rguenther@suse.de> PR target/44722 diff --git a/gcc/c-parser.c b/gcc/c-parser.c index ac81d76..0493524 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -8150,10 +8150,11 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, tree clauses, tree *par_clauses) { tree decl, cond, incr, save_break, save_cont, body, init, stmt, cl; - tree declv, condv, incrv, initv, for_block = NULL, ret = NULL; + tree declv, condv, incrv, initv, ret = NULL; bool fail = false, open_brace_parsed = false; int i, collapse = 1, nbraces = 0; location_t for_loc; + VEC(tree,gc) *for_block = make_tree_vector (); for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl)) if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE) @@ -8185,8 +8186,7 @@ c_parser_omp_for_loop (location_t loc, if (c_parser_next_token_starts_declaration (parser)) { if (i > 0) - for_block - = tree_cons (NULL, c_begin_compound_stmt (true), for_block); + VEC_safe_push (tree, gc, for_block, c_begin_compound_stmt (true)); c_parser_declaration_or_fndef (parser, true, true, true, true, true); decl = check_for_loop_decls (for_loc); if (decl == NULL) @@ -8416,15 +8416,15 @@ c_parser_omp_for_loop (location_t loc, ret = stmt; } pop_scopes: - while (for_block) + while (!VEC_empty (tree, for_block)) { /* FIXME diagnostics: LOC below should be the actual location of this particular for block. We need to build a list of locations to go along with FOR_BLOCK. */ - stmt = c_end_compound_stmt (loc, TREE_VALUE (for_block), true); + stmt = c_end_compound_stmt (loc, VEC_pop (tree, for_block), true); add_stmt (stmt); - for_block = TREE_CHAIN (for_block); } + release_tree_vector (for_block); return ret; } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7bf190e..246be90 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2010-06-30 Nathan Froyd <froydnj@codesourcery.com> + * parser.c (cp_parser_omp_for_loop): Use a VEC for for_block. + +2010-06-30 Nathan Froyd <froydnj@codesourcery.com> + * repo.c (pending_repo): Change type to a VEC. (finish_repo): Adjust for new type of pending_repo. (repo_emit_p): Likewise. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 4e4db2d..e8f10a4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22705,11 +22705,12 @@ static tree cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) { tree init, cond, incr, body, decl, pre_body = NULL_TREE, ret; - tree for_block = NULL_TREE, real_decl, initv, condv, incrv, declv; + tree real_decl, initv, condv, incrv, declv; tree this_pre_body, cl; location_t loc_first; bool collapse_err = false; int i, collapse = 1, nbraces = 0; + VEC(tree,gc) *for_block = make_tree_vector (); for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl)) if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE) @@ -22828,8 +22829,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) LOOKUP_ONLYCONVERTING); if (CLASS_TYPE_P (TREE_TYPE (decl))) { - for_block - = tree_cons (NULL, this_pre_body, for_block); + VEC_safe_push (tree, gc, for_block, this_pre_body); init = NULL_TREE; } else @@ -23083,11 +23083,9 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) } } - while (for_block) - { - add_stmt (pop_stmt_list (TREE_VALUE (for_block))); - for_block = TREE_CHAIN (for_block); - } + while (!VEC_empty (tree, for_block)) + add_stmt (pop_stmt_list (VEC_pop (tree, for_block))); + release_tree_vector (for_block); return ret; } |