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

This commit is contained in:
orbitcowboy 2015-09-08 11:45:13 +02:00
parent 4f1e7ec9d3
commit 7d229f082c
4 changed files with 572 additions and 31 deletions

View File

@ -2878,15 +2878,13 @@
</arg>
</function>
<!-- size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps); -->
<function name="wcrtomb">
<function name="wcrtomb,std::wcrtomb">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3">
<not-null/>
</arg>
<arg nr="3"/>
</function>
<!-- char * strchr(const char *cs, int c); -->
<function name="strchr,std::strchr">
@ -2903,7 +2901,7 @@
</arg>
</function>
<!-- wchar_t wcschr(const wchar_t *cs, wchar_t c); -->
<function name="wcschr">
<function name="wcschr,std::wcschr">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -2933,7 +2931,7 @@
</arg>
</function>
<!-- int wcscmp(const wchar_t *str1, const wchar_t c); -->
<function name="wcscmp">
<function name="wcscmp,std::wcscmp">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -2962,7 +2960,7 @@
</arg>
</function>
<!-- wchar_t *wcscpy(wchar_t *deststr, const wchar_t *srcstr); -->
<function name="wcscpy">
<function name="wcscpy,std::wcscpy">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -2975,7 +2973,7 @@
</function>
<!-- size_t strftime(char *s, size_t max, const char *fmt, const struct tm *p); -->
<!-- size_t strfxtime(char *s, size_t max, const char *fmt, const struct tmx *p); -->
<function name="strftime,strfxtime">
<function name="strftime,std::strftime,strfxtime">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -3006,7 +3004,7 @@
</arg>
</function>
<!-- size_t wcslen(const wchar_t *string); -->
<function name="wcslen">
<function name="wcslen,std::wcslen">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -3035,7 +3033,7 @@
</arg>
</function>
<!-- char * strpbrk(const char *cs, const char *ct); -->
<function name="strpbrk">
<function name="strpbrk,std::strpbrk">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3068,7 +3066,7 @@
</arg>
</function>
<!-- wchar_t *wcsncat(wchar_t *ct, const wchar_t *cs, size_t n); -->
<function name="wcsncat">
<function name="wcsncat,std::wcsncat">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -3104,7 +3102,7 @@
</arg>
</function>
<!-- int wcsncmp(const wchar_t* wcs1, const wchar_t* wcs2, size_t num); -->
<function name="wcsncmp">
<function name="wcsncmp,std::wcsncmp">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -3139,7 +3137,7 @@
</arg>
</function>
<!-- wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2); -->
<function name="wcsstr">
<function name="wcsstr,std::wcsstr">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -3154,7 +3152,7 @@
</arg>
</function>
<!-- size_t strspn(const char *cs, const char *ct); -->
<function name="strspn">
<function name="strspn,std::strspn">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3170,7 +3168,7 @@
</arg>
</function>
<!-- size_t strxfrm(char *ds, const char *ss, size_t n); -->
<function name="strxfrm">
<function name="strxfrm,std::strxfrm">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="2">
@ -3182,7 +3180,7 @@
</arg>
</function>
<!-- size_t wcsxfrm(wchar_t *s1, const wchar_t *s2, size_t n); -->
<function name="wcsxfrm">
<function name="wcsxfrm,std::wcsxfrm">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -3197,7 +3195,7 @@
</arg>
</function>
<!-- size_t wcsspn(const wchar_t *s1, const wchar_t *s2); -->
<function name="wcsspn">
<function name="wcsspn,std::wcsspn">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -3212,13 +3210,13 @@
</arg>
</function>
<!-- struct lconv* localeconv(void); -->
<function name="localeconv">
<function name="localeconv,std::localeconv">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
</function>
<!-- char* setlocale(int category, const char* locale); -->
<function name="setlocale">
<function name="setlocale,std::setlocale">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -3229,7 +3227,7 @@
</arg>
</function>
<!-- char * strerror(int errornum); -->
<function name="strerror">
<function name="strerror,std::strerror">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3238,7 +3236,7 @@
</arg>
</function>
<!-- size_t strcspn(const char *cs, const char *ct); -->
<function name="strcspn">
<function name="strcspn,std::strcspn">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -3253,7 +3251,7 @@
</arg>
</function>
<!-- size_t wcscspn(const wchar_t *cs, const wchar_t *ct); -->
<function name="wcscspn">
<function name="wcscspn,std::wcscspn">
<use-retval/>
<pure/>
<noreturn>false</noreturn>
@ -3267,8 +3265,8 @@
<not-uninit/>
</arg>
</function>
<!-- wchar_t * wcspbrk(const wchar_t *ct, wchar_t c); -->
<function name="wcspbrk">
<!-- wchar_t * wcspbrk(const wchar_t *ct, wchar_t *c); -->
<function name="wcspbrk,std::wcspbrk">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3281,7 +3279,7 @@
</arg>
</function>
<!-- wchar_t * wcsncpy(wchar_t *s, const wchar_t *cs, size_t n); -->
<function name="wcsncpy">
<function name="wcsncpy,std::wcsncpy">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
@ -3296,7 +3294,7 @@
</arg>
</function>
<!-- int strcoll(const char *cs, const char *c); -->
<function name="strcoll">
<function name="strcoll,std::strcoll">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3310,7 +3308,7 @@
</arg>
</function>
<!-- int wcscoll(const wchar_t *s1, const wchar_t *s2); -->
<function name="wcscoll">
<function name="wcscoll,std::wcscoll">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3325,7 +3323,7 @@
</function>
<!-- const char * strrchr(const char * str, int character);
char * strrchr( char * str, int character); -->
<function name="strrchr">
<function name="strrchr,std::strrchr">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3356,7 +3354,7 @@
</function>
<!-- const wchar_t* wcsrchr(const wchar_t* ws, wchar_t wc);
wchar_t* wcsrchr( wchar_t* ws, wchar_t wc); -->
<function name="wcsrchr">
<function name="wcsrchr,std::wcsrchr">
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -3364,6 +3362,9 @@
<not-null/>
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
</arg>
</function>
<!-- size_t wcsrtombs(char *dst, const wchar_t **src, size_t len, mbstate_t *ps); -->
<function name="wcsrtombs">

