Date: Mon, 4 May 2009 13:29:16 +0200 From: Florian Forster <octo@verplant.org> To: freebsd-standards@freebsd.org Subject: isnan(3) not available in C99/POSIX2001 mode Message-ID: <20090504112916.GI25815@verplant.org>
next in thread | raw e-mail | index | archive | help
--1R7yw+ZU6pp3P8Kk Content-Type: multipart/mixed; boundary="86AcgArEE8aDdRDK" Content-Disposition: inline --86AcgArEE8aDdRDK Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I'm having problems compiling a C99 program and I believe this to be a problem in FreeBSD's libc. In <math.h> the macro `isnan' is defined. The macro checks the size of its argument to determine whether it's a float, double, or long double and calls `isnanf', `isnan', or `__isnanl' respectively. The problem is that the `isnan' macro is defined if `__ISO_C_VISIBLE >=3D 1999' but `isnanf' is only declared if `__BSD_VISIBLE' is defined. In my case (C99 and POSIX 2001 requested) this results in a syntax error: (The file `c99_nan.c' is attached.) [octo@collectd ~]$ c99 -D_POSIX_C_SOURCE=3D200112L -o c99_nan c99_nan.c=20 c99_nan.c: In function 'main': c99_nan.c:21: warning: implicit declaration of function 'isnanf' I was able to reproduce the problem on the following systems: - FreeBSD *** 7.0-STABLE FreeBSD 7.0-STABLE #3: Tue Jun 24 12:35:54 CEST 2= 008 ***:/usr/obj/usr/src/sys/SEHRKERN2 i386 - FreeBSD *** 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 14:37:25 UTC = 2009 ***:/usr/obj/usr/src/sys/GENERIC i386 The version information in /usr/include/math.h is: - $FreeBSD: src/lib/msun/src/math.h,v 1.62 2007/01/07 07:54:21 das Exp $ - $FreeBSD: src/lib/msun/src/math.h,v 1.62.6.1 2008/11/25 02:59:29 kensmit= h Exp $ The `c99' binary refused to give out any version information, but the installed version of GCC is 4.2.1 20070719. Using `gcc -std=3Dc99' does not result in different behavior from using `c99' as far as the syntax error is concerned. A quick search at <http://www.freebsd.org/cgi/query-pr-summary.cgi> did not yield any related bug reports. Please CC me on replies =E2=80=93 I'm not subscribed to this list. Regards, -octo --=20 Florian octo Forster Hacker in training GnuPG: 0x91523C3D http://verplant.org/ --86AcgArEE8aDdRDK-- --1R7yw+ZU6pp3P8Kk Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJ/tGMHdggu3Q05IYRAticAJ4+5/WIRKd5qqZNkmKi8U4PmdpV6ACgkT/N ZsldVi9kR5jss06T0qDVNPw= =VP74 -----END PGP SIGNATURE----- --1R7yw+ZU6pp3P8Kk--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090504112916.GI25815>