[cp] Last set of cleanups
Ben Elliston
bje@au1.ibm.com
Wed Nov 24 06:09:00 GMT 2004
This is the last of the patches in my cp/ subdirectory. Tested with a
bootstrap on i686-pc-linux-gnu. Okay for mainline?
2004-11-24 Ben Elliston <bje@au.ibm.com>
* cp-tree.h (warn_hidden): Remove extern.
(get_enclosing_class, get_vtt_name): Likewise.
(get_primary_binfo): Likewise.
* class.c (get_vtt_name): Make static.
(warn_hidden): Likewise.
(get_primary_binfo): Likewise.
(get_enclosing_class): Remove.
* cp-tree.h (build_x_delete): Remove extern.
* init.c (build_x_delete): Make static.
* cp-tree.h (hash_chainon): Remove extern.
(count_functions, count_trees): Likewise.
(verify_stmt_tree): Likewise.
(cp_is_overload_p, name_p): Likewise.
* trees.c (hash_chainon): Make static.
(count_functions, count_trees_r, count_trees): Remove.
(verify_stmt_tree_r, verify_stmt_tree): Likewise.
(cp_is_overload_p, name_p): Likewise.
Index: cp-tree.h
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.1070
diff -u -p -r1.1070 cp-tree.h
--- cp-tree.h 10 Nov 2004 17:34:47 -0000 1.1070
+++ cp-tree.h 24 Nov 2004 05:33:37 -0000
@@ -3660,16 +3660,12 @@ extern void cxx_print_error_function (st
const char *);
extern void build_self_reference (void);
extern int same_signature_p (tree, tree);
-extern void warn_hidden (tree);
extern void maybe_add_class_template_decl_list (tree, tree, int);
-extern tree get_enclosing_class (tree);
extern void unreverse_member_declarations (tree);
extern void invalidate_class_lookup_cache (void);
extern void maybe_note_name_used_in_class (tree, tree);
extern void note_name_declared_in_class (tree, tree);
extern tree get_vtbl_decl_for_binfo (tree);
-extern tree get_vtt_name (tree);
-extern tree get_primary_binfo (tree);
extern void debug_class (tree);
extern void debug_thunks (tree);
extern tree cp_fold_obj_type_ref (tree, tree);
@@ -3896,7 +3892,6 @@ extern tree build_zero_init (tre
extern tree build_offset_ref (tree, tree, bool);
extern tree build_new (tree, tree, tree, tree, int);
extern tree build_vec_init (tree, tree, tree, int);
-extern tree build_x_delete (tree, int, tree);
extern tree build_delete (tree, tree, special_function_kind, int, int);
extern void push_base_cleanups (void);
extern tree build_vbase_delete (tree, tree);
@@ -4204,8 +4199,6 @@ extern tree build_cplus_staticfn_type (
extern tree build_cplus_array_type (tree, tree);
extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
-extern tree hash_chainon (tree, tree);
-extern int count_functions (tree);
extern int is_overloaded_fn (tree);
extern tree get_first_fn (tree);
extern int bound_pmf_p (tree);
@@ -4239,17 +4232,13 @@ extern tree cp_build_qualified_type_real
#define cp_build_qualified_type(TYPE, QUALS) \
cp_build_qualified_type_real ((TYPE), (QUALS), tf_error | tf_warning)
extern special_function_kind special_function_p (tree);
-extern bool name_p (tree);
-extern int count_trees (tree);
extern int char_type_p (tree);
-extern void verify_stmt_tree (tree);
extern tree find_tree (tree, tree);
extern linkage_kind decl_linkage (tree);
extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
void*, struct pointer_set_t*);
extern int cp_cannot_inline_tree_fn (tree*);
extern tree cp_add_pending_fn_decls (void*,tree);
-extern int cp_is_overload_p (tree);
extern int cp_auto_var_in_fn_p (tree,tree);
extern void cp_update_decl_after_saving (tree, void *);
extern tree fold_if_not_in_template (tree);
Index: init.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/cp/init.c,v
retrieving revision 1.401
diff -u -p -r1.401 init.c
--- init.c 10 Nov 2004 17:00:46 -0000 1.401
+++ init.c 24 Nov 2004 05:33:37 -0000
@@ -56,6 +56,7 @@ static tree build_new_1 (tree);
static tree build_dtor_call (tree, special_function_kind, int);
static tree build_field_list (tree, tree, int *);
static tree build_vtbl_address (tree);
+static tree build_x_delete (tree, int, tree);
/* We are about to generate some complex initialization code.
Conceptually, it is all a single expression. However, we may want
@@ -2630,7 +2631,7 @@ build_vec_init (tree base, tree maxindex
This does not call any destructors. */
-tree
+static tree
build_x_delete (tree addr, int which_delete, tree virtual_size)
{
int use_global_delete = which_delete & 1;
Index: tree.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/cp/tree.c,v
retrieving revision 1.419
diff -u -p -r1.419 tree.c
--- tree.c 12 Nov 2004 21:47:09 -0000 1.419
+++ tree.c 24 Nov 2004 05:33:37 -0000
@@ -43,8 +43,6 @@ static hashval_t list_hash_pieces (tree,
static hashval_t list_hash (const void *);
static cp_lvalue_kind lvalue_p_1 (tree, int);
static tree build_target_expr (tree, tree);
-static tree count_trees_r (tree *, int *, void *);
-static tree verify_stmt_tree_r (tree *, int *, void *);
static tree find_tree_r (tree *, int *, void *);
static tree build_local_temp (tree);
@@ -752,7 +750,7 @@ hash_tree_chain (tree value, tree chain)
/* Similar, but used for concatenating two lists. */
-tree
+static tree
hash_chainon (tree list1, tree list2)
{
if (list2 == 0)
@@ -797,20 +795,6 @@ debug_binfo (tree elem)
}
int
-count_functions (tree t)
-{
- int i;
-
- if (TREE_CODE (t) == FUNCTION_DECL)
- return 1;
- gcc_assert (TREE_CODE (t) == OVERLOAD);
-
- for (i = 0; t; t = OVL_CHAIN (t))
- i++;
- return i;
-}
-
-int
is_overloaded_fn (tree x)
{
/* A baselink is also considered an overloaded function. */
@@ -976,67 +960,6 @@ bind_template_template_parm (tree t, tre
return t2;
}
-/* Called from count_trees via walk_tree. */
-
-static tree
-count_trees_r (tree *tp, int *walk_subtrees, void *data)
-{
- ++*((int *) data);
-
- if (TYPE_P (*tp))
- *walk_subtrees = 0;
-
- return NULL_TREE;
-}
-
-/* Debugging function for measuring the rough complexity of a tree
- representation. */
-
-int
-count_trees (tree t)
-{
- int n_trees = 0;
- walk_tree_without_duplicates (&t, count_trees_r, &n_trees);
- return n_trees;
-}
-
-/* Called from verify_stmt_tree via walk_tree. */
-
-static tree
-verify_stmt_tree_r (tree* tp,
- int* walk_subtrees ATTRIBUTE_UNUSED ,
- void* data)
-{
- tree t = *tp;
- htab_t *statements = (htab_t *) data;
- void **slot;
-
- if (!STATEMENT_CODE_P (TREE_CODE (t)))
- return NULL_TREE;
-
- /* If this statement is already present in the hash table, then
- there is a circularity in the statement tree. */
- gcc_assert (!htab_find (*statements, t));
-
- slot = htab_find_slot (*statements, t, INSERT);
- *slot = t;
-
- return NULL_TREE;
-}
-
-/* Debugging function to check that the statement T has not been
- corrupted. For now, this function simply checks that T contains no
- circularities. */
-
-void
-verify_stmt_tree (tree t)
-{
- htab_t statements;
- statements = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
- walk_tree (&t, verify_stmt_tree_r, &statements, NULL);
- htab_delete (statements);
-}
-
/* Called from find_tree via walk_tree. */
static tree
@@ -2082,16 +2005,6 @@ cp_add_pending_fn_decls (void* fns_p, tr
return prev_fn;
}
-/* Determine whether a tree node is an OVERLOAD node. Used to decide
- whether to copy a node or to preserve its chain when inlining a
- function. */
-
-int
-cp_is_overload_p (tree t)
-{
- return TREE_CODE (t) == OVERLOAD;
-}
-
/* Determine whether VAR is a declaration of an automatic variable in
function FN. */
@@ -2152,22 +2065,6 @@ special_function_p (tree decl)
return sfk_conversion;
return sfk_none;
-}
-
-/* Returns true if and only if NODE is a name, i.e., a node created
- by the parser when processing an id-expression. */
-
-bool
-name_p (tree node)
-{
- if (TREE_CODE (node) == TEMPLATE_ID_EXPR)
- node = TREE_OPERAND (node, 0);
- return (/* An ordinary unqualified name. */
- TREE_CODE (node) == IDENTIFIER_NODE
- /* A destructor name. */
- || TREE_CODE (node) == BIT_NOT_EXPR
- /* A qualified name. */
- || TREE_CODE (node) == SCOPE_REF);
}
/* Returns nonzero if TYPE is a character type, including wchar_t. */
Index: class.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/cp/class.c,v
retrieving revision 1.689
diff -u -p -r1.689 class.c
--- class.c 9 Nov 2004 10:12:28 -0000 1.689
+++ class.c 24 Nov 2004 05:33:37 -0000
@@ -202,6 +202,7 @@ static bool base_derived_from (tree, tre
static int empty_base_at_nonzero_offset_p (tree, tree, splay_tree);
static tree end_of_base (tree);
static tree get_vcall_index (tree, tree);
+static tree get_primary_binfo (tree binfo);
/* Variables shared between class.c and call.c. */
@@ -598,7 +599,7 @@ get_vtable_name (tree type)
/* Return an IDENTIFIER_NODE for the name of the virtual table table
for TYPE. */
-tree
+static tree
get_vtt_name (tree type)
{
return mangle_vtt_for_type (type);
@@ -2313,7 +2314,7 @@ check_for_override (tree decl, tree ctyp
/* Warn about hidden virtual functions that are not overridden in t.
We know that constructors and destructors don't apply. */
-void
+static void
warn_hidden (tree t)
{
VEC(tree) *method_vec = CLASSTYPE_METHOD_VEC (t);
@@ -6186,35 +6187,6 @@ contains_empty_class_p (tree type)
return false;
}
-/* Find the enclosing class of the given NODE. NODE can be a *_DECL or
- a *_TYPE node. NODE can also be a local class. */
-
-tree
-get_enclosing_class (tree type)
-{
- tree node = type;
-
- while (node && TREE_CODE (node) != NAMESPACE_DECL)
- {
- switch (TREE_CODE_CLASS (TREE_CODE (node)))
- {
- case tcc_declaration:
- node = DECL_CONTEXT (node);
- break;
-
- case tcc_type:
- if (node != type)
- return node;
- node = TYPE_CONTEXT (node);
- break;
-
- default:
- gcc_unreachable ();
- }
- }
- return NULL_TREE;
-}
-
/* Note that NAME was looked up while the current class was being
defined and that the result of that lookup was DECL. */
@@ -6301,7 +6273,7 @@ get_vtbl_decl_for_binfo (tree binfo)
BINFO in the complete object. Check BINFO_PRIMARY_P or
BINFO_LOST_PRIMARY_P to be sure. */
-tree
+static tree
get_primary_binfo (tree binfo)
{
tree primary_base;
More information about the Gcc-patches
mailing list