Ian Lance Taylor <i...@google.com> writes: >> Unfortunately, this breaks the libgo build on Solaris 8 and 9: >> >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c: In function >> 'matherr': >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:38:17: error: 'NAN' >> undeclared (first use in this function) >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:38:17: note: each >> undeclared identifier is reported only once for each function it appears in >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:68:28: error: >> 'INFINITY' undeclared (first use in this function) >> make[4]: *** [go-matherr.lo] Error 1 >> >> I couldn't find an appproprite replacement in the system headers. > > Hmmm, INFINITY and NAN are in C99.
True, but full C99 support was only introduced in Solaris 10. > Does it work to do something like > > #ifndef INFINITY > #define INFINITY (1.0 / 0.0) > #endif > > #ifndef NAN > #define NAN (0.0 / 0.0) > #endif > > ? I could give it a try once the current bootstraps are finished. For the moment I've shamelessly adapted the following from the __GNUC__ section of Solaris 11 <iso/math_c99.h>:
diff --git a/libgo/runtime/go-matherr.c b/libgo/runtime/go-matherr.c --- a/libgo/runtime/go-matherr.c +++ b/libgo/runtime/go-matherr.c @@ -24,6 +24,14 @@ #define PI 3.14159265358979323846264338327950288419716939937510582097494459 +#ifndef INFINITY +#define INFINITY (__builtin_inff ()) +#endif + +#ifndef NAN +#define NAN (__builtin_nanf ("")) +#endif + int matherr (struct exception* e) {
> Another possibility for NAN would to call nan(), if that is available. It's not, unfortunately. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University