OSDN Git Service

* decl.c (finish_function): Move the code for handling functions
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Sep 2000 00:38:47 +0000 (00:38 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Sep 2000 00:38:47 +0000 (00:38 +0000)
        marked with the constructor and destructor attributes inside the
        expand_p block.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36147 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c

index 2a5d960..564de16 100644 (file)
@@ -1,3 +1,9 @@
+2000-09-04  Mark Elbrecht  <snowball3@bigfoot.com>
+
+       * decl.c (finish_function): Move the code for handling functions
+       marked with the constructor and destructor attributes inside the
+       expand_p block.
+
 2000-09-04  Nathan Sidwell  <nathan@codesourcery.com>
 
        * init.c (resolve_offset_ref): Deal with TEMPLATE_ID_EXPR.
 2000-09-03  Mark Mitchell  <mark@codesourcery.com>
 
        * operators.def (ALIGNOF_EXPR, MAX_EXPR, MIN_EXPR): Change
-       new ABI mangling.       
+       new ABI mangling.
 
 2000-09-01  Nathan Sidwell  <nathan@codesourcery.com>
 
        * parse.y (named_class_head): Check for TYPENAME_TYPE. Simplify
-       union tag mismatch error reporting.     
+       union tag mismatch error reporting.
 
 2000-09-01  Nathan Sidwell  <nathan@codesourcery.com>
 
-       * call.c (build_scoped_method_call): Check it is not a namespace.       
+       * call.c (build_scoped_method_call): Check it is not a namespace.
 
 2000-08-30  Jason Merrill  <jason@redhat.com>
 
index b5627f1..0f4d1c1 100644 (file)
@@ -14510,6 +14510,18 @@ finish_function (flags)
        note_debug_info_needed (ctype);
 #endif
 
+      /* If this function is marked with the constructor attribute,
+        add it to the list of functions to be called along with
+        constructors from static duration objects.  */
+      if (DECL_STATIC_CONSTRUCTOR (fndecl))
+       static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
+
+      /* If this function is marked with the destructor attribute,
+        add it to the list of functions to be called along with
+        destructors from static duration objects.  */
+      if (DECL_STATIC_DESTRUCTOR (fndecl))
+       static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
+
       if (DECL_NAME (DECL_RESULT (fndecl)))
        returns_value |= can_reach_end;
       else
@@ -14565,11 +14577,6 @@ finish_function (flags)
        DECL_RTL (t) = DECL_INCOMING_RTL (t) = NULL_RTX;
     }
 
-  if (DECL_STATIC_CONSTRUCTOR (fndecl))
-    static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
-  if (DECL_STATIC_DESTRUCTOR (fndecl))
-    static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
-
   /* Clean up.  */
   if (! nested)
     {