This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gold patch obvious] Remove unnecessary code in Sort_commons::operator()


Are you absolutely sure that this will produce the same sorting result
on both OSX and Linux, which have different implementation of qsort?

在 2010年8月18日上午11:38,Cary Coutant <ccoutant@google.com> 寫道:
> This patch just removes some unnecessary code that was equivalent to a
> NOP. Committed as obvious (after verifying with Ian that the original
> code wasn't trying to do something more subtle).
>
> -cary
>
>
>        * common.cc (Sort_commons::operator()): Remove unnecessary code.
>
>
> Index: common.cc
> ===================================================================
> RCS file: /cvs/src/src/gold/common.cc,v
> retrieving revision 1.24
> diff -u -p -r1.24 common.cc
> --- common.cc   3 Aug 2010 14:07:13 -0000       1.24
> +++ common.cc   18 Aug 2010 18:30:13 -0000
> @@ -88,16 +88,7 @@ bool
>  Sort_commons<size>::operator()(const Symbol* pa, const Symbol* pb) const
>  {
>   if (pa == NULL)
> -    {
> -      if (pb == NULL)
> -       {
> -         // Stabilize sort.  The order really doesn't matter, because
> -         // these entries will be discarded, but we want to return
> -         // the same result every time we compare pa and pb.
> -         return pa < pb;
> -       }
> -      return false;
> -    }
> +    return false;
>   if (pb == NULL)
>     return true;
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]