+2003-03-28 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (generate_ctor_or_dtor_function): Tolerate a
+ non-existant ssdf_decls array.
+ (finish_file): Call generator_ctor_or_dtor_function when there are
+ static constructors or destructors and no other static
+ initializations.
+
2003-03-28 Nathan Sidwell <nathan@codesourcery.com>
PR c++/10047
/* Call the static storage duration function with appropriate
arguments. */
- for (i = 0; i < ssdf_decls->elements_used; ++i)
- {
- arguments = tree_cons (NULL_TREE, build_int_2 (priority, 0),
- NULL_TREE);
- arguments = tree_cons (NULL_TREE, build_int_2 (constructor_p, 0),
- arguments);
- finish_expr_stmt (build_function_call (VARRAY_TREE (ssdf_decls, i),
- arguments));
- }
+ if (ssdf_decls)
+ for (i = 0; i < ssdf_decls->elements_used; ++i)
+ {
+ arguments = tree_cons (NULL_TREE, build_int_2 (priority, 0),
+ NULL_TREE);
+ arguments = tree_cons (NULL_TREE, build_int_2 (constructor_p, 0),
+ arguments);
+ finish_expr_stmt (build_function_call (VARRAY_TREE (ssdf_decls, i),
+ arguments));
+ }
/* If we're generating code for the DEFAULT_INIT_PRIORITY, throw in
calls to any functions marked with attributes indicating that
if (priority == DEFAULT_INIT_PRIORITY)
{
tree fns;
-
+
for (fns = constructor_p ? static_ctors : static_dtors;
fns;
fns = TREE_CHAIN (fns))
splay_tree_foreach (priority_info_map,
generate_ctor_and_dtor_functions_for_priority,
/*data=*/0);
+ else
+ {
+ if (static_ctors)
+ generate_ctor_or_dtor_function (/*constructor_p=*/true,
+ DEFAULT_INIT_PRIORITY);
+ if (static_dtors)
+ generate_ctor_or_dtor_function (/*constructor_p=*/false,
+ DEFAULT_INIT_PRIORITY);
+ }
/* We're done with the splay-tree now. */
if (priority_info_map)