changeset 38917:35d659fed9b4

math: Fix test failure on Haiku.
author Bruno Haible <bruno@clisp.org>
date Sun, 29 Oct 2017 10:49:55 +0100
parents cd465b2c1dbe
children 9675e3175444
files ChangeLog doc/posix-headers/math.texi lib/math.in.h m4/ilogb.m4 m4/ilogbf.m4
diffstat 5 files changed, 44 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 29 16:59:17 2017 +0100
+++ b/ChangeLog	Sun Oct 29 10:49:55 2017 +0100
@@ -1,3 +1,11 @@
+2017-10-29  Bruno Haible  <bruno@clisp.org>
+
+	math: Fix test failure on Haiku.
+	* lib/math.in.h (FP_ILOGB0, FP_ILOGBNAN): Override on Haiku.
+	* m4/ilogb.m4 (gl_FUNC_ILOGB_WORKS): Update accordingly.
+	* m4/ilogbf.m4 (gl_FUNC_ILOGBF_WORKS): Likewise.
+	* doc/posix-headers/math.texi: Mention the Haiku problem.
+
 2017-10-29  Bruno Haible  <bruno@clisp.org>
 
 	gnulib-tool: Avoid unnecessary config.h.in remaking in testdirs.
--- a/doc/posix-headers/math.texi	Sun Oct 29 16:59:17 2017 +0100
+++ b/doc/posix-headers/math.texi	Sun Oct 29 10:49:55 2017 +0100
@@ -37,6 +37,11 @@
 NetBSD 5.1, AIX 5.1, IRIX 6.5, Solaris 9, MSVC 9.
 
 @item
+The macros @code{FP_ILOGB0} and @code{FP_ILOGBNAN} have wrong values on some
+platforms:
+Haiku 2017.
+
+@item
 The macros @code{NAN}, @code{HUGE_VALL}, and @code{INFINITY} are not
 defined on some platforms:
 OpenVMS.
--- a/lib/math.in.h	Sun Oct 29 16:59:17 2017 +0100
+++ b/lib/math.in.h	Sun Oct 29 10:49:55 2017 +0100
@@ -194,8 +194,17 @@
 #endif
 
 
-/* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined.  */
-#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
+#if defined FP_ILOGB0 && defined FP_ILOGBNAN
+ /* Ensure FP_ILOGB0 and FP_ILOGBNAN are correct.  */
+# if defined __HAIKU__
+  /* Haiku: match what ilogb() does */
+#  undef FP_ILOGB0
+#  undef FP_ILOGBNAN
+#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
+#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
+#else
+ /* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined.  */
 # if defined __NetBSD__ || defined __sgi
   /* NetBSD, IRIX 6.5: match what ilogb() does */
 #  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
--- a/m4/ilogb.m4	Sun Oct 29 16:59:17 2017 +0100
+++ b/m4/ilogb.m4	Sun Oct 29 10:49:55 2017 +0100
@@ -1,4 +1,4 @@
-# ilogb.m4 serial 2
+# ilogb.m4 serial 3
 dnl Copyright (C) 2010-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -57,7 +57,15 @@
 #include <limits.h>
 #include <math.h>
 /* Provide FP_ILOGB0, FP_ILOGBNAN, like in math.in.h.  */
-#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
+#if defined FP_ILOGB0 && defined FP_ILOGBNAN
+# if defined __HAIKU__
+  /* Haiku: match what ilogb() does */
+#  undef FP_ILOGB0
+#  undef FP_ILOGBNAN
+#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
+#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
+#else
 # if defined __NetBSD__ || defined __sgi
   /* NetBSD, IRIX 6.5: match what ilogb() does */
 #  define FP_ILOGB0   INT_MIN
--- a/m4/ilogbf.m4	Sun Oct 29 16:59:17 2017 +0100
+++ b/m4/ilogbf.m4	Sun Oct 29 10:49:55 2017 +0100
@@ -1,4 +1,4 @@
-# ilogbf.m4 serial 2
+# ilogbf.m4 serial 3
 dnl Copyright (C) 2010-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -59,7 +59,15 @@
 #include <limits.h>
 #include <math.h>
 /* Provide FP_ILOGB0, FP_ILOGBNAN, like in math.in.h.  */
-#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
+#if defined FP_ILOGB0 && defined FP_ILOGBNAN
+# if defined __HAIKU__
+  /* Haiku: match what ilogb() does */
+#  undef FP_ILOGB0
+#  undef FP_ILOGBNAN
+#  define FP_ILOGB0   (- 2147483647 - 1) /* INT_MIN */
+#  define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
+#else
 # if defined __NetBSD__ || defined __sgi
   /* NetBSD, IRIX 6.5: match what ilogbf() does */
 #  define FP_ILOGB0   INT_MIN