From 9d5d03ff00b8b11b51450ce107159b263efb1739 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 18 Oct 2008 03:15:17 +0200 Subject: [PATCH] Avoid compilation error due to MacOS X 10.5 gcc cross-compilation bug. --- ChangeLog | 20 ++++++++++++++++++++ m4/signbit.m4 | 6 ++++-- tests/test-ceill.c | 8 +++++++- tests/test-floorl.c | 8 +++++++- tests/test-frexpl.c | 8 +++++++- tests/test-isnan.c | 8 +++++++- tests/test-isnanl.h | 8 +++++++- tests/test-ldexpl.c | 8 +++++++- tests/test-roundl.c | 8 +++++++- tests/test-signbit.c | 8 +++++++- tests/test-snprintf-posix.h | 8 +++++++- tests/test-sprintf-posix.h | 8 +++++++- tests/test-truncl.c | 8 +++++++- tests/test-vasnprintf-posix.c | 8 +++++++- tests/test-vasprintf-posix.c | 8 +++++++- 15 files changed, 115 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8bb49e288..a07c894fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 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. * lib/arpa_inet.in.h: Encloses reference to PRAGMA_SYSTEM_HEADER so that it gets activated only for gcc >= 3.0. diff --git a/m4/signbit.m4 b/m4/signbit.m4 index 40ef49c67..6e7eb1341 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 2fa6ca12d..49e0c6519 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 f090c9cb2..9a8e5a800 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 f98bf5131..91f2d6723 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 bb925cb14..b5fa11243 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 13154758b..8567f39ec 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 4b5ea3246..272fc4f0c 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 88cb854e7..1da3f4416 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 94cab3767..d6efe08b0 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 58dfbe287..09b186782 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 3caf49fe0..5fb9250c1 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 384300fc6..4b00e350a 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 aa537fbd7..bf125480a 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 703b24f18..f8314f46b 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. */ -- 2.11.0