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
This commit is contained in:
Nathan Froyd 2010-06-30 12:20:54 +00:00 committed by Nathan Froyd
parent 533374223d
commit 1d468b06b9
4 changed files with 20 additions and 14 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -1,3 +1,7 @@
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.

View File

@ -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;
}