Subject: Re: pkg/36356
To: None <markd@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,>
From: Raymond Meyer <raymond.meyer@rambler.ru>
List: pkgsrc-bugs
Date: 06/10/2007 12:20:03
The following reply was made to PR pkg/36356; it has been noted by GNATS.
From: Raymond Meyer <raymond.meyer@rambler.ru>
To: <gnats-bugs@NetBSD.org>
Cc: <mark@mcs.vuw.ac.nz>
Subject: Re: pkg/36356
Date: Sun, 10 Jun 2007 16:15:02 +0400
Mark, the patch that you incorporated into 3.5.7 is not entirely
correct. The problem on Solaris is isinf() and friends are declared as
macros via math.h header. If you compile with gcc and -std=c99 flag then
the macros are included, without the flag the macros are not included
and compilation fails. If you run g++ then the comiler does not seem to
pick up those macros no matter what you do, so C++ programs fail to
compile in all cases. Some gcc compilers assume -std=c99 by default, in
which case tests for isinf() succeed and later C++ code that has calls
to isinf() fails to compile.
I think the correct patch would be to test if isnan() and isinf() are
functions or macros. A way to do it is to declare a pointer to function
isnan() or isinf(), this will fail to compile if they are macros:
diff -u configure.orig configure
--- configure.orig Sun Jun 10 13:05:55 2007
+++ configure Sun Jun 10 13:08:44 2007
@@ -56721,10 +56721,11 @@
/* end confdefs.h. */
#include <math.h>
float f;
+int (*isnan_ptr)(float) = &isnan;
int
main ()
{
-return isnan(f)
+return isnan_ptr(f)
;
return 0;
}
@@ -56796,10 +56797,11 @@
/* end confdefs.h. */
#include <math.h>
float f;
+int (*isinf_ptr)(float) = &isinf;
int
main ()
{
-return isinf(f)
+return isinf_ptr(f)
;
return 0;
}