Commit fd0c03c6 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcr120: Add feclearexcept.

parent 5fd51250
......@@ -87,7 +87,7 @@
@ cdecl _wsystem(wstr) ucrtbase._wsystem
@ cdecl abort() ucrtbase.abort
@ cdecl exit(long) ucrtbase.exit
@ stub feclearexcept
@ cdecl feclearexcept(long) ucrtbase.feclearexcept
@ cdecl fegetenv(ptr) ucrtbase.fegetenv
@ stub fegetexceptflag
@ cdecl fegetround() ucrtbase.fegetround
......
......@@ -2143,7 +2143,7 @@
@ cdecl fdim(double double)
@ cdecl fdimf(float float)
@ cdecl fdiml(double double) fdim
@ stub feclearexcept
@ cdecl feclearexcept(long)
@ cdecl fegetenv(ptr)
@ stub fegetexceptflag
@ cdecl fegetround()
......
......@@ -184,6 +184,7 @@ static int (CDECL *p_fegetround)(void);
static int (CDECL *p_fesetround)(int);
static int (CDECL *p_fesetexceptflag)(const fexcept_t*,int);
static int (CDECL *p_fetestexcept)(int);
static int (CDECL *p_feclearexcept)(int);
static int (CDECL *p__clearfp)(void);
static _locale_t (__cdecl *p_wcreate_locale)(int, const wchar_t *);
static void (__cdecl *p_free_locale)(_locale_t);
......@@ -261,6 +262,7 @@ static BOOL init(void)
SET(p_fesetround, "fesetround");
SET(p_fesetexceptflag, "fesetexceptflag");
SET(p_fetestexcept, "fetestexcept");
SET(p_feclearexcept, "feclearexcept");
SET(p__clearfp, "_clearfp");
SET(p_vsscanf, "vsscanf");
......@@ -854,6 +856,11 @@ static void test_feenv(void)
except = p_fetestexcept(FE_ALL_EXCEPT);
ok(except == (FE_INEXACT|FE_UNDERFLOW), "expected %x, got %lx\n", FE_INEXACT|FE_UNDERFLOW, except);
ret = p_feclearexcept(~FE_ALL_EXCEPT);
ok(!ret, "feclearexceptflag returned %x\n", ret);
except = p_fetestexcept(FE_ALL_EXCEPT);
ok(except == (FE_INEXACT|FE_UNDERFLOW), "expected %x, got %lx\n", FE_INEXACT|FE_UNDERFLOW, except);
/* no crash, but no-op */
ret = p_fesetexceptflag(NULL, 0);
ok(!ret, "fesetexceptflag returned %x\n", ret);
......@@ -885,7 +892,18 @@ static void test_feenv(void)
ok(ret == flags, "Test %d: expected %x, got %x\n", i, flags, ret);
}
p__clearfp();
for(i=0; i<ARRAY_SIZE(tests); i++) {
ret = p_feclearexcept(tests[i]);
ok(!ret, "Test %d: feclearexceptflag returned %x\n", i, ret);
flags &= ~tests[i];
except = p_fetestexcept(tests[i]);
ok(!except, "Test %d: expected %x, got %lx\n", i, flags, except);
}
except = p_fetestexcept(FE_ALL_EXCEPT);
ok(!except, "expected 0, got %lx\n", except);
/* setting bits with except */
for(i=0; i<ARRAY_SIZE(tests); i++) {
except = tests[i];
......@@ -909,7 +927,11 @@ static void test_feenv(void)
ret = p_fetestexcept(tests2[i].get);
ok(ret == tests2[i].expect, "Test %d: expected %lx, got %x\n", i, tests2[i].expect, ret);
}
p__clearfp();
ret = p_feclearexcept(FE_ALL_EXCEPT);
ok(!ret, "feclearexceptflag returned %x\n", ret);
except = p_fetestexcept(FE_ALL_EXCEPT);
ok(!except, "expected 0, got %lx\n", except);
}
static void test__wcreate_locale(void)
......
......@@ -1809,7 +1809,7 @@
@ cdecl fdim(double double) msvcr120.fdim
@ cdecl fdimf(float float) msvcr120.fdimf
@ cdecl fdiml(double double) msvcr120.fdiml
@ stub feclearexcept
@ cdecl feclearexcept(long) msvcr120.feclearexcept
@ cdecl fegetenv(ptr) msvcr120.fegetenv
@ stub fegetexceptflag
@ cdecl fegetround() msvcr120.fegetround
......
......@@ -2239,6 +2239,18 @@ int CDECL fesetexceptflag(const fexcept_t *status, int excepts)
env._Fe_stat |= (*status & excepts);
return fesetenv(&env);
}
/*********************************************************************
* feclearexcept (MSVCR120.@)
*/
int CDECL feclearexcept(int flags)
{
fenv_t env;
fegetenv(&env);
env._Fe_stat &= ~(flags & FE_ALL_EXCEPT);
return fesetenv(&env);
}
#endif
#if _MSVCR_VER>=140
......
......@@ -2286,7 +2286,7 @@
@ cdecl fdim(double double)
@ cdecl fdimf(float float)
@ cdecl fdiml(double double) fdim
@ stub feclearexcept
@ cdecl feclearexcept(long)
@ cdecl fegetenv(ptr)
@ stub fegetexceptflag
@ cdecl fegetround()
......
......@@ -37,6 +37,7 @@ _ACRTIMP int __cdecl fesetenv(const fenv_t*);
_ACRTIMP int __cdecl fegetround(void);
_ACRTIMP int __cdecl fesetround(int);
_ACRTIMP int __cdecl fesetexceptflag(const fexcept_t*, int);
_ACRTIMP int __cdecl feclearexcept(int);
_ACRTIMP int __cdecl fetestexcept(int);
#ifdef __cplusplus
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment