[PATCH] Remove a pointless global var
Richard Biener
rguenther@suse.de
Tue Jul 23 09:20:00 GMT 2019
On Tue, 23 Jul 2019, Alexander Monakov wrote:
> On Tue, 23 Jul 2019, Richard Biener wrote:
>
> > OK, so like below. Slight complication is that C++ doesn't allow
> > the void * to int (*)() casting which means we probably have to go
> > with the template wrapper. I have to check if we use gcc_qsort
> > from C code, the prototypes are currently in system.h.
>
> This is a bit confusing. I see the patch implements option 1, but
> you're saying you'd prefer option 3 (which is also my preference)?
I just wanted to see how it plays out thus I took the simplest
which is option 1. But yes, if option 3 works I'm all for it.
> Calls from C code should be very rare, it's possible to adjust them
> manually if going for option 3.
>
> > Of course easiest is to simply rewrite all qsort calls to use
> > [gcc_]qsort_r and not provide qsort and poison it. I'm leaning
> > towards this "solution".
>
> All ~150 of them?
:/
> > On targets with register passing conventions we can also
> > completely elide the cmp2to3 wrapper (ok, that's a hack).
>
> A bad hack indeed. Option 3 allows getting efficient code
> in common cases without causing undefined behavior.
>
> Can you let me handle sort.cc changes once there's agreement
> which way to go?
Sure - feel free to give option 3 a shot. I'm just worried
about the system.h redirect which would be then disabled for C?
Thanks,
Richard.
More information about the Gcc-patches
mailing list