aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-05-25 18:20:09 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-05-25 18:20:09 +0000
commitb265c11aae43a501e7cea84865fbc9f3120ad388 (patch)
tree58a5ada102f3a757b58eba044f7ade786d025e0c
parentc7f58590a7c8641ce718f2c2ae2553120949177f (diff)
downloadgcc-b265c11aae43a501e7cea84865fbc9f3120ad388.zip
gcc-b265c11aae43a501e7cea84865fbc9f3120ad388.tar.gz
gcc-b265c11aae43a501e7cea84865fbc9f3120ad388.tar.bz2
* call.c (tourney): Don't do any extra comparisons.
From-SVN: r20051
-rw-r--r--gcc/cp/ChangeLog2
-rw-r--r--gcc/cp/call.c14
2 files changed, 12 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 23b61d0..02dbdcd 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,7 @@
1998-05-25 Mark Mitchell <mark@markmitchell.com>
+ * call.c (tourney): Don't do any extra comparisons.
+
* decl2.c (build_anon_union_vars): Don't crash on empty sub-unions.
* cp-tree.h (processing_template_parmlist): Declare.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 01bb53f..fb280eb 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4389,6 +4389,7 @@ tourney (candidates)
{
struct z_candidate *champ = candidates, *challenger;
int fate;
+ int champ_compared_to_predecessor = 0;
/* Walk through the list once, comparing each current champ to the next
candidate, knocking out a candidate or two with each comparison. */
@@ -4405,19 +4406,24 @@ tourney (candidates)
champ = challenger->next;
if (champ == 0)
return 0;
+ champ_compared_to_predecessor = 0;
}
else
- champ = challenger;
+ {
+ champ = challenger;
+ champ_compared_to_predecessor = 1;
+ }
challenger = champ->next;
}
}
/* Make sure the champ is better than all the candidates it hasn't yet
- been compared to. This may do one more comparison than necessary. Oh
- well. */
+ been compared to. */
- for (challenger = candidates; challenger != champ;
+ for (challenger = candidates;
+ challenger != champ
+ && !(champ_compared_to_predecessor && challenger->next == champ);
challenger = challenger->next)
{
fate = joust (champ, challenger, 0);