From 2d08a364da48a73bbf1226bd415e530d4c67273d Mon Sep 17 00:00:00 2001 From: froydnj Date: Mon, 28 Jun 2010 13:06:43 +0000 Subject: [PATCH] * tree-browser.c (TB_history_stack): Convert to a VEC. (TB_SET_HEAD): Adjust for new type of TB_history_stack. (TB_history_prev): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161490 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/tree-browser.c | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a25bc7..d6fab50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2010-06-28 Nathan Froyd + * tree-browser.c (TB_history_stack): Convert to a VEC. + (TB_SET_HEAD): Adjust for new type of TB_history_stack. + (TB_history_prev): Likewise. + +2010-06-28 Nathan Froyd + * vec.h (vec_heap_free): Add parentheses around free. 2010-06-28 Steven Bosscher diff --git a/gcc/tree-browser.c b/gcc/tree-browser.c index a7c80c9..3803a50 100644 --- a/gcc/tree-browser.c +++ b/gcc/tree-browser.c @@ -108,7 +108,7 @@ void browse_tree (tree); /* Static variables. */ static htab_t TB_up_ht; -static tree TB_history_stack = NULL_TREE; +static VEC(tree,gc) *TB_history_stack; static int TB_verbose = 1; @@ -126,7 +126,7 @@ browse_tree (tree begin) fprintf (TB_OUT_FILE, "\nTree Browser\n"); #define TB_SET_HEAD(N) do { \ - TB_history_stack = tree_cons (NULL_TREE, (N), TB_history_stack); \ + VEC_safe_push (tree, gc, TB_history_stack, N); \ head = N; \ if (TB_verbose) \ if (head) \ @@ -876,11 +876,11 @@ find_node_with_code (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, static tree TB_history_prev (void) { - if (TB_history_stack) + if (!VEC_empty (tree, TB_history_stack)) { - TB_history_stack = TREE_CHAIN (TB_history_stack); - if (TB_history_stack) - return TREE_VALUE (TB_history_stack); + tree last = VEC_last (tree, TB_history_stack); + VEC_pop (tree, TB_history_stack); + return last; } return NULL_TREE; } -- 2.7.4