OSDN Git Service

* cp-tree.h (lang_decl_flags): Add global_ctor_p and
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Oct 1999 00:43:27 +0000 (00:43 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Oct 1999 00:43:27 +0000 (00:43 +0000)
global_dtor_p.  Add init_priority.
(DECL_ACCESS): Adjust accordingly.
(DECL_GLOBAL_CTOR_P, DECL_GLOBAL_DTOR_P): New macros.
(GLOBAL_INIT_PRIORITY): Likewise.
* decl.c (lang_mark_tree): Adjust accordingly.
(start_objects): Set DECL_GLOBAL_CTOR_P, DECL_GLOBAL_DTOR_P,
and GLOBAL_INIT_PRIORITY.
* dump.c (dequeue_and_dump): Print them.
* ir.texi: Document them.

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

gcc/cp/decl2.c

index 19a9cf1..b3cdad4 100644 (file)
@@ -2811,6 +2811,13 @@ start_objects (method_type, initp)
   /* Mark this declaration as used to avoid spurious warnings.  */
   TREE_USED (current_function_decl) = 1;
 
+  /* Mark this function as a global constructor or destructor.  */
+  if (method_type == 'I')
+    DECL_GLOBAL_CTOR_P (current_function_decl) = 1;
+  else
+    DECL_GLOBAL_DTOR_P (current_function_decl) = 1;
+  GLOBAL_INIT_PRIORITY (current_function_decl) = initp;
+
   body = begin_compound_stmt (/*has_no_scope=*/0);
 
   /* We cannot allow these functions to be elided, even if they do not