aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-05-11 20:25:38 -0700
committerRichard Henderson <rth@gcc.gnu.org>2003-05-11 20:25:38 -0700
commit66ea6f4ccef91a1d6b86f7feaf524df51a15e36c (patch)
treed64fee370dcba52f3ebdc46db60f749bc198bad5 /gcc/tree.c
parent358997e28a2aada18905dc8824252583116ed7df (diff)
downloadgcc-66ea6f4ccef91a1d6b86f7feaf524df51a15e36c.zip
gcc-66ea6f4ccef91a1d6b86f7feaf524df51a15e36c.tar.gz
gcc-66ea6f4ccef91a1d6b86f7feaf524df51a15e36c.tar.bz2
re PR c/10675 (Compile time increases quadratically with struct size)
PR c/10675 * c-decl.c: Include hashtab.h. (detect_field_duplicates): New. (finish_struct): Use it. * Makefile.in (c-decl.o): Update. * c-parse.in (structsp_attr): Nreverse component_decl_list results. (component_decl_list, component_decl_list2, components, components_notype): Build list in reverse order. (enumlist): Clarify docs. Use TREE_CHAIN not chainon. * tree.c (chainon): Special case op2 null as well. Reorg for clarity. From-SVN: r66710
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 8cff4ce..64b605a 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1031,26 +1031,27 @@ tree
chainon (op1, op2)
tree op1, op2;
{
+ tree t1;
- if (op1)
- {
- tree t1;
-#ifdef ENABLE_TREE_CHECKING
- tree t2;
-#endif
+ if (!op1)
+ return op2;
+ if (!op2)
+ return op1;
+
+ for (t1 = op1; TREE_CHAIN (t1); t1 = TREE_CHAIN (t1))
+ continue;
+ TREE_CHAIN (t1) = op2;
- for (t1 = op1; TREE_CHAIN (t1); t1 = TREE_CHAIN (t1))
- ;
- TREE_CHAIN (t1) = op2;
#ifdef ENABLE_TREE_CHECKING
- for (t2 = op2; t2; t2 = TREE_CHAIN (t2))
- if (t2 == t1)
- abort (); /* Circularity created. */
+ {
+ tree t2;
+ for (t2 = op2; t2; t2 = TREE_CHAIN (t2))
+ if (t2 == t1)
+ abort (); /* Circularity created. */
+ }
#endif
- return op1;
- }
- else
- return op2;
+
+ return op1;
}
/* Return the last node in a chain of nodes (chained through TREE_CHAIN). */