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 8bb49e2..a07c894 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 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.
        * lib/arpa_inet.in.h: Encloses reference to PRAGMA_SYSTEM_HEADER so
        that it gets activated only for gcc >= 3.0.
index 40ef49c..6e7eb13 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 2fa6ca1..49e0c65 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 f090c9c..9a8e5a8 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 f98bf51..91f2d67 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 bb925cb..b5fa112 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 1315475..8567f39 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 4b5ea32..272fc4f 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 88cb854..1da3f44 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 94cab37..d6efe08 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 58dfbe2..09b1867 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 3caf49f..5fb9250 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 384300f..4b00e35 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 aa537fb..bf12548 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 703b24f..f8314f4 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.  */