Commit 1bc5f355 by Kazu Hirata Committed by Kazu Hirata

decl2.c (ssdf_decls, [...]): Use VEC instead of VARRAY.

	* decl2.c (ssdf_decls, start_static_storage_duration_function,
	generate_ctor_or_dtor_function): Use VEC instead of VARRAY.

From-SVN: r99319
parent 6394d87d
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
* decl2.c (spew_debug): Remove. * decl2.c (spew_debug): Remove.
* decl2.c (ssdf_decls, start_static_storage_duration_function,
generate_ctor_or_dtor_function): Use VEC instead of VARRAY.
2005-05-05 Kazu Hirata <kazu@cs.umass.edu> 2005-05-05 Kazu Hirata <kazu@cs.umass.edu>
* decl2.c (deferred_fns, note_vague_linkage_fn, * decl2.c (deferred_fns, note_vague_linkage_fn,
......
...@@ -2167,7 +2167,7 @@ static GTY(()) tree ssdf_decl; ...@@ -2167,7 +2167,7 @@ static GTY(()) tree ssdf_decl;
/* All the static storage duration functions created in this /* All the static storage duration functions created in this
translation unit. */ translation unit. */
static GTY(()) varray_type ssdf_decls; static GTY(()) VEC(tree,gc) *ssdf_decls;
/* A map from priority levels to information about that priority /* A map from priority levels to information about that priority
level. There may be many such levels, so efficient lookup is level. There may be many such levels, so efficient lookup is
...@@ -2215,7 +2215,7 @@ start_static_storage_duration_function (unsigned count) ...@@ -2215,7 +2215,7 @@ start_static_storage_duration_function (unsigned count)
static constructors and destructors. */ static constructors and destructors. */
if (!ssdf_decls) if (!ssdf_decls)
{ {
VARRAY_TREE_INIT (ssdf_decls, 32, "ssdf_decls"); ssdf_decls = VEC_alloc (tree, gc, 32);
/* Take this opportunity to initialize the map from priority /* Take this opportunity to initialize the map from priority
numbers to information about that priority level. */ numbers to information about that priority level. */
...@@ -2231,7 +2231,7 @@ start_static_storage_duration_function (unsigned count) ...@@ -2231,7 +2231,7 @@ start_static_storage_duration_function (unsigned count)
get_priority_info (DEFAULT_INIT_PRIORITY); get_priority_info (DEFAULT_INIT_PRIORITY);
} }
VARRAY_PUSH_TREE (ssdf_decls, ssdf_decl); VEC_safe_push (tree, gc, ssdf_decls, ssdf_decl);
/* Create the argument list. */ /* Create the argument list. */
initialize_p_decl = cp_build_parm_decl initialize_p_decl = cp_build_parm_decl
...@@ -2607,26 +2607,23 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority, ...@@ -2607,26 +2607,23 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority,
/* Call the static storage duration function with appropriate /* Call the static storage duration function with appropriate
arguments. */ arguments. */
if (ssdf_decls) for (i = 0; VEC_iterate (tree, ssdf_decls, i, fndecl); ++i)
for (i = 0; i < ssdf_decls->elements_used; ++i) {
{ /* Calls to pure or const functions will expand to nothing. */
fndecl = VARRAY_TREE (ssdf_decls, i); if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE)))
{
/* Calls to pure or const functions will expand to nothing. */ if (! body)
if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE))) body = start_objects (function_key, priority);
{
if (! body) arguments = tree_cons (NULL_TREE,
body = start_objects (function_key, priority); build_int_cst (NULL_TREE, priority),
NULL_TREE);
arguments = tree_cons (NULL_TREE, arguments = tree_cons (NULL_TREE,
build_int_cst (NULL_TREE, priority), build_int_cst (NULL_TREE, constructor_p),
NULL_TREE); arguments);
arguments = tree_cons (NULL_TREE, finish_expr_stmt (build_function_call (fndecl, arguments));
build_int_cst (NULL_TREE, constructor_p), }
arguments); }
finish_expr_stmt (build_function_call (fndecl, arguments));
}
}
/* If we're generating code for the DEFAULT_INIT_PRIORITY, throw in /* If we're generating code for the DEFAULT_INIT_PRIORITY, throw in
calls to any functions marked with attributes indicating that calls to any functions marked with attributes indicating that
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment