]> Savannah Git Hosting - gnulib.git/commitdiff
isnanf, isnand: Fix conflict with Solaris <ieeefp.h>.
authorBruno Haible <bruno@clisp.org>
Fri, 13 Oct 2023 10:05:29 +0000 (12:05 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 5 Nov 2023 19:14:23 +0000 (20:14 +0100)
* lib/math.in.h (isnanf, isnand): On Solaris and IRIX, declare this
function, instead of defining it as a macro.

ChangeLog
lib/math.in.h

index 617ece86cbcf4449aec2c704b3d6dd725f89fbf7..8057a8cdfc7b49857b864772926b2410efb6d184 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-10-13  Bruno Haible  <bruno@clisp.org>
+
+       isnanf, isnand: Fix conflict with Solaris <ieeefp.h>.
+       * lib/math.in.h (isnanf, isnand): On Solaris and IRIX, declare this
+       function, instead of defining it as a macro.
+
 2023-10-08  Bruno Haible  <bruno@clisp.org>
 
        isfinite: Work around a bug with 'long double' in glibc 2.5/ia64.
index e559608a0eaa19cd7c62df86da95c146af4dbed0..7587e75b39e391845e7827cdbb69d70caa923e65 100644 (file)
@@ -2535,16 +2535,22 @@ _GL_WARN_REAL_FLOATING_DECL (isinf);
 #if @GNULIB_ISNANF@
 /* Test for NaN for 'float' numbers.  */
 # if @HAVE_ISNANF@
+#  if defined __sun || defined __sgi
+/* Solaris and IRIX have isnanf() and declare it in <ieeefp.h>.  We cannot
+   define isnanf as a macro, because that would conflict with <ieeefp.h>.  */
+_GL_EXTERN_C int isnanf (float x);
+#  else
 /* The original <math.h> included above provides a declaration of isnan macro
    or (older) isnanf function.  */
-#  if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+#   if (__GNUC__ >= 4) || (__clang_major__ >= 4)
     /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
        GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't.  */
-#   undef isnanf
-#   define isnanf(x) __builtin_isnan ((float)(x))
-#  elif defined isnan
-#   undef isnanf
-#   define isnanf(x) isnan ((float)(x))
+#    undef isnanf
+#    define isnanf(x) __builtin_isnan ((float)(x))
+#   elif defined isnan
+#    undef isnanf
+#    define isnanf(x) isnan ((float)(x))
+#   endif
 #  endif
 # else
 /* Test whether X is a NaN.  */
@@ -2559,15 +2565,21 @@ _GL_EXTERN_C int isnanf (float x);
    This function is a gnulib extension, unlike isnan() which applied only
    to 'double' numbers earlier but now is a type-generic macro.  */
 # if @HAVE_ISNAND@
+#  if defined __sun || defined __sgi
+/* Solaris and IRIX have isnand() and declare it in <ieeefp.h>.  We cannot
+   define isnand as a macro, because that would conflict with <ieeefp.h>.  */
+_GL_EXTERN_C int isnand (double x);
+#  else
 /* The original <math.h> included above provides a declaration of isnan
    macro.  */
-#  if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+#   if (__GNUC__ >= 4) || (__clang_major__ >= 4)
     /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.  */
-#   undef isnand
-#   define isnand(x) __builtin_isnan ((double)(x))
-#  else
-#   undef isnand
-#   define isnand(x) isnan ((double)(x))
+#    undef isnand
+#    define isnand(x) __builtin_isnan ((double)(x))
+#   else
+#    undef isnand
+#    define isnand(x) isnan ((double)(x))
+#   endif
 #  endif
 # else
 /* Test whether X is a NaN.  */