This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] c-common.c: Remove walk_stmt_tree.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 14 Nov 2004 00:16:55 -0500 (EST)
- Subject: [patch] c-common.c: Remove walk_stmt_tree.
Hi,
Attached is a patch to remove walk_stmt_tree as it is unused.
Bootstrapped on i686-pc-linux-gnu. OK to apply?
Kazu Hirata
2004-11-14 Kazu Hirata <kazu@cs.umass.edu>
* c-common.c (walk_stmt_tree): Remove.
* c-common.h: Remove the corresponding prototype.
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.584
diff -u -d -p -r1.584 c-common.c
--- c-common.c 9 Nov 2004 21:22:22 -0000 1.584
+++ c-common.c 14 Nov 2004 04:21:39 -0000
@@ -3398,76 +3398,6 @@ strip_pointer_operator (tree t)
return t;
}
-/* Walk the statement tree, rooted at *tp. Apply FUNC to all the
- sub-trees of *TP in a pre-order traversal. FUNC is called with the
- DATA and the address of each sub-tree. If FUNC returns a non-NULL
- value, the traversal is aborted, and the value returned by FUNC is
- returned. If FUNC sets WALK_SUBTREES to zero, then the subtrees of
- the node being visited are not walked.
-
- We don't need a without_duplicates variant of this one because the
- statement tree is a tree, not a graph. */
-
-tree
-walk_stmt_tree (tree *tp, walk_tree_fn func, void *data)
-{
- enum tree_code code;
- int walk_subtrees;
- tree result;
- int i, len;
-
-#define WALK_SUBTREE(NODE) \
- do \
- { \
- result = walk_stmt_tree (&(NODE), func, data); \
- if (result) \
- return result; \
- } \
- while (0)
-
- /* Skip empty subtrees. */
- if (!*tp)
- return NULL_TREE;
-
- /* Skip subtrees below non-statement nodes. */
- if (!STATEMENT_CODE_P (TREE_CODE (*tp)))
- return NULL_TREE;
-
- /* Call the function. */
- walk_subtrees = 1;
- result = (*func) (tp, &walk_subtrees, data);
-
- /* If we found something, return it. */
- if (result)
- return result;
-
- /* FUNC may have modified the tree, recheck that we're looking at a
- statement node. */
- code = TREE_CODE (*tp);
- if (!STATEMENT_CODE_P (code))
- return NULL_TREE;
-
- /* Visit the subtrees unless FUNC decided that there was nothing
- interesting below this point in the tree. */
- if (walk_subtrees)
- {
- /* Walk over all the sub-trees of this operand. Statement nodes
- never contain RTL, and we needn't worry about TARGET_EXPRs. */
- len = TREE_CODE_LENGTH (code);
-
- /* Go through the subtrees. We need to do this in forward order so
- that the scope of a FOR_EXPR is handled properly. */
- for (i = 0; i < len; ++i)
- WALK_SUBTREE (TREE_OPERAND (*tp, i));
- }
-
- /* Finally visit the chain. This can be tail-recursion optimized if
- we write it this way. */
- return walk_stmt_tree (&TREE_CHAIN (*tp), func, data);
-
-#undef WALK_SUBTREE
-}
-
/* Used to compare case labels. K1 and K2 are actually tree nodes
representing case labels, or NULL_TREE for a `default' label.
Returns -1 if K1 is ordered before K2, -1 if K1 is ordered after
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.269
diff -u -d -p -r1.269 c-common.h
--- c-common.h 31 Oct 2004 06:17:49 -0000 1.269
+++ c-common.h 14 Nov 2004 04:21:40 -0000
@@ -299,7 +299,6 @@ extern tree pop_stmt_list (tree);
extern tree add_stmt (tree);
extern void push_cleanup (tree, tree, bool);
-extern tree walk_stmt_tree (tree *, walk_tree_fn, void *);
extern int c_expand_decl (tree);
extern int field_decl_cmp (const void *, const void *);