Improved testing of std.cfg regarding uninitialized variables.

This commit is contained in:
orbitcowboy 2015-09-01 11:59:24 +02:00
parent 974414645a
commit c64e74492b
3 changed files with 292 additions and 16 deletions

View File

@ -1419,7 +1419,7 @@
</arg> </arg>
</function> </function>
<!-- char * getenv(const char *name); --> <!-- char * getenv(const char *name); -->
<function name="getenv"> <function name="getenv,std::getenv">
<use-retval/> <use-retval/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
@ -1438,7 +1438,7 @@
</arg> </arg>
</function> </function>
<!-- struct tm * gmtime(const time_t *tp); --> <!-- struct tm * gmtime(const time_t *tp); -->
<function name="gmtime"> <function name="gmtime,std::gmtime">
<use-retval/> <use-retval/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
@ -1459,7 +1459,7 @@
</arg> </arg>
</function> </function>
<!-- int iswalnum(wint_t c); --> <!-- int iswalnum(wint_t c); -->
<function name="iswalnum"> <function name="iswalnum,std::iswalnum">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1480,7 +1480,7 @@
</arg> </arg>
</function> </function>
<!-- int iswalpha(wint_t c);--> <!-- int iswalpha(wint_t c);-->
<function name="iswalpha"> <function name="iswalpha,std::iswalpha">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1490,7 +1490,7 @@
</arg> </arg>
</function> </function>
<!-- int isblank(int c); --> <!-- int isblank(int c); -->
<function name="isblank"> <function name="isblank,std::isblank">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1501,7 +1501,7 @@
</arg> </arg>
</function> </function>
<!-- int iswblank(wint_t c); --> <!-- int iswblank(wint_t c); -->
<function name="iswblank"> <function name="iswblank,std::iswblank">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1522,7 +1522,7 @@
</arg> </arg>
</function> </function>
<!-- int iswcntrl(wint_t c); --> <!-- int iswcntrl(wint_t c); -->
<function name="iswcntrl"> <function name="iswcntrl,std::iswcntrl">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1531,8 +1531,8 @@
<not-uninit/> <not-uninit/>
</arg> </arg>
</function> </function>
<!-- int iswctype(wint_t c, wctype_t desc); --> <!-- int iswcntrl(wint_t c, wctype_t desc); -->
<function name="iswctype"> <function name="iswctype,std::iswctype">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1556,7 +1556,7 @@
</arg> </arg>
</function> </function>
<!-- int iswdigit(wint_t c); --> <!-- int iswdigit(wint_t c); -->
<function name="iswdigit"> <function name="iswdigit,std::iswdigit">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1577,7 +1577,7 @@
</arg> </arg>
</function> </function>
<!-- int iswgraph(wint_t c); --> <!-- int iswgraph(wint_t c); -->
<function name="iswgraph"> <function name="iswgraph,std::iswgraph">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1598,7 +1598,7 @@
</arg> </arg>
</function> </function>
<!-- int iswlower(wint_t c); --> <!-- int iswlower(wint_t c); -->
<function name="iswlower"> <function name="iswlower,std::iswlower">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1619,7 +1619,7 @@
</arg> </arg>
</function> </function>
<!-- int iswprint(wint_t c); --> <!-- int iswprint(wint_t c); -->
<function name="iswprint"> <function name="iswprint,std::iswprint">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1629,7 +1629,7 @@
</arg> </arg>
</function> </function>
<!-- int ispunct(int c); --> <!-- int ispunct(int c); -->
<function name="ispunct"> <function name="ispunct,std::ispunct">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1640,7 +1640,7 @@
</arg> </arg>
</function> </function>
<!-- int iswpunct(wint_t c); --> <!-- int iswpunct(wint_t c); -->
<function name="iswpunct"> <function name="iswpunct,std::iswpunct">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -1661,7 +1661,7 @@
</arg> </arg>
</function> </function>
<!-- int iswspace(wint_t c); --> <!-- int iswspace(wint_t c); -->
<function name="iswspace"> <function name="iswspace,std::iswspace">
<use-retval/> <use-retval/>
<pure/> <pure/>
<noreturn>false</noreturn> <noreturn>false</noreturn>

