Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<!-- https://cplusplus.com/reference/cmath/lgamma/ -->
<!-- double lgamma(double x); -->
<function name="lgamma,std::lgamma">
<use-retval/>
Expand All @@ -3044,8 +3045,11 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<leak-ignore/>
<arg nr="1" direction="in">
<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>
</function>
<!-- https://cplusplus.com/reference/cmath/lgamma/ -->
<!-- float lgammaf(float x); -->
<function name="lgammaf,std::lgammaf">
<use-retval/>
Expand All @@ -3055,8 +3059,11 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<leak-ignore/>
<arg nr="1" direction="in">
<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>
</function>
<!-- https://cplusplus.com/reference/cmath/lgamma/ -->
<!-- long double lgammal(long double x); -->
<function name="lgammal,std::lgammal">
<use-retval/>
Expand All @@ -3066,6 +3073,8 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<leak-ignore/>
<arg nr="1" direction="in">
<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>
</function>
<!-- double rint(double x); -->
Expand Down
24 changes: 24 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2382,6 +2382,30 @@ void uninitvar_ldexp(void)
(void)std::ldexp(ldc,e3);
}

void invalidFunctionArg_lgamma(float f, double d, long double ld)
{
(void)lgamma(d);
// cppcheck-suppress invalidFunctionArg
(void)lgamma(-0.1);
// cppcheck-suppress invalidFunctionArg
(void)lgamma(0.0);
(void)lgamma(0.1);

(void)lgammaf(f);
// cppcheck-suppress invalidFunctionArg
(void)lgammaf(-0.1f);
// cppcheck-suppress invalidFunctionArg
(void)lgammaf(0.0f);
(void)lgammaf(0.1f);

(void)lgammal(ld);
// cppcheck-suppress invalidFunctionArg
(void)lgammal(-0.1L);
// cppcheck-suppress invalidFunctionArg
(void)lgammal(0.0L);
(void)lgammal(0.1L);
}

void uninitvar_lgamma(void)
{
float f;
Expand Down