]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
semantics.c (finish_for_stmt): Always test flag_new_for_scope.
authorRodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Mon, 13 Sep 2010 17:38:34 +0000 (17:38 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 13 Sep 2010 17:38:34 +0000 (13:38 -0400)
* semantics.c (finish_for_stmt): Always test flag_new_for_scope.
(begin_range_for_stmt): Likewise.

From-SVN: r164251

gcc/cp/ChangeLog
gcc/cp/semantics.c

index 60936e0aa5d4ad24a3f0694a2301ee0e03e8fac7..ee9944cad5a2636103593b4ed63535946d43d240 100644 (file)
@@ -1,3 +1,8 @@
+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>
 
        Implement range-based for-statements.
index 0ae00e47221ba7a04a74eee7d493245f89460c58..dc815686c1e5b66eb9fb4eb432ea3b8fb170484f 100644 (file)
@@ -882,21 +882,13 @@ finish_for_expr (tree expr, tree for_stmt)
 void
 finish_for_stmt (tree for_stmt)
 {
-  bool scoped;
-
   if (TREE_CODE (for_stmt) == RANGE_FOR_STMT)
-    {
-      RANGE_FOR_BODY (for_stmt) = do_poplevel (RANGE_FOR_BODY (for_stmt));
-      scoped = true;
-    }
+    RANGE_FOR_BODY (for_stmt) = do_poplevel (RANGE_FOR_BODY (for_stmt));
   else
-    {
-      FOR_BODY (for_stmt) = do_poplevel (FOR_BODY (for_stmt));
-      scoped = flag_new_for_scope > 0;
-    }
+    FOR_BODY (for_stmt) = do_poplevel (FOR_BODY (for_stmt));
 
   /* Pop the scope for the body of the loop.  */
-  if (scoped)
+  if (flag_new_for_scope > 0)
     {
       tree scope = TREE_CHAIN (for_stmt);
       TREE_CHAIN (for_stmt) = NULL;
@@ -913,10 +905,12 @@ tree
 begin_range_for_stmt (void)
 {
   tree r;
+
   r = build_stmt (input_location, RANGE_FOR_STMT,
                  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;
 }