Date: Wed, 17 Dec 2014 13:16:54 -0800 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Garrett Cooper <yaneurabeya@gmail.com> Cc: svn-src-head@freebsd.org, Ed Schouten <ed@80386.nl>, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric <dim@FreeBSD.org> Subject: Re: svn commit: r275819 - in head/lib/msun: ld128 ld80 src Message-ID: <20141217211654.GA95193@troutmask.apl.washington.edu> In-Reply-To: <87FF0FD4-EEF2-4264-9CBA-4B3A46E52FCB@gmail.com> References: <201412160921.sBG9LvFY064961@svn.freebsd.org> <20141216162055.GA64273@troutmask.apl.washington.edu> <CAJOYFBAAe_3psxdDC1Oq0%2BW=9T4qnSDK=tST3pP6q1iBpgME1w@mail.gmail.com> <20141217191235.GA89501@troutmask.apl.washington.edu> <87FF0FD4-EEF2-4264-9CBA-4B3A46E52FCB@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 17, 2014 at 12:48:37PM -0800, Garrett Cooper wrote:
> On Dec 17, 2014, at 11:12, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
>
> > On Wed, Dec 17, 2014 at 04:30:32PM +0100, Ed Schouten wrote:
>
> ?
>
> >>> This comment isn't true! These functions pre-date C11 by years.
> >>> See r151865. These functions were designed to deal with gcc's
> >>> poorly implemented I. See the paragraph above your comment.
> >>
> >> Keep in mind that the phrasing is intended to say that CMPLX*() and
> >> friends are part of C11. Those do not pre-date C11.
> >
> > The phrasing is wrong. cpack[fl] came at least 6 years before
> C11 and were designed to work around defects in C99. CMPLX[FL]
> > were introduced into C11 to address those defects. Changing
> > cpack[fl] to CMPLX[FL] and claiming that the functions are
> > modeled after the C11 macros is wrong (unless the meaning of
> > "before" and "after" have changed).
>
> Hi Dimitry/Ed/Steve,
> Does it make sense to take the logic that Ed added and guard it with a conditional so people building the functions can use the C+11 definitions instead of the C99 definitions? This could preserve the old behavior for folks who don?t have C+11 capable compilers, but would allow us (and others) who do via clang or newer versions of gcc to use the new C+11 idioms, similar to some of the other macros in sys/cdefs.h, et al.
> Thank you!
Ed's patch works for non-C11 compilers. His patch to math_private.h
contained, for example,
#ifndef CMPLXF
static __inline float complex
CMPLXF(float x, float y)
{
float_complex z;
REALPART(z) = x;
IMAGPART(z) = y;
return (z.f);
}
#endif
IMNSHO, the correct patch should have been
#ifdef CMPLXF
#define cpackf(x, y) CMPLXF((x), (y))
#else
static __inline float complex
cpackf(float x, float y)
{
float_complex z;
REALPART(z) = x;
IMAGPART(z) = y;
return (z.f);
}
#endif
Ed's diff is ~1000 lines and touches several files. Localizing
the change to math_private.h would have been a ~20 line
diff to a single file.
--
Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141217211654.GA95193>
