This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] C++ PATCH to cp/name-lookup.c: add blank after comments
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: 30 Sep 2003 13:59:08 +0200
- Subject: [committed] C++ PATCH to cp/name-lookup.c: add blank after comments
- Organization: Integrable Solutions
This patch is supposed to add a blank line between comments and
function headers. There is a minor tweak to have cxx_binding_free
consistenty nullify cxx_binding::scope.
-- Gaby
2003-09-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl.c (pop_binding): Don't mess with nullifying binding->scope
here.
* name-lookup.c: Re-format.
(cxx_binding_free): Nullify binding->scope.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1136
diff -p -r1.1136 decl.c
*** decl.c 28 Sep 2003 04:37:38 -0000 1.1136
--- decl.c 30 Sep 2003 11:01:55 -0000
*************** pop_binding (tree id, tree decl)
*** 1030,1038 ****
/* Add it to the free list. */
cxx_binding_free (binding);
-
- /* Clear the SCOPE so the garbage collector doesn't walk it. */
- binding->scope = NULL;
}
}
--- 1030,1035 ----
Index: name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.11
diff -p -r1.11 name-lookup.c
*** name-lookup.c 27 Sep 2003 01:55:13 -0000 1.11
--- name-lookup.c 30 Sep 2003 11:01:55 -0000
*************** Boston, MA 02111-1307, USA. */
*** 32,43 ****
--- 32,46 ----
/* Compute the chain index of a binding_entry given the HASH value of its
name and the total COUNT of chains. COUNT is assumed to be a power
of 2. */
+
#define ENTRY_INDEX(HASH, COUNT) (((HASH) >> 3) & ((COUNT) - 1))
/* A free list of "binding_entry"s awaiting for re-use. */
+
static GTY((deletable(""))) binding_entry free_binding_entry = NULL;
/* Create a binding_entry object for (NAME, TYPE). */
+
static inline binding_entry
binding_entry_make (tree name, tree type)
{
*************** binding_entry_make (tree name, tree type
*** 59,64 ****
--- 62,68 ----
}
/* Put ENTRY back on the free list. */
+
static inline void
binding_entry_free (binding_entry entry)
{
*************** struct binding_table_s GTY(())
*** 82,87 ****
--- 86,92 ----
};
/* Construct TABLE with an initial CHAIN_COUNT. */
+
static inline void
binding_table_construct (binding_table table, size_t chain_count)
{
*************** binding_table_construct (binding_table t
*** 91,105 ****
(table->chain_count * sizeof (binding_entry));
}
! /* Free TABLE by making its entries ready for reuse. */
void
binding_table_free (binding_table table)
{
size_t i;
if (table == NULL)
return;
! for (i = 0; i < table->chain_count; ++i)
{
binding_entry temp = table->chain[i];
while (temp != NULL)
--- 96,113 ----
(table->chain_count * sizeof (binding_entry));
}
! /* Make TABLE's entries ready for reuse. */
!
void
binding_table_free (binding_table table)
{
size_t i;
+ size_t count;
+
if (table == NULL)
return;
! for (i = 0, count = table->chain_count; i < count; ++i)
{
binding_entry temp = table->chain[i];
while (temp != NULL)
*************** binding_table_free (binding_table table)
*** 109,120 ****
entry->chain = NULL;
binding_entry_free (entry);
}
! table->chain[i] = temp;
}
table->entry_count = 0;
}
/* Allocate a table with CHAIN_COUNT, assumed to be a power of two. */
binding_table
binding_table_new (size_t chain_count)
{
--- 117,129 ----
entry->chain = NULL;
binding_entry_free (entry);
}
! table->chain[i] = NULL;
}
table->entry_count = 0;
}
/* Allocate a table with CHAIN_COUNT, assumed to be a power of two. */
+
binding_table
binding_table_new (size_t chain_count)
{
*************** binding_table_new (size_t chain_count)
*** 125,130 ****
--- 134,140 ----
}
/* Expand TABLE to twice its current chain_count. */
+
static void
binding_table_expand (binding_table table)
{
*************** binding_table_expand (binding_table tabl
*** 151,157 ****
table->entry_count = old_entry_count;
}
! /* Insert a binding for NAME to TYPe into TABLE. */
void
binding_table_insert (binding_table table, tree name, tree type)
{
--- 161,168 ----
table->entry_count = old_entry_count;
}
! /* Insert a binding for NAME to TYPE into TABLE. */
!
void
binding_table_insert (binding_table table, tree name, tree type)
{
*************** binding_table_insert (binding_table tabl
*** 168,173 ****
--- 179,185 ----
}
/* Return the binding_entry, if any, that maps NAME. */
+
binding_entry
binding_table_find (binding_table table, tree name)
{
*************** binding_table_find (binding_table table,
*** 180,186 ****
return entry;
}
! /* Return the binding_entry, if any, that maps name to an anonymous type. */
tree
binding_table_find_anon_type (binding_table table, tree name)
{
--- 192,199 ----
return entry;
}
! /* Return the binding_entry, if any, that maps NAME to an anonymous type. */
!
tree
binding_table_find_anon_type (binding_table table, tree name)
{
*************** binding_table_find_anon_type (binding_ta
*** 195,200 ****
--- 208,214 ----
/* Return the binding_entry, if any, that has TYPE as target. If NAME
is non-null, then set the domain and rehash that entry. */
+
binding_entry
binding_table_reverse_maybe_remap (binding_table table, tree type, tree name)
{
*************** binding_table_reverse_maybe_remap (bindi
*** 230,235 ****
--- 244,250 ----
/* Remove from TABLE all entries that map to anonymous enums or
class-types. */
+
void
binding_table_remove_anonymous_types (binding_table table)
{
*************** binding_table_remove_anonymous_types (bi
*** 254,259 ****
--- 269,275 ----
}
/* Apply PROC -- with DATA -- to all entries in TABLE. */
+
void
binding_table_foreach (binding_table table, bt_foreach_proc proc, void *data)
{
*************** binding_table_foreach (binding_table tab
*** 270,278 ****
--- 286,296 ----
/* A free list of "cxx_binding"s, connected by their PREVIOUS. */
+
static GTY((deletable (""))) cxx_binding *free_bindings;
/* (GC)-allocate a binding object with VALUE and TYPE member initialized. */
+
cxx_binding *
cxx_binding_make (tree value, tree type)
{
*************** cxx_binding_make (tree value, tree type)
*** 293,301 ****
--- 311,321 ----
}
/* Put BINDING back on the free list. */
+
void
cxx_binding_free (cxx_binding *binding)
{
+ binding->scope = NULL;
binding->previous = free_bindings;
free_bindings = binding;
}
*************** find_binding (cxx_scope *scope, cxx_bind
*** 402,407 ****
--- 422,428 ----
}
/* Return the binding for NAME in SCOPE, if any. Otherwise, return NULL. */
+
cxx_binding *
cxx_scope_find_binding_for_name (cxx_scope *scope, tree name)
{