This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] PR c/7490


Hi,
I have modified my patch to be compatible with Eric's one for PR 7622,
here is
 the new revision. Modifications are still in genrtl_scope_statement
because 
it prevents looping across all local def twice. There no check about
aliases 
exept that it prevent aliasing in nested scope.


Index: gcc/c-semantics.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.47
diff -c -p -3 -r1.47 c-semantics.c
*** gcc/c-semantics.c	22 Sep 2002 02:03:15 -0000	1.47
--- gcc/c-semantics.c	9 Dec 2002 17:15:37 -0000
*************** void
*** 589,595 ****
  genrtl_scope_stmt (t)
       tree t;
  {
!   tree block = SCOPE_STMT_BLOCK (t);
  
    if (!SCOPE_NO_CLEANUPS_P (t))
      {
--- 589,596 ----
  genrtl_scope_stmt (t)
       tree t;
  {
!   int flag_inline_nested=0;
!   tree parent, block = SCOPE_STMT_BLOCK (t);
  
    if (!SCOPE_NO_CLEANUPS_P (t))
      {
*************** genrtl_scope_stmt (t)
*** 607,615 ****
        NOTE_BLOCK (note) = block;
      }
  
!   /* If we're at the end of a scope that contains inlined nested
!      functions, we have to decide whether or not to write them out. 
*/
!   if (block && SCOPE_END_P (t))
      {
        tree fn;
  
--- 608,625 ----
        NOTE_BLOCK (note) = block;
      }
  
!     /* check wether it is a nested function, inside 
!      * an extern inline one */
!   for (parent = current_function_decl; 
!        parent != NULL_TREE;
!        parent = get_containing_scope (parent))
!     if (TREE_CODE (parent) == FUNCTION_DECL
! 	&& DECL_INLINE (parent) && DECL_EXTERNAL (parent))
!       flag_inline_nested=1;
!   
!  /* If we're at the end of a scope that contains inlined nested
!    *  functions, we have to decide whether or not to write them out. 
*/
!   if (block && SCOPE_END_P (t) && !flag_inline_nested)
      {
        tree fn;
  
*************** genrtl_scope_stmt (t)
*** 620,628 ****
  	      && !TREE_ASM_WRITTEN (fn)
  	      && TREE_ADDRESSABLE (fn))
  	    {
! 	      push_function_context ();
! 	      output_inline_function (fn);
! 	      pop_function_context ();
  	    }
  	}
      }
--- 630,654 ----
  	      && !TREE_ASM_WRITTEN (fn)
  	      && TREE_ADDRESSABLE (fn))
  	    {
! 	      tree alias;
! 	      alias = lookup_attribute ("alias", DECL_ATTRIBUTES (fn));
! 	      if (alias)
! 		{
! 		  alias=TREE_VALUE(TREE_VALUE(alias));
! 		  error(" `%s' declaring an alias in a nested scope",
! 			TREE_STRING_POINTER(alias));
! 		}
! 	      else if (DECL_SAVED_INSNS (fn) != NULL)
! 		  {
! 		    push_function_context ();
! 		    output_inline_function (fn);
! 		    pop_function_context ();
! 		  }
! 	      else 
! 		{
! 		  error ("no definition for auto nested function `%s'",
! 			 IDENTIFIER_POINTER (DECL_NAME (fn)));
! 		}
  	    }
  	}
      }


--
							Philippe


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]