decl.c (cp_binding_level): Add static_decls varray member.
* decl.c (cp_binding_level): Add static_decls varray member. (add_decl_to_level): Add static/inline namespace scope declarations to static_decls array. (wrapup_global_for_namespace): Pass static_decls only, instead of all decls, to wrapup_global_declarations/check_global_declarations. (push_namespace): Initialize static_decls for ordinary namespaces. (cxx_init_decl_processing): Initialize static_decls for global namespace. From-SVN: r63866
This commit is contained in:
parent
35b0708052
commit
1d555f7aec
@ -1,3 +1,14 @@
|
||||
2003-03-02 Matt Austern <austern@apple.com>
|
||||
|
||||
* decl.c (cp_binding_level): Add static_decls varray member.
|
||||
(add_decl_to_level): Add static/inline namespace scope
|
||||
declarations to static_decls array.
|
||||
(wrapup_global_for_namespace): Pass static_decls only, instead of
|
||||
all decls, to wrapup_global_declarations/check_global_declarations.
|
||||
(push_namespace): Initialize static_decls for ordinary namespaces.
|
||||
(cxx_init_decl_processing): Initialize static_decls for global
|
||||
namespace.
|
||||
|
||||
2003-03-05 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* class.c (end_of_class): Correct thinko.
|
||||
|
@ -327,6 +327,9 @@ struct cp_binding_level GTY(())
|
||||
/* A chain of NAMESPACE_DECL nodes. */
|
||||
tree namespaces;
|
||||
|
||||
/* An array of static functions and variables (for namespaces only) */
|
||||
varray_type static_decls;
|
||||
|
||||
/* A chain of VTABLE_DECL nodes. */
|
||||
tree vtables;
|
||||
|
||||
@ -1019,6 +1022,13 @@ add_decl_to_level (tree decl,
|
||||
TREE_CHAIN (decl) = b->names;
|
||||
b->names = decl;
|
||||
b->names_size++;
|
||||
|
||||
/* If appropriate, add decl to separate list of statics */
|
||||
if (b->namespace_p)
|
||||
if ((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
|
||||
|| (TREE_CODE (decl) == FUNCTION_DECL
|
||||
&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
|
||||
VARRAY_PUSH_TREE (b->static_decls, decl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1849,19 +1859,12 @@ walk_globals (walk_globals_pred p, walk_globals_fn f, void *data)
|
||||
int
|
||||
wrapup_globals_for_namespace (tree namespace, void* data)
|
||||
{
|
||||
tree globals = cp_namespace_decls (namespace);
|
||||
int len = NAMESPACE_LEVEL (namespace)->names_size;
|
||||
tree *vec = (tree *) alloca (sizeof (tree) * len);
|
||||
int i;
|
||||
int result;
|
||||
tree decl;
|
||||
struct cp_binding_level *level = NAMESPACE_LEVEL (namespace);
|
||||
varray_type statics = level->static_decls;
|
||||
tree *vec = &VARRAY_TREE (statics, 0);
|
||||
int len = VARRAY_ACTIVE_SIZE (statics);
|
||||
int last_time = (data != 0);
|
||||
|
||||
/* Process the decls in reverse order--earliest first.
|
||||
Put them into VEC from back to front, then take out from front. */
|
||||
for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
|
||||
vec[len - i - 1] = decl;
|
||||
|
||||
if (last_time)
|
||||
{
|
||||
check_global_declarations (vec, len);
|
||||
@ -1869,9 +1872,7 @@ wrapup_globals_for_namespace (tree namespace, void* data)
|
||||
}
|
||||
|
||||
/* Write out any globals that need to be output. */
|
||||
result = wrapup_global_declarations (vec, len);
|
||||
|
||||
return result;
|
||||
return wrapup_global_declarations (vec, len);
|
||||
}
|
||||
|
||||
|
||||
@ -2195,6 +2196,9 @@ push_namespace (tree name)
|
||||
pushlevel (0);
|
||||
declare_namespace_level ();
|
||||
NAMESPACE_LEVEL (d) = current_binding_level;
|
||||
VARRAY_TREE_INIT (current_binding_level->static_decls,
|
||||
name != std_identifier ? 10 : 200,
|
||||
"Static declarations");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -6323,6 +6327,10 @@ cxx_init_decl_processing (void)
|
||||
NAMESPACE_LEVEL (global_namespace) = global_binding_level;
|
||||
declare_namespace_level ();
|
||||
|
||||
VARRAY_TREE_INIT (global_binding_level->static_decls,
|
||||
200,
|
||||
"Static declarations");
|
||||
|
||||
/* Create the `std' namespace. */
|
||||
push_namespace (std_identifier);
|
||||
std_node = current_namespace;
|
||||
|
Loading…
Reference in New Issue
Block a user