Blame SOURCES/gcc32-c++-scope-nesting.patch

6f1b0c
2004-08-13  Alexandre Oliva  <aoliva@redhat.com>
6f1b0c
6f1b0c
	Revert:
6f1b0c
	2003-03-17  Jason Merrill  <jason@redhat.com>
6f1b0c
	* decl.c (finish_function): Don't skip a block.
6f1b0c
6f1b0c
2004-08-12  Alexandre Oliva  <aoliva@redhat.com>
6f1b0c
6f1b0c
	2002-12-16  Jason Merrill  <jason@redhat.com>
6f1b0c
	* c-semantics.c (add_scope_stmt): Abort if the end SCOPE_STMT
6f1b0c
	doesn't match the begin SCOPE_STMT in partialness.
6f1b0c
6f1b0c
2004-08-12  Alexandre Oliva  <aoliva@redhat.com>
6f1b0c
6f1b0c
	2002-12-16  Jason Merrill  <jason@redhat.com>
6f1b0c
	* semantics.c (do_pushlevel): Call pushlevel after adding the
6f1b0c
	SCOPE_STMT.
6f1b0c
	(do_poplevel): Call poplevel before adding the SCOPE_STMT.
6f1b0c
	* parse.y (function_body): Go back to using compstmt.
6f1b0c
	* decl.c (pushdecl): Skip another level to get to the parms level.
6f1b0c
6f1b0c
--- gcc/c-semantics.c 17 Jan 2003 17:49:35 -0000 1.40.2.2.8.2
6f1b0c
+++ gcc/c-semantics.c 12 Aug 2004 09:16:00 -0000
6f1b0c
@@ -143,6 +143,8 @@ add_scope_stmt (begin_p, partial_p)
6f1b0c
     }
6f1b0c
   else
6f1b0c
     {
6f1b0c
+      if (partial_p != SCOPE_PARTIAL_P (TREE_PURPOSE (top)))
6f1b0c
+	abort ();
6f1b0c
       TREE_VALUE (top) = ss;
6f1b0c
       *stack_ptr = TREE_CHAIN (top);
6f1b0c
     }
6f1b0c
--- gcc/cp/decl.c 25 Mar 2003 20:01:38 -0000 1.866.2.36.4.15
6f1b0c
+++ gcc/cp/decl.c 12 Aug 2004 09:16:20 -0000
6f1b0c
@@ -4218,6 +4218,9 @@ pushdecl (x)
6f1b0c
 		     them there.  */
6f1b0c
 		  struct binding_level *b = current_binding_level->level_chain;
6f1b0c
 
6f1b0c
+		  /* Skip the ctor/dtor cleanup level.  */
6f1b0c
+		  b = b->level_chain;
6f1b0c
+
6f1b0c
 		  /* ARM $8.3 */
6f1b0c
 		  if (b->parm_flag == 1)
6f1b0c
 		    {
6f1b0c
--- gcc/cp/decl.c	2004-08-13 01:32:01.000000000 -0300
6f1b0c
+++ gcc/cp/decl.c	2004-08-12 21:55:06.000000000 -0300
6f1b0c
@@ -14375,7 +14375,8 @@
6f1b0c
 	     the function so we know that their lifetime always ends with a
6f1b0c
 	     return; see g++.dg/opt/nrv6.C.  We could be more flexible if
6f1b0c
 	     we were to do this optimization in tree-ssa.  */
6f1b0c
-	  && (outer = BLOCK_SUBBLOCKS (DECL_INITIAL (fndecl)),
6f1b0c
+	  /* Skip the artificial function body block.  */
6f1b0c
+	  && (outer = BLOCK_SUBBLOCKS (BLOCK_SUBBLOCKS (DECL_INITIAL (fndecl))),
6f1b0c
 	      chain_member (r, BLOCK_VARS (outer))))
6f1b0c
 	{
6f1b0c
 	  
6f1b0c
--- gcc/cp/parse.y 17 Jan 2003 17:49:55 -0000 1.248.2.5.4.1.2.3
6f1b0c
+++ gcc/cp/parse.y 12 Aug 2004 09:16:22 -0000
6f1b0c
@@ -775,15 +775,10 @@ eat_saved_input:
6f1b0c
 	;
6f1b0c
 
6f1b0c
 /* The outermost block of a function really begins before the
6f1b0c
-   mem-initializer-list, so we open one there and suppress the one that
6f1b0c
-   actually corresponds to the curly braces.  */
6f1b0c
+   mem-initializer-list, so we open one there, too.  */
6f1b0c
 function_body:
6f1b0c
-	  .begin_function_body ctor_initializer_opt save_lineno '{'
6f1b0c
-		{ $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
6f1b0c
-	  compstmtend 
6f1b0c
+	  .begin_function_body ctor_initializer_opt compstmt
6f1b0c
                 {
6f1b0c
-		  STMT_LINENO ($<ttype>5) = $3;
6f1b0c
-		  finish_compound_stmt (/*has_no_scope=*/1, $<ttype>5);
6f1b0c
 		  finish_function_body ($1);
6f1b0c
 		}
6f1b0c
 	;
6f1b0c
--- gcc/cp/semantics.c 25 Mar 2003 20:01:39 -0000 1.252.2.6.8.3
6f1b0c
+++ gcc/cp/semantics.c 12 Aug 2004 09:16:23 -0000
6f1b0c
@@ -125,14 +125,17 @@ do_poplevel ()
6f1b0c
     {
6f1b0c
       tree scope_stmts = NULL_TREE;
6f1b0c
 
6f1b0c
-      if (!processing_template_decl)
6f1b0c
-	scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
6f1b0c
-
6f1b0c
       block = poplevel (kept_level_p (), 1, 0);
6f1b0c
-      if (block && !processing_template_decl)
6f1b0c
+      if (!processing_template_decl)
6f1b0c
 	{
6f1b0c
-	  SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
6f1b0c
-	  SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
6f1b0c
+	  /* This needs to come after the poplevel so that partial scopes
6f1b0c
+	     are properly nested.  */
6f1b0c
+	  scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
6f1b0c
+	  if (block)
6f1b0c
+	    {
6f1b0c
+	      SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
6f1b0c
+	      SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
6f1b0c
+	    }
6f1b0c
 	}
6f1b0c
     }
6f1b0c
 
6f1b0c
@@ -146,9 +149,9 @@ do_pushlevel ()
6f1b0c
 {
6f1b0c
   if (stmts_are_full_exprs_p ())
6f1b0c
     {
6f1b0c
-      pushlevel (0);
6f1b0c
       if (!processing_template_decl)
6f1b0c
 	add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
6f1b0c
+      pushlevel (0);
6f1b0c
     }
6f1b0c
 }
6f1b0c