This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] cp/*.[ch]: VECify 'current_lang_base'.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 01 May 2005 16:05:37 -0400 (EDT)
- Subject: [patch] cp/*.[ch]: VECify 'current_lang_base'.
Hi,
Attached is a patch to VECify 'current_lang_base'.
Tested on i686-pc-linux-gnu. I am not aware of any big pending
project on the C++ front end, but I will wait for 24 hours just in
case before I check in this patch.
Kazu Hirata
2005-05-01 Kazu Hirata <kazu@cs.umass.edu>
* class.c (current_lang_depth, push_lang_context,
pop_lang_context): Use VEC instead of VARRAY.
* cp-tree.h (saved_scope): Use VEC for lang_base instead of
VARRAY.
* name-lookup.c (push_to_top_level): Use VEC instead of
VARRAY.
Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.714
diff -u -d -p -r1.714 class.c
--- cp/class.c 24 Apr 2005 22:06:33 -0000 1.714
+++ cp/class.c 1 May 2005 01:54:28 -0000
@@ -5523,7 +5523,7 @@ pop_nested_class (void)
int
current_lang_depth (void)
{
- return VARRAY_ACTIVE_SIZE (current_lang_base);
+ return VEC_length (tree, current_lang_base);
}
/* Set global variables CURRENT_LANG_NAME to appropriate value
@@ -5532,7 +5532,7 @@ current_lang_depth (void)
void
push_lang_context (tree name)
{
- VARRAY_PUSH_TREE (current_lang_base, current_lang_name);
+ VEC_safe_push (tree, gc, current_lang_base, current_lang_name);
if (name == lang_name_cplusplus)
{
@@ -5567,8 +5567,7 @@ push_lang_context (tree name)
void
pop_lang_context (void)
{
- current_lang_name = VARRAY_TOP_TREE (current_lang_base);
- VARRAY_POP (current_lang_base);
+ current_lang_name = VEC_pop (tree, current_lang_base);
}
/* Type instantiation routines. */
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.1131
diff -u -d -p -r1.1131 cp-tree.h
--- cp/cp-tree.h 25 Apr 2005 19:03:37 -0000 1.1131
+++ cp/cp-tree.h 1 May 2005 01:54:29 -0000
@@ -663,7 +663,7 @@ struct saved_scope GTY(())
tree class_type;
tree access_specifier;
tree function_decl;
- varray_type lang_base;
+ VEC(tree,gc) *lang_base;
tree lang_name;
tree template_parms;
struct cp_binding_level *x_previous_class_level;
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.116
diff -u -d -p -r1.116 name-lookup.c
--- cp/name-lookup.c 23 Apr 2005 21:28:54 -0000 1.116
+++ cp/name-lookup.c 1 May 2005 01:54:32 -0000
@@ -4864,7 +4864,7 @@ push_to_top_level (void)
scope_chain = s;
current_function_decl = NULL_TREE;
- VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base");
+ current_lang_base = VEC_alloc (tree, gc, 10);
current_lang_name = lang_name_cplusplus;
current_namespace = global_namespace;
timevar_pop (TV_NAME_LOOKUP);