/* Record information about module initialization, termination,
unit testing, and thread local storage in the compilation. */
-struct GTY(()) module_info
+struct module_info
{
vec <tree, va_gc> *ctors;
vec <tree, va_gc> *dtors;
static Module *current_module_decl;
-/* Static constructors and destructors (not D `static this'). */
-
-static GTY(()) vec <tree, va_gc> *static_ctor_list;
-static GTY(()) vec <tree, va_gc> *static_dtor_list;
-
/* Returns an internal function identified by IDENT. This is used
by both module initialization and dso handlers. */
/* Declare dso_ctor() and dso_dtor(). */
tree dso_ctor = build_dso_cdtor_fn (true);
- vec_safe_push (static_ctor_list, dso_ctor);
+ DECL_STATIC_CONSTRUCTOR (dso_ctor) = 1;
+ decl_init_priority_insert (dso_ctor, DEFAULT_INIT_PRIORITY);
tree dso_dtor = build_dso_cdtor_fn (false);
- vec_safe_push (static_dtor_list, dso_dtor);
+ DECL_STATIC_DESTRUCTOR (dso_dtor) = 1;
+ decl_fini_priority_insert (dso_dtor, DEFAULT_INIT_PRIORITY);
first_module = false;
}
tree decl = vec[i];
wrapup_global_declarations (&decl, 1);
}
-
- /* If the target does not directly support static constructors,
- static_ctor_list contains a list of all static constructors defined
- so far. This routine will create a function to call all of those
- and is picked up by collect2. */
- if (static_ctor_list)
- {
- tree decl = build_funcs_gates_fn (get_file_function_name ("I"),
- static_ctor_list, NULL);
- DECL_STATIC_CONSTRUCTOR (decl) = 1;
- decl_init_priority_insert (decl, DEFAULT_INIT_PRIORITY);
- }
-
- if (static_dtor_list)
- {
- tree decl = build_funcs_gates_fn (get_file_function_name ("D"),
- static_dtor_list, NULL);
- DECL_STATIC_DESTRUCTOR (decl) = 1;
- decl_fini_priority_insert (decl, DEFAULT_INIT_PRIORITY);
- }
}
-
-
-#include "gt-d-modules.h"