test/cfg: Improved testing of std.cfg regarding uninitialized variables.

This commit is contained in:
orbitcowboy 2015-09-08 16:08:43 +02:00
parent 60770a8fdc
commit e929e9e7d9
3 changed files with 79 additions and 5 deletions

View File

@ -3447,10 +3447,12 @@
</arg> </arg>
</function> </function>
<!-- char *tmpnam(char *s); --> <!-- char *tmpnam(char *s); -->
<function name="tmpnam"> <function name="tmpnam,std::tmpnam">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"/> <arg nr="1">
<not-uninit/>
</arg>
</function> </function>
<!-- FILE *tmpfile(void); --> <!-- FILE *tmpfile(void); -->
<function name="tmpfile"> <function name="tmpfile">
@ -3458,35 +3460,41 @@
<noreturn>false</noreturn> <noreturn>false</noreturn>
</function> </function>
<!-- int tolower(int c); --> <!-- int tolower(int c); -->
<function name="tolower"> <function name="tolower,std::tolower">
<use-retval/> <use-retval/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
<not-uninit/>
<valid>0:255</valid> <valid>0:255</valid>
</arg> </arg>
</function> </function>
<!-- int toupper(int c); --> <!-- int toupper(int c); -->
<function name="toupper"> <function name="toupper,std::toupper">
<use-retval/> <use-retval/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
<not-uninit/>
<valid>0:255</valid> <valid>0:255</valid>
</arg> </arg>
</function> </function>
<!-- type va_arg(va_list ap, type); -->
<function name="va_arg"> <function name="va_arg">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
</function> </function>
<!-- void va_copy(va_list dest, va_list src); -->
<function name="va_copy"> <function name="va_copy">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
</function> </function>
<!-- void va_end(va_list ap); -->
<function name="va_end"> <function name="va_end">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
</function> </function>
<!-- void va_start(va_list ap, paramN); -->
<function name="va_start"> <function name="va_start">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
@ -3494,7 +3502,7 @@
<!-- float wcstof(const wchar_t *s, wchar ** endp); --> <!-- float wcstof(const wchar_t *s, wchar ** endp); -->
<!-- double wcstod(const wchar_t *s, wchar ** endp); --> <!-- double wcstod(const wchar_t *s, wchar ** endp); -->
<!-- long double wcstold(const wchar_t *s, wchar ** endp); --> <!-- long double wcstold(const wchar_t *s, wchar ** endp); -->
<function name="wcstof,wcstod,wcstold"> <function name="wcstof,std::wcstof,wcstod,std::wcstod,wcstold,std::wcstold">
<use-retval/> <use-retval/>
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>

View File

@ -3136,3 +3136,36 @@ void uninitvar_time(void)
// cppcheck-suppress uninitvar // cppcheck-suppress uninitvar
(void)time(tp); (void)time(tp);
} }
void uninitvar_tmpnam(void)
{
char *s;
// cppcheck-suppress uninitvar
(void)tmpnam(s);
}
void uninivar_tolower(void)
{
int c;
// cppcheck-suppress uninitvar
(void)tolower(c);
}
void uninivar_toupper(void)
{
int c;
// cppcheck-suppress uninitvar
(void)toupper(c);
}
void uninivar_wcstof(void)
{
const wchar_t *s;
wchar_t **endp;
// cppcheck-suppress uninitvar
(void)wcstof(s,endp);
// cppcheck-suppress uninitvar
(void)wcstod(s,endp);
// cppcheck-suppress uninitvar
(void)wcstold(s,endp);
}

View File

@ -2446,3 +2446,36 @@ void uninitvar_time(void)
// cppcheck-suppress uninitvar // cppcheck-suppress uninitvar
(void)std::time(tp); (void)std::time(tp);
} }
void uninitvar_tmpnam(void)
{
char *s;
// cppcheck-suppress uninitvar
(void)std::tmpnam(s);
}
void uninivar_tolower(void)
{
int c;
// cppcheck-suppress uninitvar
(void)std::tolower(c);
}
void uninivar_toupper(void)
{
int c;
// cppcheck-suppress uninitvar
(void)std::toupper(c);
}
void uninivar_wcstof(void)
{
const wchar_t *s;
wchar_t **endp;
// cppcheck-suppress uninitvar
(void)std::wcstof(s,endp);
// cppcheck-suppress uninitvar
(void)std::wcstod(s,endp);
// cppcheck-suppress uninitvar
(void)std::wcstold(s,endp);
}