std.cfg: Improved configuration of fesetexceptflag() and fetestexcept().

This commit is contained in:
orbitcowboy 2022-05-05 15:05:46 +02:00
parent 9b807ba047
commit f3ae729f89
3 changed files with 72 additions and 0 deletions

View File

@ -648,6 +648,8 @@
</arg> </arg>
<arg nr="2" direction="in"> <arg nr="2" direction="in">
<not-uninit/> <not-uninit/>
<!-- Note: flag values (FE_ALL_EXCEPT,FE_DIVBYZERO, etc.) are defined in this file -->
<valid>1:31</valid>
</arg> </arg>
</function> </function>
<!-- int fesetround(int rdir); --> <!-- int fesetround(int rdir); -->
@ -666,6 +668,8 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-uninit/> <not-uninit/>
<!-- Note: flag values (FE_ALL_EXCEPT,FE_DIVBYZERO, etc.) are defined in this file -->
<valid>1:31</valid>
</arg> </arg>
</function> </function>
<!-- int feupdateenv(const fenv_t* envp); --> <!-- int feupdateenv(const fenv_t* envp); -->
@ -8546,4 +8550,11 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<define name="SEEK_CUR" value="1"/> <define name="SEEK_CUR" value="1"/>
<define name="SEEK_END" value="2"/> <define name="SEEK_END" value="2"/>
<define name="SEEK_SET" value="0"/> <define name="SEEK_SET" value="0"/>
<!-- https://en.cppreference.com/w/c/numeric/fenv/FE_exceptions -->
<define name="FE_INEXACT" value="1"/>
<define name="FE_UNDERFLOW" value="2"/>
<define name="FE_OVERFLOW" value="4"/>
<define name="FE_DIVBYZERO" value="8"/>
<define name="FE_INVALID" value="16"/>
<define name="FE_ALL_EXCEPT" value="31"/>
</def> </def>

View File

@ -4744,6 +4744,36 @@ void nullPointer_fesetexceptflag(int excepts)
(void)fesetexceptflag(0,excepts); (void)fesetexceptflag(0,excepts);
} }
void invalidFunctionArg_fesetexceptflag(fexcept_t* flagp, int excepts)
{
(void)fesetexceptflag(flagp, excepts);
// cppcheck-suppress invalidFunctionArg
(void)fesetexceptflag(flagp, 0);
(void)fesetexceptflag(flagp, FE_DIVBYZERO);
(void)fesetexceptflag(flagp, FE_INEXACT);
(void)fesetexceptflag(flagp, FE_INVALID);
(void)fesetexceptflag(flagp, FE_OVERFLOW);
(void)fesetexceptflag(flagp, FE_UNDERFLOW);
(void)fesetexceptflag(flagp, FE_ALL_EXCEPT);
// cppcheck-suppress invalidFunctionArg
(void)fesetexceptflag(flagp, FE_ALL_EXCEPT+1);
}
void invalidFunctionArg_fetestexcept(int excepts)
{
(void)fetestexcept(excepts);
// cppcheck-suppress invalidFunctionArg
(void)fetestexcept(0);
(void)fetestexcept(FE_DIVBYZERO);
(void)fetestexcept(FE_INEXACT);
(void)fetestexcept(FE_INVALID);
(void)fetestexcept(FE_OVERFLOW);
(void)fetestexcept(FE_UNDERFLOW);
(void)fetestexcept(FE_ALL_EXCEPT);
// cppcheck-suppress invalidFunctionArg
(void)fetestexcept(FE_ALL_EXCEPT+1);
}
void nullPointer_feupdateenv(void) void nullPointer_feupdateenv(void)
{ {
fenv_t* envp = 0; fenv_t* envp = 0;

View File

@ -32,6 +32,37 @@
#include <iterator> #include <iterator>
#include <vector> #include <vector>
void invalidFunctionArg_fesetexceptflag(fexcept_t* flagp, int excepts)
{
(void)std::fesetexceptflag(flagp, excepts);
// cppcheck-suppress invalidFunctionArg
(void)std::fesetexceptflag(flagp, 0);
(void)std::fesetexceptflag(flagp, FE_DIVBYZERO);
(void)std::fesetexceptflag(flagp, FE_INEXACT);
(void)std::fesetexceptflag(flagp, FE_INVALID);
(void)std::fesetexceptflag(flagp, FE_OVERFLOW);
(void)std::fesetexceptflag(flagp, FE_UNDERFLOW);
(void)std::fesetexceptflag(flagp, FE_ALL_EXCEPT);
// cppcheck-suppress invalidFunctionArg
(void)std::fesetexceptflag(flagp, FE_ALL_EXCEPT+1);
}
void invalidFunctionArg_fetestexcept(int excepts)
{
(void)std::fetestexcept(excepts);
// cppcheck-suppress invalidFunctionArg
(void)std::fetestexcept(0);
(void)std::fetestexcept(FE_DIVBYZERO);
(void)std::fetestexcept(FE_INEXACT);
(void)std::fetestexcept(FE_INVALID);
(void)std::fetestexcept(FE_OVERFLOW);
(void)std::fetestexcept(FE_UNDERFLOW);
(void)std::fetestexcept(FE_ALL_EXCEPT);
// cppcheck-suppress invalidFunctionArg
(void)std::fetestexcept(FE_ALL_EXCEPT+1);
}
int qsort_cmpfunc (const void * a, const void * b) { int qsort_cmpfunc (const void * a, const void * b) {
return (*static_cast<const int*>(a) - *static_cast<const int*>(b)); return (*static_cast<const int*>(a) - *static_cast<const int*>(b));
} }