Skip to content

Commit

Permalink
Merge branch 'main' into chr_12812
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Jun 20, 2024
2 parents feffeb7 + da6b55e commit 6ff44d7
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 12 deletions.
74 changes: 62 additions & 12 deletions cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3318,11 +3318,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
</arg>
</function>
<!-- int isfinite(double x); -->
<!-- bool isfinite(float x); // since C++11 -->
<!-- bool isfinite(double x); // since C++11 -->
<!-- bool isfinite(long double x); // since C++11 -->
<!-- bool isfinite(Integral x); // since C++11 -->
<function name="isfinite,std::isfinite">
<function name="isfinite">
<use-retval/>
<pure/>
<returnValue type="int"/>
Expand All @@ -3333,8 +3329,23 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-bool/>
</arg>
</function>
<!-- bool std::isfinite(float x); // since C++11 -->
<!-- bool std::isfinite(double x); // since C++11 -->
<!-- bool std::isfinite(long double x); // since C++11 -->
<!-- bool std::isfinite(Integral x); // since C++11 -->
<function name="std::isfinite">
<use-retval/>
<pure/>
<returnValue type="bool"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- int isgreater(double x, double y); -->
<function name="isgreater,std::isgreater">
<function name="isgreater">
<use-retval/>
<pure/>
<returnValue type="int">arg1&gt;arg2?1:0</returnValue>
Expand All @@ -3347,8 +3358,22 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<!-- bool std::isgreater(double x, double y); -->
<function name="std::isgreater">
<use-retval/>
<pure/>
<returnValue type="bool">arg1&gt;arg2?1:0</returnValue>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
</function>
<!-- int isgreaterequal(double x, double y); -->
<function name="isgreaterequal,std::isgreaterequal">
<function name="isgreaterequal">
<use-retval/>
<pure/>
<returnValue type="int">arg1 &gt;= arg2?1:0</returnValue>
Expand All @@ -3361,12 +3386,22 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<!-- bool std::isgreaterequal(double x, double y); -->
<function name="std::isgreaterequal">
<use-retval/>
<pure/>
<returnValue type="bool">arg1 &gt;= arg2?1:0</returnValue>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
</function>
<!-- int isinf(double x); -->
<!-- bool isinf(float x); // since C++11 -->
<!-- bool isinf(double x); // since C++11 -->
<!-- bool isinf(long double x); // since C++11 -->
<!-- bool isinf(Integral x); // since C++11 -->
<function name="isinf,std::isinf">
<function name="isinf">
<use-retval/>
<pure/>
<returnValue type="int"/>
Expand All @@ -3377,6 +3412,21 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-bool/>
</arg>
</function>
<!-- bool std::isinf(float x); // since C++11 -->
<!-- bool std::isinf(double x); // since C++11 -->
<!-- bool std::isinf(long double x); // since C++11 -->
<!-- bool std::isinf(Integral x); // since C++11 -->
<function name="std::isinf">
<use-retval/>
<pure/>
<returnValue type="bool"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- double logb(double x); -->
<function name="logb,std::logb">
<use-retval/>
Expand Down
32 changes: 32 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2685,6 +2685,14 @@ void uninitvar_fpclassify(void)
(void)std::fpclassify(ld);
}

void bool_isfinite(float f)
{
// cppcheck-suppress compareBoolExpressionWithInt
// cppcheck-suppress compareValueOutOfTypeRangeError
// cppcheck-suppress knownConditionTrueFalse
if (std::isfinite(f)==123) {}
}

void uninitvar_isfinite(void)
{
float f;
Expand All @@ -2700,6 +2708,14 @@ void uninitvar_isfinite(void)
(void)std::isfinite(ld);
}

void bool_isgreater(float f1, float f2)
{
// cppcheck-suppress compareBoolExpressionWithInt
// cppcheck-suppress compareValueOutOfTypeRangeError
// cppcheck-suppress knownConditionTrueFalse
if (std::isgreater(f1,f2)==123) {}
}

void uninitvar_isgreater(void)
{
float f1,f2;
Expand All @@ -2715,6 +2731,14 @@ void uninitvar_isgreater(void)
(void)std::isgreater(ld1,ld2);
}

void bool_isgreaterequal(float f1, float f2)
{
// cppcheck-suppress compareBoolExpressionWithInt
// cppcheck-suppress compareValueOutOfTypeRangeError
// cppcheck-suppress knownConditionTrueFalse
if (std::isgreaterequal(f1, f2)==123) {}
}

void uninitvar_isgreaterequal(void)
{
float f1,f2;
Expand All @@ -2730,6 +2754,14 @@ void uninitvar_isgreaterequal(void)
(void)std::isgreaterequal(ld1,ld2);
}

void bool_isinf(float f)
{
// cppcheck-suppress compareBoolExpressionWithInt
// cppcheck-suppress compareValueOutOfTypeRangeError
// cppcheck-suppress knownConditionTrueFalse
if (std::isinf(f)==123) {}
}

void uninitvar_isinf(void)
{
double d;
Expand Down

0 comments on commit 6ff44d7

Please sign in to comment.