And on mingw 5.0, I see this test failure:
FAIL: test-math =============== ../../gltests/test-math.c:103: assertion 'sizeof (INFINITY) == sizeof (float)' failed FAIL test-math.exe (exit status: 3) And once this is fixed, likewise for NAN. This patch fixes it. 2024-08-07 Bruno Haible <[email protected]> math: Fix INFINITY and NAN on mingw. * doc/posix-headers/math.texi: Mention this mingw bug. * lib/math.in.h (INFINITY, NAN): Replace also on mingw. diff --git a/doc/posix-headers/math.texi b/doc/posix-headers/math.texi index 6f07b1e58c..fb72b94a08 100644 --- a/doc/posix-headers/math.texi +++ b/doc/posix-headers/math.texi @@ -55,7 +55,7 @@ @item @code{INFINITY} and @code{NAN} are of type @code{double} instead of @code{float} on some platforms: -FreeBSD 7.1. +FreeBSD 7.1, mingw 5.0. @item The macros @code{NAN}, @code{HUGE_VALL}, and @code{INFINITY} are not diff --git a/lib/math.in.h b/lib/math.in.h index 7b1302d883..2fcba31c76 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -161,7 +161,7 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq; /* Ensure that INFINITY is a constant expression, of type 'float'. */ -#if !defined INFINITY || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX +#if !defined INFINITY || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__ # undef INFINITY # if defined __GNUC__ || defined __clang__ # define INFINITY (__builtin_inff ()) @@ -176,7 +176,7 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq; it on platforms like Solaris 10, where NAN is present but defined as a function pointer rather than a floating point constant. Also ensure that it is a constant expression, of type 'float'. */ -#if !defined NAN || @REPLACE_NAN@ || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX +#if !defined NAN || @REPLACE_NAN@ || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__ # if !GNULIB_defined_NAN # undef NAN /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
