std.cfg: Added support for invalidFunctionArg check to tgamma(). (#5850)

Reference: https://en.cppreference.com/w/cpp/numeric/math/tgamma
This commit is contained in:
orbitcowboy 2024-01-06 14:59:43 +01:00 committed by GitHub
parent 32cabecca9
commit 71212c7d66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View File

@ -737,6 +737,7 @@
<not-uninit/> <not-uninit/>
</arg> </arg>
</function> </function>
<!-- https://en.cppreference.com/w/cpp/numeric/math/tgamma -->
<!-- double tgamma(double x); --> <!-- double tgamma(double x); -->
<function name="tgamma,std::tgamma"> <function name="tgamma,std::tgamma">
<use-retval/> <use-retval/>
@ -746,8 +747,11 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-uninit/> <not-uninit/>
<!-- If x is zero or a negative integer for which the function is asymptotic, it may cause a pole error (depending on implementation).-->
<valid>!0.0:</valid>
</arg> </arg>
</function> </function>
<!-- https://en.cppreference.com/w/cpp/numeric/math/tgamma -->
<!-- float tgammaf(float x); --> <!-- float tgammaf(float x); -->
<function name="tgammaf,std::tgammaf"> <function name="tgammaf,std::tgammaf">
<use-retval/> <use-retval/>
@ -757,8 +761,11 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-uninit/> <not-uninit/>
<!-- If x is zero or a negative integer for which the function is asymptotic, it may cause a pole error (depending on implementation).-->
<valid>!0.0:</valid>
</arg> </arg>
</function> </function>
<!-- https://en.cppreference.com/w/cpp/numeric/math/tgamma -->
<!-- long double tgammal(long double x); --> <!-- long double tgammal(long double x); -->
<function name="tgammal,std::tgammal"> <function name="tgammal,std::tgammal">
<use-retval/> <use-retval/>
@ -768,6 +775,8 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-uninit/> <not-uninit/>
<!-- If x is zero or a negative integer for which the function is asymptotic, it may cause a pole error (depending on implementation).-->
<valid>!0.0:</valid>
</arg> </arg>
</function> </function>
<!-- double trunc(double x); --> <!-- double trunc(double x); -->

View File

@ -2406,6 +2406,30 @@ void invalidFunctionArg_lgamma(float f, double d, long double ld)
(void)lgammal(0.1L); (void)lgammal(0.1L);
} }
void invalidFunctionArg_tgamma(float f, double d, long double ld)
{
(void)tgamma(d);
// cppcheck-suppress invalidFunctionArg
(void)tgamma(-0.1);
// cppcheck-suppress invalidFunctionArg
(void)tgamma(0.0);
(void)tgamma(0.1);
(void)tgammaf(f);
// cppcheck-suppress invalidFunctionArg
(void)tgammaf(-0.1f);
// cppcheck-suppress invalidFunctionArg
(void)tgammaf(0.0f);
(void)tgammaf(0.1f);
(void)tgammal(ld);
// cppcheck-suppress invalidFunctionArg
(void)tgammal(-0.1L);
// cppcheck-suppress invalidFunctionArg
(void)tgammal(0.0L);
(void)tgammal(0.1L);
}
void uninitvar_lgamma(void) void uninitvar_lgamma(void)
{ {
float f; float f;