From owner-freebsd-current@FreeBSD.ORG Thu Jul 11 09:37:36 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 45BAED9C; Thu, 11 Jul 2013 09:37:36 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay011.isp.belgacom.be (mailrelay011.isp.belgacom.be [195.238.6.178]) by mx1.freebsd.org (Postfix) with ESMTP id 7B3411DF2; Thu, 11 Jul 2013 09:37:35 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al4GAGZ73lFR8aPm/2dsb2JhbABagwnCT4EGF3SCIwEBBAFWIwULCw4KCSUPAigeBg0BBQIBAYgFCrccj2EHg3UDkA6BLZdpgViBOzo Received: from 230.163-241-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.241.163.230]) by relay.skynet.be with ESMTP; 11 Jul 2013 11:37:26 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.7/8.14.7) with ESMTP id r6B9bP9C007983; Thu, 11 Jul 2013 11:37:25 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Message-ID: <51DE7CD0.60306@FreeBSD.org> Date: Thu, 11 Jul 2013 11:37:20 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130701 Thunderbird/17.0.7 MIME-Version: 1.0 To: Bruce Evans Subject: Re: CURRENT: CLANG 3.3 and -stad=c++11 and -stdlib=libc++: isnan()/isninf() oddity References: <20130710155809.0f589c22@thor.walstatt.dyndns.org> <20130710183315.725dfde0@thor.walstatt.dyndns.org> <20130710203200.5359fd18@thor.walstatt.dyndns.org> <51DDC04B.6040209@FreeBSD.org> <20957.49978.73666.392417@khavrinen.csail.mit.edu> <20130711130043.R920@besplex.bde.org> In-Reply-To: <20130711130043.R920@besplex.bde.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2EUTOIBMOAOLMNPWCAKBE" Cc: Garrett Wollman , FreeBSD CURRENT , freebsd-standards@FreeBSD.org, freebsd-toolchain@FreeBSD.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2013 09:37:36 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2EUTOIBMOAOLMNPWCAKBE Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-07-11 06:21, Bruce Evans wrote: > On Wed, 10 Jul 2013, Garrett Wollman wrote: >> < said: >>> I think isnan(double) and isinf(double) in math.h should only be >>> visible if (_BSD_VISIBLE || _XSI_VISIBLE) && __ISO_C_VISIBLE < 1999. >>> For C99 and higher there should only be the isnan/isinf macros. >> >> I believe you are correct. POSIX.1-2008 (which is aligned with C99) >> consistently calls isnan() a "macro", and gives a pseudo-prototype of >> >> int isnan(real-floating x); >=20 > Almost any macro may be implemented as a function, if no conforming > program can tell the difference. It is impossible for technical reason= s > to implement isnan() as a macro (except on weird implementations where > all real-floating types are physically the same). In the FreeBSD > implementation, isnan() is a macro, but it is also a function, and > the macro expands to the function in double precision: >=20 > % #define isnan(x) \ > % ((sizeof (x) =3D=3D sizeof (float)) ? __isnanf(x) \ > % : (sizeof (x) =3D=3D sizeof (double)) ? isnan(x) \ > % : __isnanl(x)) The C99 standard says isnan is a macro. I would say that only means defined(isnan) is true. Whether that macro then expands to function calls or not is not important. > I don't see how any conforming program can access the isnan() function > directly. It is just as protected as __isnan() would be. (isnan)() > gives the function (the function prototype uses this), but conforming > programs can't do that since the function might not exist. I don't think the standard allows a function to be declared with the same= name as a standard macro (it does allow the reverse: define a macro with the same name as a standard function). I believe the following code is C99 conforming but it currently does not compile with our math.h: ------ #include =20 int (isnan)(int a, int b, int c) { return (a + b + c); } ------ ------enig2EUTOIBMOAOLMNPWCAKBE 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) iF4EAREIAAYFAlHefNQACgkQfoCS2CCgtisTnwD7BfDDEcW43Z/knFNt/gk133gK oHU9NLmi8d4J9J5MIlQA/jpqMQEQHsree+HBmQmG+RWL1sBDXxit5pXk28CVamlC =faze -----END PGP SIGNATURE----- ------enig2EUTOIBMOAOLMNPWCAKBE--