OSDN Git Service

* call.c (tourney): Don't do any extra comparisons.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 May 1998 18:20:09 +0000 (18:20 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 May 1998 18:20:09 +0000 (18:20 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20051 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c

index 23b61d0..02dbdcd 100644 (file)
@@ -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.
index 01bb53f..fb280eb 100644 (file)
@@ -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);