Date: Thu, 11 Jul 2013 20:52:39 +0200 From: Tijl Coosemans <tijl@coosemans.org> To: David Chisnall <theraven@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r253215 - head/lib/msun/src Message-ID: <51DEFEF7.4080709@coosemans.org> In-Reply-To: <201307111741.r6BHf5gQ060844@svn.freebsd.org> References: <201307111741.r6BHf5gQ060844@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2ARPGUAAVSEBRLNCGTWEH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-07-11 19:41, David Chisnall wrote: > Author: theraven > Date: Thu Jul 11 17:41:04 2013 > New Revision: 253215 > URL: http://svnweb.freebsd.org/changeset/base/253215 >=20 > Log: > Cleanups to math.h that prevent namespace conflicts with C++. > =20 > Reviewed by: bde > MFC after: 3 days >=20 > Modified: > head/lib/msun/src/math.h >=20 > Modified: head/lib/msun/src/math.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/msun/src/math.h Thu Jul 11 16:27:11 2013 (r253214) > +++ head/lib/msun/src/math.h Thu Jul 11 17:41:04 2013 (r253215) > @@ -80,27 +80,33 @@ extern const union __nan_un { > #define FP_NORMAL 0x04 > #define FP_SUBNORMAL 0x08 > #define FP_ZERO 0x10 > + > +#if __STDC_VERSION__ >=3D 201112L > +#define __fp_type_select(x, f, d, ld) _Generic((x), \ > + float: f(x), \ > + double: d(x), \ > + long double: ld(x)) GCC doesn't support _Generic yet for -std=3Dc11. > +#elif __GNUC_PREREQ__(5, 1) GCC 3.1? > +#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( = \ > + __builtin_types_compatible_p(__typeof(x), long double), ld(x), \ > + __builtin_choose_expr( \ > + __builtin_types_compatible_p(__typeof(x), double), d(x), \ > + __builtin_choose_expr( \ > + __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0))) > +#else > +#define __fp_type_select(x, f, d, ld) \ > + ((sizeof(x) =3D=3D sizeof(float)) ? f(x) \ > + : (sizeof(x) =3D=3D sizeof(double)) ? d(x) \ > + : ld(x)) > +#endif > + > #define fpclassify(x) \ > - ((sizeof (x) =3D=3D sizeof (float)) ? __fpclassifyf(x) \ > - : (sizeof (x) =3D=3D sizeof (double)) ? __fpclassifyd(x) \ > - : __fpclassifyl(x)) > - > -#define isfinite(x) \ > - ((sizeof (x) =3D=3D sizeof (float)) ? __isfinitef(x) \ > - : (sizeof (x) =3D=3D sizeof (double)) ? __isfinite(x) \ > - : __isfinitel(x)) > -#define isinf(x) \ > - ((sizeof (x) =3D=3D sizeof (float)) ? __isinff(x) \ > - : (sizeof (x) =3D=3D sizeof (double)) ? isinf(x) \ > - : __isinfl(x)) > -#define isnan(x) \ > - ((sizeof (x) =3D=3D sizeof (float)) ? __isnanf(x) \ > - : (sizeof (x) =3D=3D sizeof (double)) ? isnan(x) \ > - : __isnanl(x)) > -#define isnormal(x) \ > - ((sizeof (x) =3D=3D sizeof (float)) ? __isnormalf(x) \ > - : (sizeof (x) =3D=3D sizeof (double)) ? __isnormal(x) \ > - : __isnormall(x)) > + __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyd) Last __fpclassifyd should be __fpclassifyl. > @@ -227,8 +250,6 @@ double expm1(double); > double fma(double, double, double); > double hypot(double, double); > int ilogb(double) __pure2; > -int (isinf)(double) __pure2; > -int (isnan)(double) __pure2; I think they should stay for the C90 case. ------enig2ARPGUAAVSEBRLNCGTWEH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iF4EAREIAAYFAlHe/vwACgkQfoCS2CCgtiv3QwD/USQ3ZRmBJDOZVM/rLceqnkT3 RdTlc2V1NOw0jIiQuQgA/1fZCdFTdAlEmewAxjjPNQDf2iKMBS1Hyu69iBPBszPG =NRg+ -----END PGP SIGNATURE----- ------enig2ARPGUAAVSEBRLNCGTWEH--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51DEFEF7.4080709>