__attribute__ ((constructor)) broken in C++

Andreas Schwab schwab@LS5.informatik.uni-dortmund.de
Sun Feb 14 16:00:00 GMT 1999


The constructor and destructor function attributes are completely ignored
in C++.


1999-02-14  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* decl2.c (do_dtors, do_ctors, finish_objects): Correct handling
	of special zero priority for functions with constructor or
	destructor attribute.

--- egcs-2.93/gcc/cp/decl2.c.~1~	Wed Feb 10 22:34:09 1999
+++ egcs-2.93/gcc/cp/decl2.c	Sun Feb 14 19:16:20 1999
@@ -2968,6 +2968,8 @@
     {
       tree list = (method_type == 'I' ? static_ctors : static_dtors);
 
+      initp = DEFAULT_INIT_PRIORITY;
+
       if (! current_function_decl && list)
 	start_objects (method_type, initp);
 
@@ -3098,7 +3100,7 @@
 	}
     }
 
-  finish_objects ('D', initp);
+  finish_objects ('D', start ? initp : 0);
 }
 
 /* Generate a function to run a set of global constructors.  START is
@@ -3207,7 +3209,7 @@
 	my_friendly_abort (22);
     }
 
-  finish_objects ('I', initp);
+  finish_objects ('I', start ? initp : 0);
 }
 
 /* This routine is called from the last rule in yyparse ().

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org


More information about the Gcc-patches mailing list