View File

@ -12,6 +12,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <tgmath.h> // frexp #include <tgmath.h> // frexp
#include <wchar.h> #include <wchar.h>
#include <wctype.h>
#include <fenv.h> #include <fenv.h>
void bufferAccessOutOfBounds(void) void bufferAccessOutOfBounds(void)
@ -1573,6 +1574,175 @@ void uninitvar_ungetwc(void)
(void)ungetwc(c,stream); (void)ungetwc(c,stream);
} }
void uninitvar_getenv(void)
{
char *name;
// cppcheck-suppress uninitvar
(void)getenv(name);
}
void uninitvar_gmtime(void)
{
time_t *tp;
// cppcheck-suppress uninitvar
(void)gmtime(tp);
}
void uninitvar_isalnum(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isalnum(i);
}
void uninitvar_iswalnum(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswalnum(i);
}
void uninitvar_isalpha(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isalpha(i);
}
void uninitvar_iswalpha(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswalpha(i);
}
void uninitvar_isblank(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isblank(i);
}
void uninitvar_iswblank(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswblank(i);
}
void uninitvar_iscntrl(void)
{
int i;
// cppcheck-suppress uninitvar
(void)iscntrl(i);
}
void uninitvar_iswcntrl(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswcntrl(i);
}
void uninitvar_iswctype(void)
{
wint_t c;
wctype_t desc;
// cppcheck-suppress uninitvar
(void)iswctype(c,desc);
}
void uninitvar_isdigit(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isdigit(i);
}
void uninitvar_iswdigit(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswdigit(i);
}
void uninitvar_isgraph(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isgraph(i);
}
void uninitvar_iswgraph(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswgraph(i);
}
void uninitvar_islower(void)
{
int i;
// cppcheck-suppress uninitvar
(void)islower(i);
}
void uninitvar_iswlower(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswlower(i);
}
void uninitvar_isprint(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isprint(i);
}
void uninitvar_iswprint(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswprint(i);
}
void uninitvar_ispunct(void)
{
int i;
// cppcheck-suppress uninitvar
(void)ispunct(i);
}
void uninitvar_iswpunct(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswpunct(i);
}
void uninitvar_isspace(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isspace(i);
}
void uninitvar_iswspace(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)iswspace(i);
}
void uninitvar_isupper(void)
{
int i;
// cppcheck-suppress uninitvar
(void)isupper(i);
}
void ignoreretrn(void) void ignoreretrn(void)
{ {
char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff"; char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff";

View File

@ -1089,3 +1089,109 @@ void uninitvar_ungetwc(void)
// cppcheck-suppress uninitvar // cppcheck-suppress uninitvar
(void)std::ungetwc(c,stream); (void)std::ungetwc(c,stream);
} }
void uninitvar_getenv(void)
{
char *name;
// cppcheck-suppress uninitvar
(void)std::getenv(name);
}
void uninitvar_gmtime(void)
{
time_t *tp;
// cppcheck-suppress uninitvar
(void)std::gmtime(tp);
}
void uninitvar_iswalnum(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswalnum(i);
}
void uninitvar_iswalpha(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswalpha(i);
}
void uninitvar_isblank(void)
{
int i;
// cppcheck-suppress uninitvar
(void)std::isblank(i);
}
void uninitvar_iswblank(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswblank(i);
}
void uninitvar_iswcntrl(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswcntrl(i);
}
void uninitvar_iswctype(void)
{
wint_t c;
wctype_t desc;
// cppcheck-suppress uninitvar
(void)std::iswctype(c,desc);
}
void uninitvar_iswdigit(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswdigit(i);
}
void uninitvar_iswgraph(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswgraph(i);
}
void uninitvar_iswlower(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswlower(i);
}
void uninitvar_iswprint(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswprint(i);
}
void uninitvar_ispunct(void)
{
int i;
// cppcheck-suppress uninitvar
(void)std::ispunct(i);
}
void uninitvar_iswpunct(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswpunct(i);
}
void uninitvar_iswspace(void)
{
wint_t i;
// cppcheck-suppress uninitvar
(void)std::iswspace(i);
}