View File

@ -15,6 +15,7 @@
#include <wctype.h>
#include <fenv.h>
#include <setjmp.h>
#include <time.h>
void bufferAccessOutOfBounds(void)
{
@ -2796,3 +2797,279 @@ void uninivar_wcscat(void)
// cppcheck-suppress uninitvar
(void)wcscat(deststr,srcstr);
}
void uninivar_wcrtomb(void)
{
char *s;
wchar_t wc;
mbstate_t *ps;
// cppcheck-suppress uninitvar
(void)wcrtomb(s,wc,ps);
}
void uninivar_strchr(void)
{
char *cs;
int c;
// cppcheck-suppress uninitvar
(void)strchr(cs,c);
}
void uninivar_wcschr(void)
{
wchar_t *cs;
wchar_t c;
// cppcheck-suppress uninitvar
(void)wcschr(cs,c);
}
void uninivar_strcmp(void)
{
char *str1;
char *str2;
// cppcheck-suppress uninitvar
(void)strcmp(str1,str2);
}
void uninivar_wcscmp(void)
{
wchar_t *str1;
wchar_t *str2;
// cppcheck-suppress uninitvar
(void)wcscmp(str1,str2);
}
void uninivar_strcpy(void)
{
char *str1;
char *str2;
// cppcheck-suppress uninitvar
(void)strcpy(str1,str2);
}
void uninivar_wcscpy(void)
{
wchar_t *str1;
wchar_t *str2;
// cppcheck-suppress uninitvar
(void)wcscpy(str1,str2);
}
void uninivar_strftime(void)
{
char *s;
size_t max;
char *fmt;
struct tm *p;
// cppcheck-suppress uninitvar
(void)strftime(s,max,fmt,p);
struct tmx *px;
// cppcheck-suppress uninitvar
(void)strfxtime(s,max,fmt,px);
}
void uninivar_strlen(void)
{
char *s;
// cppcheck-suppress uninitvar
(void)strlen(s);
}
void uninivar_wcslen(void)
{
wchar_t *s;
// cppcheck-suppress uninitvar
(void)wcslen(s);
}
void uninivar_strncpy(void)
{
char *s;
char *ct;
size_t n;
// cppcheck-suppress uninitvar
(void)strncpy(s,ct,n);
}
void uninivar_strpbrk(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)strpbrk(cs,ct);
}
void uninivar_strncat(void)
{
char *ct;
char *s;
size_t n;
// cppcheck-suppress uninitvar
(void)strncat(ct,s,n);
}
void uninivar_wcsncat(void)
{
wchar_t *ct;
wchar_t *s;
size_t n;
// cppcheck-suppress uninitvar
(void)wcsncat(ct,s,n);
}
void uninivar_strncmp(void)
{
char *ct;
char *s;
size_t n;
// cppcheck-suppress uninitvar
(void)strncmp(ct,s,n);
}
void uninivar_wcsncmp(void)
{
wchar_t *ct;
wchar_t *s;
size_t n;
// cppcheck-suppress uninitvar
(void)wcsncmp(ct,s,n);
}
void uninivar_strstr(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)strstr(cs,ct);
}
void uninivar_wcsstr(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)wcsstr(cs,ct);
}
void uninivar_strspn(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)strspn(cs,ct);
}
void uninivar_strxfrm(void)
{
char *ds;
char *ss;
size_t n;
// cppcheck-suppress uninitvar
(void)strxfrm(ds,ss,n);
}
void uninivar_wcsxfrm(void)
{
wchar_t *ds;
wchar_t *ss;
size_t n;
// cppcheck-suppress uninitvar
(void)wcsxfrm(ds,ss,n);
}
void uninivar_wcsspn(void)
{
wchar_t *ds;
wchar_t *ss;
// cppcheck-suppress uninitvar
(void)wcsspn(ds,ss);
}
void uninivar_setlocale(void)
{
int category;
char* locale;
// cppcheck-suppress uninitvar
(void)setlocale(category,locale);
}
void uninivar_strerror(void)
{
int i;
// cppcheck-suppress uninitvar
(void)strerror(i);
}
void uninivar_strcspn(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)strcspn(cs,ct);
}
void uninivar_wcscspn(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)wcscspn(cs,ct);
}
void uninivar_wcspbrk(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)wcspbrk(cs,ct);
}
void uninivar_wcsncpy(void)
{
wchar_t *cs;
wchar_t *ct;
size_t n;
// cppcheck-suppress uninitvar
(void)wcsncpy(cs,ct,n);
}
void uninivar_strcoll(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)strcoll(cs,ct);
}
void uninivar_wcscoll(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)wcscoll(cs,ct);
}
void uninivar_strrchr(void)
{
char * str;
int c;
// cppcheck-suppress uninitvar
(void)strrchr(str,c);
}
void uninivar_strbprk(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)strbprk(cs,ct);
}
void uninivar_wcsrchr(void)
{
wchar_t* ws;
wchar_t wc;
// cppcheck-suppress uninitvar
(void)wcsrchr(ws,wc);
}

