[PATCH] Fix PR46590

Richard Biener rguenther@suse.de
Fri Jan 17 12:15:00 GMT 2014


On Fri, 17 Jan 2014, Jakub Jelinek wrote:

> On Fri, Jan 17, 2014 at 12:32:34PM +0100, Richard Biener wrote:
> > ! /* Search the contents of the sorted vector with a binary search.
> > !    CMP is the comparison function to pass to bsearch.  */
> 
> Can you please sed -i -e s/__//g in the whole method?
> I mean, this isn't in libstdc++ or glibc header, so there is no point
> in obfuscating the names, and the __ prefixed names are even reserved
> for implementation, which we are not at least in stage1 built compiler.

Will do.

Richard.

> > ! template<typename T, typename A>
> > ! inline T *
> > ! vec<T, A, vl_embed>::bsearch (const void *__key,
> > ! 			      int (*__compar) (const void *, const void *))
> > ! {
> > !   const void *__base = this->address ();
> > !   size_t __nmemb = this->length ();
> > !   size_t __size = sizeof (T);
> > !   /* The following is a copy of glibc stdlib-bsearch.h.  */
> > !   size_t __l, __u, __idx;
> > !   const void *__p;
> > !   int __comparison;
> > ! 
> > !   __l = 0;
> > !   __u = __nmemb;
> > !   while (__l < __u)
> > !     {
> > !       __idx = (__l + __u) / 2;
> > !       __p = (const void *) (((const char *) __base) + (__idx * __size));
> > !       __comparison = (*__compar) (__key, __p);
> > !       if (__comparison < 0)
> > ! 	__u = __idx;
> > !       else if (__comparison > 0)
> > ! 	__l = __idx + 1;
> > !       else
> > ! 	return (T *)const_cast<void *>(__p);
> > !     }
> > ! 
> > !   return NULL;
> >   }
k



More information about the Gcc-patches mailing list