This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] cp/*.[ch]: VECify static_decls.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 06 May 2005 22:28:33 -0400 (EDT)
- Subject: [patch] cp/*.[ch]: VECify static_decls.
Hi,
Attached is a patch to VECify static_decls.
Tested on i686-pc-linux-gnu. Committed as preapproved.
Kazu Hirata
2005-05-07 Kazu Hirata <kazu@cs.umass.edu>
* decl.c (wrapup_globals_for_namespace): Use VEC instead of
VARRAY.
* name-lookup.c (add_decl_to_level, begin_scope): Likewise.
* name-lookup.h (cp_binding_level): Change the type of
static_decls to VEC(tree,gc)*.
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1391
diff -u -d -p -r1.1391 decl.c
--- cp/decl.c 4 May 2005 06:00:13 -0000 1.1391
+++ cp/decl.c 6 May 2005 02:09:55 -0000
@@ -786,9 +786,9 @@ int
wrapup_globals_for_namespace (tree namespace, void* data)
{
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);
+ VEC(tree,gc) *statics = level->static_decls;
+ tree *vec = VEC_address (tree, statics);
+ int len = VEC_length (tree, statics);
int last_time = (data != 0);
if (last_time)
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.118
diff -u -d -p -r1.118 name-lookup.c
--- cp/name-lookup.c 2 May 2005 20:49:16 -0000 1.118
+++ cp/name-lookup.c 6 May 2005 02:09:56 -0000
@@ -546,7 +546,7 @@ add_decl_to_level (tree decl, cxx_scope
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
|| (TREE_CODE (decl) == FUNCTION_DECL
&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
- VARRAY_PUSH_TREE (b->static_decls, decl);
+ VEC_safe_push (tree, gc, b->static_decls, decl);
}
}
@@ -1264,11 +1264,11 @@ begin_scope (scope_kind kind, tree entit
case sk_namespace:
NAMESPACE_LEVEL (entity) = scope;
- VARRAY_TREE_INIT (scope->static_decls,
- DECL_NAME (entity) == std_identifier
- || DECL_NAME (entity) == global_scope_name
- ? 200 : 10,
- "Static declarations");
+ scope->static_decls =
+ VEC_alloc (tree, gc,
+ DECL_NAME (entity) == std_identifier
+ || DECL_NAME (entity) == global_scope_name
+ ? 200 : 10);
break;
default:
Index: cp/name-lookup.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.h,v
retrieving revision 1.39
diff -u -d -p -r1.39 name-lookup.h
--- cp/name-lookup.h 21 Apr 2005 09:18:12 -0000 1.39
+++ cp/name-lookup.h 6 May 2005 02:09:56 -0000
@@ -188,7 +188,7 @@ struct cp_binding_level GTY(())
tree namespaces;
/* An array of static functions and variables (for namespaces only) */
- varray_type static_decls;
+ VEC(tree,gc) *static_decls;
/* A chain of VTABLE_DECL nodes. */
tree vtables;