View File

@ -2120,3 +2120,266 @@ void uninivar_wcscat(void)
// cppcheck-suppress uninitvar
(void)std::wcscat(deststr,srcstr);
}
void uninivar_wcrtomb(void)
{
char *s;
wchar_t wc;
mbstate_t *ps;
// cppcheck-suppress uninitvar
(void)std::wcrtomb(s,wc,ps);
}
void uninivar_strchr(void)
{
char *cs;
int c;
// cppcheck-suppress uninitvar
(void)std::strchr(cs,c);
}
void uninivar_wcschr(void)
{
wchar_t *cs;
wchar_t c;
// cppcheck-suppress uninitvar
(void)std::wcschr(cs,c);
}
void uninivar_strcmp(void)
{
char *str1;
char *str2;
// cppcheck-suppress uninitvar
(void)std::strcmp(str1,str2);
}
void uninivar_wcscmp(void)
{
wchar_t *str1;
wchar_t *str2;
// cppcheck-suppress uninitvar
(void)std::wcscmp(str1,str2);
}
void uninivar_strcpy(void)
{
char *str1;
char *str2;
// cppcheck-suppress uninitvar
(void)std::strcpy(str1,str2);
}
void uninivar_wcscpy(void)
{
wchar_t *str1;
wchar_t *str2;
// cppcheck-suppress uninitvar
(void)std::wcscpy(str1,str2);
}
void uninivar_strftime(void)
{
char *s;
size_t max;
char *fmt;
struct tm *p;
// cppcheck-suppress uninitvar
(void)std::strftime(s,max,fmt,p);
}
void uninivar_strlen(void)
{
char *s;
// cppcheck-suppress uninitvar
(void)std::strlen(s);
}
void uninivar_wcslen(void)
{
wchar_t *s;
// cppcheck-suppress uninitvar
(void)std::wcslen(s);
}
void uninivar_strncpy(void)
{
char *s;
char *ct;
size_t n;
// cppcheck-suppress uninitvar
(void)std::strncpy(s,ct,n);
}
void uninivar_strpbrk(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)std::strpbrk(cs,ct);
}
void uninivar_strncat(void)
{
char *ct;
char *s;
size_t n;
// cppcheck-suppress uninitvar
(void)std::strncat(ct,s,n);
}
void uninivar_wcsncat(void)
{
wchar_t *ct;
wchar_t *s;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wcsncat(ct,s,n);
}
void uninivar_strncmp(void)
{
char *ct;
char *s;
size_t n;
// cppcheck-suppress uninitvar
(void)std::strncmp(ct,s,n);
}
void uninivar_wcsncmp(void)
{
wchar_t *ct;
wchar_t *s;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wcsncmp(ct,s,n);
}
void uninivar_strstr(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)std::strstr(cs,ct);
}
void uninivar_wcsstr(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)std::wcsstr(cs,ct);
}
void uninivar_strspn(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)std::strspn(cs,ct);
}
void uninivar_strxfrm(void)
{
char *ds;
char *ss;
size_t n;
// cppcheck-suppress uninitvar
(void)std::strxfrm(ds,ss,n);
}
void uninivar_wcsxfrm(void)
{
wchar_t *ds;
wchar_t *ss;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wcsxfrm(ds,ss,n);
}
void uninivar_wcsspn(void)
{
wchar_t *ds;
wchar_t *ss;
// cppcheck-suppress uninitvar
(void)std::wcsspn(ds,ss);
}
void uninivar_setlocale(void)
{
int category;
char* locale;
// cppcheck-suppress uninitvar
(void)std::setlocale(category,locale);
}
void uninivar_strerror(void)
{
int i;
// cppcheck-suppress uninitvar
(void)std::strerror(i);
}
void uninivar_strcspn(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)std::strcspn(cs,ct);
}
void uninivar_wcscspn(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)std::wcscspn(cs,ct);
}
void uninivar_wcspbrk(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)std::wcspbrk(cs,ct);
}
void uninivar_wcsncpy(void)
{
wchar_t *cs;
wchar_t *ct;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wcsncpy(cs,ct,n);
}
void uninivar_strcoll(void)
{
char *cs;
char *ct;
// cppcheck-suppress uninitvar
(void)std::strcoll(cs,ct);
}
void uninivar_wcscoll(void)
{
wchar_t *cs;
wchar_t *ct;
// cppcheck-suppress uninitvar
(void)std::wcscoll(cs,ct);
}
void uninivar_strrchr(void)
{
char * str;
int c;
// cppcheck-suppress uninitvar
(void)std::strrchr(str,c);
}
void uninivar_wcsrchr(void)
{
wchar_t* ws;
wchar_t wc;
// cppcheck-suppress uninitvar
(void)std::wcsrchr(ws,wc);
}