From: Bruno Haible Date: Sat, 18 Oct 2008 01:15:17 +0000 (+0200) Subject: Avoid compilation error due to MacOS X 10.5 gcc cross-compilation bug. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d5d03ff00b8b11b51450ce107159b263efb1739;p=pspp Avoid compilation error due to MacOS X 10.5 gcc cross-compilation bug. --- diff --git a/ChangeLog b/ChangeLog index 8bb49e2884..a07c894fcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2008-10-17 Bruno Haible + + * m4/signbit.m4 (gl_SIGNBIT_TEST_PROGRAM): On platforms other than + HP-UX and IRIX, use -0.0L. + * tests/test-ceill.c (minus_zero): Likewise. + * tests/test-floorl.c (minus_zero): Likewise. + * tests/test-frexpl.c (minus_zero): Likewise. + * tests/test-isnan.c (minus_zerol): Likewise. + * tests/test-isnanl.h (minus_zero): Likewise. + * tests/test-ldexpl.c (minus_zero): Likewise. + * tests/test-roundl.c (minus_zero): Likewise. + * tests/test-signbit.c (minus_zerol): Likewise. + * tests/test-snprintf-posix.h (minus_zerol): Likewise. + * tests/test-sprintf-posix.h (minus_zerol): Likewise. + * tests/test-truncl.c (minus_zero): Likewise. + * tests/test-vasnprintf-posix.c (minus_zerol): Likewise. + * tests/test-vasprintf-posix.c (minus_zerol): Likewise. + Reported by Markus Armbruster via Jim Meyering + and by Nelson H. F. Beebe via Eric Blake. + 2008-10-17 Bruno Haible Avoid gcc warnings because of #pragma GCC system_header on older gcc. diff --git a/m4/signbit.m4 b/m4/signbit.m4 index 40ef49c67a..6e7eb13415 100644 --- a/m4/signbit.m4 +++ b/m4/signbit.m4 @@ -131,9 +131,11 @@ float m0f = -p0f; double p0d = 0.0; double m0d = -p0d; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use another constant expression instead. */ + So we use another constant expression instead. + But that expression does not work on other platforms, such as when + cross-compiling to PowerPC on MacOS X 10.5. */ long double p0l = 0.0L; -#ifdef __hpux +#if defined __hpux || defined __sgi long double m0l = -LDBL_MIN * LDBL_MIN; #else long double m0l = -p0l; diff --git a/tests/test-ceill.c b/tests/test-ceill.c index 2fa6ca12d7..49e0c6519e 100644 --- a/tests/test-ceill.c +++ b/tests/test-ceill.c @@ -40,8 +40,14 @@ while (0) /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zero instead. */ + So we use minus_zero instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zero = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zero = -0.0L; +#endif int main () diff --git a/tests/test-floorl.c b/tests/test-floorl.c index f090c9cb2f..9a8e5a8007 100644 --- a/tests/test-floorl.c +++ b/tests/test-floorl.c @@ -40,8 +40,14 @@ while (0) /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zero instead. */ + So we use minus_zero instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zero = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zero = -0.0L; +#endif int main () diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index f98bf51313..91f2d6723b 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -58,8 +58,14 @@ #endif /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zero instead. */ + So we use minus_zero instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zero = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zero = -0.0L; +#endif static long double my_ldexp (long double x, int d) diff --git a/tests/test-isnan.c b/tests/test-isnan.c index bb925cb146..b5fa11243a 100644 --- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -49,8 +49,14 @@ float zerof = 0.0f; double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zerol instead. */ + So we use minus_zerol instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zerol = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zerol = -0.0L; +#endif static void test_float (void) diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index 13154758bb..8567f39eca 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -34,8 +34,14 @@ while (0) /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zero instead. */ + So we use minus_zero instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zero = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zero = -0.0L; +#endif int main () diff --git a/tests/test-ldexpl.c b/tests/test-ldexpl.c index 4b5ea32462..272fc4f0cf 100644 --- a/tests/test-ldexpl.c +++ b/tests/test-ldexpl.c @@ -40,8 +40,14 @@ while (0) /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zero instead. */ + So we use minus_zero instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zero = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zero = -0.0L; +#endif int main () diff --git a/tests/test-roundl.c b/tests/test-roundl.c index 88cb854e79..1da3f44166 100644 --- a/tests/test-roundl.c +++ b/tests/test-roundl.c @@ -42,8 +42,14 @@ while (0) /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zero instead. */ + So we use minus_zero instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zero = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zero = -0.0L; +#endif int main () diff --git a/tests/test-signbit.c b/tests/test-signbit.c index 94cab37672..d6efe08b09 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -48,8 +48,14 @@ long double zerol = 0.0L; So we use -zerod instead. */ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zerol instead. */ + So we use minus_zerol instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zerol = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zerol = -0.0L; +#endif static void test_signbitf () diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h index 58dfbe287b..09b1867826 100644 --- a/tests/test-snprintf-posix.h +++ b/tests/test-snprintf-posix.h @@ -32,8 +32,14 @@ have_minus_zero () double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zerol instead. */ + So we use minus_zerol instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zerol = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zerol = -0.0L; +#endif /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ diff --git a/tests/test-sprintf-posix.h b/tests/test-sprintf-posix.h index 3caf49fe05..5fb9250c10 100644 --- a/tests/test-sprintf-posix.h +++ b/tests/test-sprintf-posix.h @@ -32,8 +32,14 @@ have_minus_zero () double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zerol instead. */ + So we use minus_zerol instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zerol = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zerol = -0.0L; +#endif /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ diff --git a/tests/test-truncl.c b/tests/test-truncl.c index 384300fc6d..4b00e350ac 100644 --- a/tests/test-truncl.c +++ b/tests/test-truncl.c @@ -40,8 +40,14 @@ while (0) /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zero instead. */ + So we use minus_zero instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zero = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zero = -0.0L; +#endif int main () diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index aa537fbd74..bf125480ae 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -57,8 +57,14 @@ have_minus_zero () double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zerol instead. */ + So we use minus_zerol instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zerol = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zerol = -0.0L; +#endif /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c index 703b24f188..f8314f46ba 100644 --- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -57,8 +57,14 @@ have_minus_zero () double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. - So we use minus_zerol instead. */ + So we use minus_zerol instead. + Note that the expression -LDBL_MIN * LDBL_MIN does not work on other + platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ +#if defined __hpux || defined __sgi long double minus_zerol = -LDBL_MIN * LDBL_MIN; +#else +long double minus_zerol = -0.0L; +#endif /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */