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
101 changes: 94 additions & 7 deletions cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3461,7 +3461,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
</arg>
</function>
<!-- int isless(double x, double y); -->
<function name="isless,std::isless">
<function name="isless">
<use-retval/>
<pure/>
<returnValue type="int">arg1&lt;arg2?1:0</returnValue>
Expand All @@ -3474,8 +3474,21 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<function name="std::isless">
<use-retval/>
<pure/>
<returnValue type="bool">arg1&lt;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 islessequal(double x, double y); -->
<function name="islessequal,std::islessequal">
<function name="islessequal">
<use-retval/>
<pure/>
<returnValue type="int">arg1 &lt;= arg2?1:0</returnValue>
Expand All @@ -3488,8 +3501,21 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<function name="std::islessequal">
<use-retval/>
<pure/>
<returnValue type="bool">arg1 &lt;= 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 islessgreater(double x, double y); -->
<function name="islessgreater,std::islessgreater">
<function name="islessgreater">
<use-retval/>
<pure/>
<returnValue type="int">(arg1&lt;arg2 || arg1&gt;arg2)?1:0</returnValue>
Expand All @@ -3503,6 +3529,20 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<function name="std::islessgreater">
<use-retval/>
<pure/>
<returnValue type="bool">(arg1&lt;arg2 || arg1&gt;arg2)?1:0</returnValue>
<!-- true if x < y || x > y, false otherwise -->
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
</function>
<!-- double nan(const char *tagp); -->
<function name="nan,std::nan">
<use-retval/>
Expand Down Expand Up @@ -3547,7 +3587,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<!-- bool isnan(double x); // since C++11 -->
<!-- bool isnan(long double x); // since C++11 -->
<!-- bool isnan(Integral x); // since C++11 -->
<function name="isnan,std::isnan">
<function name="isnan">
<use-retval/>
<pure/>
<returnValue type="int"/>
Expand All @@ -3558,12 +3598,23 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-bool/>
</arg>
</function>
<function name="std::isnan">
<use-retval/>
<pure/>
<returnValue type="bool"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- int isnormal(double x); -->
<!--bool isnormal(float x); // since C++11 -->
<!--bool isnormal(double x); // since C++11 -->
<!--bool isnormal(long double x); // since C++11 -->
<!--bool isnormal(Integral x); // since C++11 -->
<function name="isnormal,std::isnormal">
<function name="isnormal">
<use-retval/>
<pure/>
<returnValue type="int"/>
Expand All @@ -3574,12 +3625,23 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-bool/>
</arg>
</function>
<function name="std::isnormal">
<use-retval/>
<pure/>
<returnValue type="bool"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- int isunordered(double x, double y);-->
<!-- bool isunordered(float x, float y); // since C++11 -->
<!-- bool isunordered(double x, double y); // since C++11 -->
<!-- bool isunordered(long double x, long double y); // since C++11 -->
<!-- bool isunordered(Arithmetic x, Arithmetic y); // since C++11 -->
<function name="isunordered,std::isunordered">
<function name="isunordered">
<use-retval/>
<pure/>
<returnValue type="int"/>
Expand All @@ -3594,6 +3656,21 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-bool/>
</arg>
</function>
<function name="std::isunordered">
<use-retval/>
<pure/>
<returnValue type="bool"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- int ilogb(double x); -->
<function name="ilogb,std::ilogb">
<use-retval/>
Expand Down Expand Up @@ -4671,7 +4748,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
</arg>
</function>
<!-- int signbit(double x); -->
<function name="signbit,std::signbit">
<function name="signbit">
<use-retval/>
<pure/>
<returnValue type="int"/>
Expand All @@ -4681,6 +4758,16 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<function name="std::signbit">
<use-retval/>
<pure/>
<returnValue type="bool"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
</function>
<!-- void (*signal(int sig, void (*func)(int)))(int); -->
<function name="signal,std::signal">
<noreturn>false</noreturn>
Expand Down
49 changes: 49 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2838,6 +2838,13 @@ void uninitvar_logb(void)
(void)std::logbl(ld);
}

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

void uninitvar_isless(void)
{
float f1,f2;
Expand All @@ -2853,6 +2860,13 @@ void uninitvar_isless(void)
(void)std::isless(ld1,ld2);
}

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

void uninitvar_islessequal(void)
{
float f1,f2;
Expand All @@ -2868,6 +2882,13 @@ void uninitvar_islessequal(void)
(void)std::islessequal(ld1,ld2);
}

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

void uninitvar_islessgreater(void)
{
float f1,f2;
Expand All @@ -2894,20 +2915,41 @@ void uninitvar_nan(void)
(void)std::nanl(tagp3);
}

void bool_isnan(float f)
{
// cppcheck-suppress compareBoolExpressionWithInt
// cppcheck-suppress compareValueOutOfTypeRangeError
if (std::isnan(f)==123) {}
}

void uninitvar_isnan(void)
{
double d;
// cppcheck-suppress uninitvar
(void)std::isnan(d);
}

void bool_isnormal(float f)
{
// cppcheck-suppress compareBoolExpressionWithInt
// cppcheck-suppress compareValueOutOfTypeRangeError
if (std::isnormal(f)==123) {}
}

void uninitvar_isnormal(void)
{
double d;
// cppcheck-suppress uninitvar
(void)std::isnormal(d);
}

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

void uninitvar_isunordered(void)
{
double d1,d2;
Expand Down Expand Up @@ -3443,6 +3485,13 @@ void uninivar_scalbln(void)
(void)std::scalblnl(ld,i3);
}

void bool_signbit(float f)
{
// cppcheck-suppress compareBoolExpressionWithInt
// cppcheck-suppress compareValueOutOfTypeRangeError
if (std::signbit(f)==123) {}
}

void uninitvar_signbit(void)
{
double d;
Expand Down
Loading