[PATCH] Remove some unused "nested function" in the C-front-end

Andrew Pinski pinskia@physics.uc.edu
Fri May 28 16:40:00 GMT 2004


Because of unnesting pass now on the mainline, some of the code in
the C front-end becomes unused.
This patch removes the code which is unused.

OK? Bootstrapped on powerpc-apple-darwin with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
	* c-decl.c (c_expand_body_1): Remove and fold back into ...
	(c_expand_body): here.
	(c_expand_decl): Remove check for nested functions as it
	can no longer happen.


Patch:
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.501
diff -u -p -r1.501 c-decl.c
--- c-decl.c	19 May 2004 01:28:49 -0000	1.501
+++ c-decl.c	28 May 2004 14:25:43 -0000
@@ -6360,47 +6360,26 @@ finish_function (void)
    current_function_decl = NULL;
  }

-/* Generate the RTL for the body of FNDECL.  If NESTED_P is nonzero,
-   then we are already in the process of generating RTL for another
-   function.  */
+/* Generate the RTL for the body of FNDECL.  */

-static void
-c_expand_body_1 (tree fndecl, int nested_p)
+void
+c_expand_body (tree fndecl)
  {
-  if (nested_p)
-    {
-      /* Make sure that we will evaluate variable-sized types involved
-	 in our function's type.  */
-      expand_pending_sizes (DECL_LANG_SPECIFIC 
(fndecl)->pending_sizes);

-      /* Squirrel away our current state.  */
-      push_function_context ();
-    }
-
-  tree_rest_of_compilation (fndecl, nested_p);
+  if (!DECL_INITIAL (fndecl)
+      || DECL_INITIAL (fndecl) == error_mark_node)
+    return;

-  if (nested_p)
-    /* Return to the enclosing function.  */
-    pop_function_context ();
+  tree_rest_of_compilation (fndecl, false);

    if (DECL_STATIC_CONSTRUCTOR (fndecl)
        && targetm.have_ctors_dtors)
      targetm.asm_out.constructor (XEXP (DECL_RTL (fndecl), 0),
-				 DEFAULT_INIT_PRIORITY);
+                                 DEFAULT_INIT_PRIORITY);
    if (DECL_STATIC_DESTRUCTOR (fndecl)
        && targetm.have_ctors_dtors)
      targetm.asm_out.destructor (XEXP (DECL_RTL (fndecl), 0),
-				DEFAULT_INIT_PRIORITY);
-}
-
-/* Like c_expand_body_1 but only for unnested functions.  */
-
-void
-c_expand_body (tree fndecl)
-{
-
-  if (DECL_INITIAL (fndecl) && DECL_INITIAL (fndecl) != 
error_mark_node)
-    c_expand_body_1 (fndecl, 0);
+                                DEFAULT_INIT_PRIORITY);
  }
  
  /* Check the declarations given in a for-loop for satisfying the C99
@@ -6613,11 +6592,6 @@ c_expand_decl (tree decl)
      }
    else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
      make_rtl_for_local_static (decl);
-  /* Expand nested functions.  */
-  else if (TREE_CODE (decl) == FUNCTION_DECL
-	   && DECL_CONTEXT (decl) == current_function_decl
-	   && DECL_SAVED_TREE (decl))
-    c_expand_body_1 (decl, 1);
    else
      return 0;

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: removeNested.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040528/98c2c87b/attachment.txt>


More information about the Gcc-patches mailing list