Commit a8733ebf by Rodrigo Rivas Costa Committed by Jason Merrill

semantics.c (finish_for_stmt): Always test flag_new_for_scope.

	* semantics.c (finish_for_stmt): Always test flag_new_for_scope.
	(begin_range_for_stmt): Likewise.

From-SVN: r164251
parent e196b221
2010-09-13 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
* semantics.c (finish_for_stmt): Always test flag_new_for_scope.
(begin_range_for_stmt): Likewise.
2010-09-11 Rodrigo Rivas <rodrigorivascosta@gmail.com> 2010-09-11 Rodrigo Rivas <rodrigorivascosta@gmail.com>
Implement range-based for-statements. Implement range-based for-statements.
......
...@@ -882,21 +882,13 @@ finish_for_expr (tree expr, tree for_stmt) ...@@ -882,21 +882,13 @@ finish_for_expr (tree expr, tree for_stmt)
void void
finish_for_stmt (tree for_stmt) finish_for_stmt (tree for_stmt)
{ {
bool scoped;
if (TREE_CODE (for_stmt) == RANGE_FOR_STMT) if (TREE_CODE (for_stmt) == RANGE_FOR_STMT)
{ RANGE_FOR_BODY (for_stmt) = do_poplevel (RANGE_FOR_BODY (for_stmt));
RANGE_FOR_BODY (for_stmt) = do_poplevel (RANGE_FOR_BODY (for_stmt));
scoped = true;
}
else else
{ FOR_BODY (for_stmt) = do_poplevel (FOR_BODY (for_stmt));
FOR_BODY (for_stmt) = do_poplevel (FOR_BODY (for_stmt));
scoped = flag_new_for_scope > 0;
}
/* Pop the scope for the body of the loop. */ /* Pop the scope for the body of the loop. */
if (scoped) if (flag_new_for_scope > 0)
{ {
tree scope = TREE_CHAIN (for_stmt); tree scope = TREE_CHAIN (for_stmt);
TREE_CHAIN (for_stmt) = NULL; TREE_CHAIN (for_stmt) = NULL;
...@@ -913,10 +905,12 @@ tree ...@@ -913,10 +905,12 @@ tree
begin_range_for_stmt (void) begin_range_for_stmt (void)
{ {
tree r; tree r;
r = build_stmt (input_location, RANGE_FOR_STMT, r = build_stmt (input_location, RANGE_FOR_STMT,
NULL_TREE, NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE, NULL_TREE);
/* We can ignore flag_new_for_scope here. */
TREE_CHAIN (r) = do_pushlevel (sk_for); if (flag_new_for_scope > 0)
TREE_CHAIN (r) = do_pushlevel (sk_for);
return r; return r;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment