[PATCH 1/2] msvcrt: Use isnan instead of isnanf
Alex Henrie
alexhenrie24 at gmail.com
Tue Sep 25 22:03:02 CDT 2018
This resolves several warnings when compiling with MinGW because isnanf
is not in MinGW's math.h (it's not a standard C function). On the other
hand, isnan is a widely available C99 macro designed for both floats and
doubles. We also have an isnan implementation in libs/port/isnan.c for
pre-C99 compilers.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
configure.ac | 1 -
dlls/msvcrt/math.c | 30 +++++++++++-------------------
2 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6936a71b6f..2cc481630c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2163,7 +2163,6 @@ AC_CHECK_FUNCS(\
getpwuid \
gettimeofday \
getuid \
- isnanf \
kqueue \
lstat \
memmove \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index a1ba552632..dbfaa24756 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -38,14 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define finitef(x) isfinite(x)
#endif
-#ifndef HAVE_ISNANF
-#ifdef HAVE_ISNAN
-#define isnanf(x) isnan(x)
-#else
-#define isnanf(x) 0
-#endif
-#endif
-
/* FIXME: Does not work with -NAN and -0. */
#ifndef signbit
#define signbit(x) ((x) < 0)
@@ -190,7 +182,7 @@ INT CDECL MSVCRT__isnanf( float num )
/* Some implementations return -1 for true(glibc), msvcrt/crtdll return 1.
* Do the same, as the result may be used in calculations
*/
- return isnanf(num) != 0;
+ return isnan(num) != 0;
}
/*********************************************************************
@@ -199,7 +191,7 @@ INT CDECL MSVCRT__isnanf( float num )
float CDECL MSVCRT__logbf( float num )
{
float ret = logbf(num);
- if (isnanf(num)) math_error(_DOMAIN, "_logbf", num, 0, ret);
+ if (isnan(num)) math_error(_DOMAIN, "_logbf", num, 0, ret);
else if (!num) math_error(_SING, "_logbf", num, 0, ret);
return ret;
}
@@ -245,7 +237,7 @@ float CDECL MSVCRT_atanf( float x )
float CDECL MSVCRT_atan2f( float x, float y )
{
float ret = atan2f(x, y);
- if (isnanf(x)) math_error(_DOMAIN, "atan2f", x, y, ret);
+ if (isnan(x)) math_error(_DOMAIN, "atan2f", x, y, ret);
return ret;
}
@@ -265,7 +257,7 @@ float CDECL MSVCRT_cosf( float x )
float CDECL MSVCRT_coshf( float x )
{
float ret = coshf(x);
- if (isnanf(x)) math_error(_DOMAIN, "coshf", x, 0, ret);
+ if (isnan(x)) math_error(_DOMAIN, "coshf", x, 0, ret);
return ret;
}
@@ -275,7 +267,7 @@ float CDECL MSVCRT_coshf( float x )
float CDECL MSVCRT_expf( float x )
{
float ret = expf(x);
- if (isnanf(x)) math_error(_DOMAIN, "expf", x, 0, ret);
+ if (isnan(x)) math_error(_DOMAIN, "expf", x, 0, ret);
else if (finitef(x) && !ret) math_error(_UNDERFLOW, "expf", x, 0, ret);
else if (finitef(x) && !finitef(ret)) math_error(_OVERFLOW, "expf", x, 0, ret);
return ret;
@@ -342,7 +334,7 @@ float CDECL MSVCRT_sinf( float x )
float CDECL MSVCRT_sinhf( float x )
{
float ret = sinhf(x);
- if (isnanf(x)) math_error(_DOMAIN, "sinhf", x, 0, ret);
+ if (isnan(x)) math_error(_DOMAIN, "sinhf", x, 0, ret);
return ret;
}
@@ -2943,9 +2935,9 @@ LDOUBLE CDECL MSVCR120_erfcl(LDOUBLE x)
*/
float CDECL MSVCR120_fmaxf(float x, float y)
{
- if(isnanf(x))
+ if(isnan(x))
return y;
- if(isnanf(y))
+ if(isnan(y))
return x;
if(x==0 && y==0)
return signbit(x) ? y : x;
@@ -3008,9 +3000,9 @@ int CDECL MSVCR120__fdpcomp(float x, float y)
*/
float CDECL MSVCR120_fminf(float x, float y)
{
- if(isnanf(x))
+ if(isnan(x))
return y;
- if(isnanf(y))
+ if(isnan(y))
return x;
if(x==0 && y==0)
return signbit(x) ? x : y;
@@ -3232,7 +3224,7 @@ float CDECL MSVCR120_remainderf(float x, float y)
#ifdef HAVE_REMAINDERF
/* this matches 64-bit Windows. 32-bit Windows is slightly different */
if(!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
- if(isnanf(y) || y==0.0f) *MSVCRT__errno() = MSVCRT_EDOM;
+ if(isnan(y) || y==0.0f) *MSVCRT__errno() = MSVCRT_EDOM;
return remainderf(x, y);
#else
FIXME( "not implemented\n" );
--
2.19.0
More information about the wine-devel
mailing list