aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2011-04-14 11:18:40 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2011-04-14 11:18:40 +0000
commit61e46a7d5e8031930c341dc122ba614d6970886b (patch)
tree639555a2163347dbebd098a7599ee397b518a58a /gcc/function.c
parent023009d4d1a7471a5b965af6baf2d721e607fe92 (diff)
downloadgcc-61e46a7d5e8031930c341dc122ba614d6970886b.zip
gcc-61e46a7d5e8031930c341dc122ba614d6970886b.tar.gz
gcc-61e46a7d5e8031930c341dc122ba614d6970886b.tar.bz2
utils.c (gnat_poplevel): Use block_chainon.
gcc/ada/ * gcc-interface/utils.c (gnat_poplevel): Use block_chainon. gcc/ * function.h (block_chainon): Declare. * function.c (block_chainon): Define. gcc/cp/ * decl.c (poplevel): Use block_chainon. gcc/fortran// * f95-lang.c (poplevel): Use BLOCK_CHAIN and block_chainon. gcc/java/ * decl.c (poplevel): Use BLOCK_CHAIN and block_chainon. From-SVN: r172418
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c
index c292282..dd42fba 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4179,6 +4179,34 @@ blocks_nreverse (tree t)
return prev;
}
+/* Concatenate two chains of blocks (chained through BLOCK_CHAIN)
+ by modifying the last node in chain 1 to point to chain 2. */
+
+tree
+block_chainon (tree op1, tree op2)
+{
+ tree t1;
+
+ if (!op1)
+ return op2;
+ if (!op2)
+ return op1;
+
+ for (t1 = op1; BLOCK_CHAIN (t1); t1 = BLOCK_CHAIN (t1))
+ continue;
+ BLOCK_CHAIN (t1) = op2;
+
+#ifdef ENABLE_TREE_CHECKING
+ {
+ tree t2;
+ for (t2 = op2; t2; t2 = BLOCK_CHAIN (t2))
+ gcc_assert (t2 != t1);
+ }
+#endif
+
+ return op1;
+}
+
/* Count the subblocks of the list starting with BLOCK. If VECTOR is
non-NULL, list them all into VECTOR, in a depth-first preorder
traversal of the block tree. Also clear TREE_ASM_WRITTEN in all