Avoid compilation error due to MacOS X 10.5 gcc cross-compilation bug.
authorBruno Haible <bruno@clisp.org>
Sat, 18 Oct 2008 01:15:17 +0000 (03:15 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 18 Oct 2008 01:15:17 +0000 (03:15 +0200)
15 files changed:
ChangeLog
m4/signbit.m4
tests/test-ceill.c
tests/test-floorl.c
tests/test-frexpl.c
tests/test-isnan.c
tests/test-isnanl.h
tests/test-ldexpl.c
tests/test-roundl.c
tests/test-signbit.c
tests/test-snprintf-posix.h
tests/test-sprintf-posix.h
tests/test-truncl.c
tests/test-vasnprintf-posix.c
tests/test-vasprintf-posix.c

index 8bb49e2884f13d875220f123efafc30d0a2ef21d..a07c894fcc8f9a588a9a482e09a5a40609d0e182 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2008-10-17  Bruno Haible  <bruno@clisp.org>
+
+       * 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 <armbru@redhat.com> via Jim Meyering
+       and by Nelson H. F. Beebe <beebe@math.utah.edu> via Eric Blake.
+
 2008-10-17  Bruno Haible  <bruno@clisp.org>
 
        Avoid gcc warnings because of #pragma GCC system_header on older gcc.
index 40ef49c67a234dc8b5baf7babd7cfa62ee7f856b..6e7eb13415406c610bf592f5979c2334a2409d1a 100644 (file)
@@ -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;
index 2fa6ca12d7491ee1d9678b27f21ce9cf561a08c9..49e0c6519e708beaa0bf546c24273aefb912bda4 100644 (file)
   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 ()
index f090c9cb2f562143503dac82568a3f387caf5be4..9a8e5a800767b2c9fb99787e1232d7c6e03f88cc 100644 (file)
   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 ()
index f98bf513139c348d1f8f98eac58b4d97c16979e4..91f2d6723b14adc783ac12d86698a1c9154e1bf2 100644 (file)
 #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)
index bb925cb1469995fe990c55751c21b34f2e7b2f68..b5fa11243ac2e58a291d27022aae92c72bf18f7e 100644 (file)
@@ -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)
index 13154758bb725a1649ac0a5d42fcdc7b0b60c385..8567f39eca139dbf66bda92ae301f7c63a0cbc1d 100644 (file)
   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 ()
index 4b5ea32462d4ac3512373142ee47621656fe9531..272fc4f0cf2c92691e17d4e3086075e808f7b15e 100644 (file)
   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 ()
index 88cb854e79b322c27f28bd0426722d75c111b812..1da3f441663bc20b1b8f3db1d7fb60de7794a71b 100644 (file)
   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 ()
index 94cab376721c68bfe087e4b064e29c76df47532c..d6efe08b09c9b0e2a2283c14a410f7dea8432cbc 100644 (file)
@@ -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 ()
index 58dfbe287b0b6d1dd6a2fdd3483f9a6015142392..09b1867826ecf1e13ddef20877d0022972d38a0c 100644 (file)
@@ -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.  */
index 3caf49fe0570c65743c521c5d268498a991d0db9..5fb9250c101a23304c0741762431f778a4b9478f 100644 (file)
@@ -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.  */
index 384300fc6d19be030038bbcdc31b3cf65543c582..4b00e350ac7fa1b492362f2cfb5a7807483aefb4 100644 (file)
   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 ()
index aa537fbd74dd4e6da5bb28064db1126578eaf7be..bf125480ae58a86e97d0be59c86ce55e2406a5e8 100644 (file)
@@ -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.  */
index 703b24f188960b38bc1e0fa2e918d59ba94d52a0..f8314f46ba5c6655bc32b8b34bfcd7e6d5704708 100644 (file)
@@ -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.  */