decl2.c (finish_objects): Do not call target constructor/destructor bits dirrectly.
authorJan Hubicka <jh@suse.cz>
Mon, 23 Apr 2007 10:10:20 +0000 (12:10 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 23 Apr 2007 10:10:20 +0000 (10:10 +0000)
* cp/decl2.c (finish_objects): Do not call target constructor/destructor
bits dirrectly.

From-SVN: r124062

gcc/cp/ChangeLog
gcc/cp/decl2.c

index 326ed7025eb471b70996c28cf3a996133df2538c..1b19ffca397fdda8731e73f37feb93c4ec58e855 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-23  Jan Hubicka  <jh@suse.cz>
+
+       * cp/decl2.c (finish_objects): Do not call target constructor/destructor
+       bits dirrectly.
+
 2007-04-21  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        * cp-tree.h (lang_tree_node): Use GENERIC_NEXT
index 54d5aa22939052def881a6ea30bf5ca3b06f38bf..41778283236ebe3e41fa6921d0499784204ece14 100644 (file)
@@ -2363,23 +2363,19 @@ finish_objects (int method_type, int initp, tree body)
   /* Finish up.  */
   finish_compound_stmt (body);
   fn = finish_function (0);
-  expand_or_defer_fn (fn);
-
-  /* When only doing semantic analysis, and no RTL generation, we
-     can't call functions that directly emit assembly code; there is
-     no assembly file in which to put the code.  */
-  if (flag_syntax_only)
-    return;
 
-  if (targetm.have_ctors_dtors)
+  if (method_type == 'I')
     {
-      rtx fnsym = XEXP (DECL_RTL (fn), 0);
-      cgraph_mark_needed_node (cgraph_node (fn));
-      if (method_type == 'I')
-       (* targetm.asm_out.constructor) (fnsym, initp);
-      else
-       (* targetm.asm_out.destructor) (fnsym, initp);
+      DECL_STATIC_CONSTRUCTOR (fn) = 1;
+      decl_init_priority_insert (fn, initp);
     }
+  else
+    {
+      DECL_STATIC_DESTRUCTOR (fn) = 1;
+      decl_fini_priority_insert (fn, initp);
+    }
+
+  expand_or_defer_fn (fn);
 }
 
 /* The names of the parameters to the function created to handle