On Wed, Dec 17, 2014 at 12:48:37PM -0800, Garrett Cooper wrote:
> On Dec 17, 2014, at 11:12, Steve Kargl <s...@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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to