From owner-svn-src-head@FreeBSD.ORG Mon Jul 29 11:00:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8F925C28; Mon, 29 Jul 2013 11:00:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 8BA3B2D17; Mon, 29 Jul 2013 11:00:10 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id BBF0ED41EBD; Mon, 29 Jul 2013 20:59:59 +1000 (EST) Date: Mon, 29 Jul 2013 20:59:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Chisnall Subject: Re: svn commit: r253764 - head/lib/msun/src In-Reply-To: <201307290832.r6T8WEYB007487@svn.freebsd.org> Message-ID: <20130729201847.K1146@besplex.bde.org> References: <201307290832.r6T8WEYB007487@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=YYGEuWhf c=1 sm=1 tr=0 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 a=PO7r1zJSAAAA:8 a=NDY59GnS80oA:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=Aet6fyW9sl8A:10 a=6I5d2MoRAAAA:8 a=od-9X6DuggoViU2ME3QA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2013 11:00:12 -0000 On Mon, 29 Jul 2013, David Chisnall wrote: > Author: theraven > Date: Mon Jul 29 08:32:13 2013 > New Revision: 253764 > URL: http://svnweb.freebsd.org/changeset/base/253764 > > Log: > Reenable the isnan(double) / isinf(double) declarations when targeting C89 + SUSv2 mode. This isn't reenabling. but breaks the isnan() and isinf() macros by #undefing them. > Modified: > head/lib/msun/src/math.h > > Modified: head/lib/msun/src/math.h > ============================================================================== > --- head/lib/msun/src/math.h Mon Jul 29 08:08:43 2013 (r253763) > +++ head/lib/msun/src/math.h Mon Jul 29 08:32:13 2013 (r253764) > @@ -209,6 +209,21 @@ __inline_isnanl(__const long double __x) > return (__x != __x); > } > > +/* > + * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and > + * isinf() as functions taking double. C99, and the subsequent POSIX revisions > + * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating > + * point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we > + * expose the newer definition, assuming that the language spec takes > + * precedence over the operating system interface spec. > + */ > +#if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999 > +#undef isinf > +#undef isnan > +int isinf(double); > +int isnan(double); > +#endif > + Old versions declared these functions by temporarily hiding the macro definitions using parentheses, and also sorted the declarations differently (into the __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE section. The __ISO_C_VISIBLE part of that ifdef is not quite broken for these functions, since although they aren't in C99, I think only non-conforming code can use them as functions). If the above ifdef is correct, then it is still unsorted. Other ifdefs for fine-grained XSI ifdefs are sorted later, in ascending order on __XSI_VISIBLE. The others are written with slightly unclear nested conditions for __XSI_VISIBLE: @ #if __BSD_VISIBLE || __XSI_VISIBLE Boolean conditions. You obfuscate the boolean condition __XSI_VISIBLE by writing it as __XSI_VISIBLE > 0. @ double j0(double); @ double j1(double); @ double jn(int, double); @ double y0(double); @ double y1(double); @ double yn(int, double); @ @ #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE Now the same boolean condition for the __BSD_VISIBLE part (obfuscated by writing the conditions in the opposite order), but a further restriction for the __XSI_VISIBLE part. __XSI_VISIBLE <= 500 by itself would be broken since it would be satisfied by __XSI_VISIBLE == 0 which means non-XSI. @ double gamma(double); @ #endif @ @ #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE As above, for a later XSI. You obfuscate the version tests further using '<' instead of '<='. '< 600' does make more sense than '<= 500', since if 5 and 6 represent major releases then API changes should occur at 600 not at 501. @ double scalb(double, double); @ #endif @ #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ > double acos(double); > double asin(double); > double atan(double); > Bruce