Improved testing of std.cfg regarding uninitialized variables.

This commit is contained in:
orbitcowboy 2015-09-03 16:03:16 +02:00
parent bfb70f3312
commit 84d8a869d0
3 changed files with 188 additions and 6 deletions

View File

@ -2324,10 +2324,11 @@
<arg nr="3"> <arg nr="3">
<not-bool/> <not-bool/>
<valid>0:</valid> <valid>0:</valid>
<not-uninit/>
</arg> </arg>
</function> </function>
<!-- wchar_t * wmemcpy(wchar_t *ct, const wchar_t *cs, size_t n);--> <!-- wchar_t * wmemcpy(wchar_t *ct, const wchar_t *cs, size_t n);-->
<function name="wmemcpy"> <function name="wmemcpy,std::wmemcpy">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -2342,6 +2343,7 @@
<arg nr="3"> <arg nr="3">
<not-bool/> <not-bool/>
<valid>0:</valid> <valid>0:</valid>
<not-uninit/>
</arg> </arg>
</function> </function>
<!-- void * memmove(void *ct, const void *cs, size_t n); --> <!-- void * memmove(void *ct, const void *cs, size_t n); -->
@ -2360,10 +2362,11 @@
<arg nr="3"> <arg nr="3">
<not-bool/> <not-bool/>
<valid>0:</valid> <valid>0:</valid>
<not-uninit/>
</arg> </arg>
</function> </function>
<!-- wchar_t * wmemmove(wchar_t *ct, const wchar_t *cs, size_t n); --> <!-- wchar_t * wmemmove(wchar_t *ct, const wchar_t *cs, size_t n); -->
<function name="wmemmove"> <function name="wmemmove,std::wmemmove">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -2378,6 +2381,7 @@
<arg nr="3"> <arg nr="3">
<not-bool/> <not-bool/>
<valid>0:</valid> <valid>0:</valid>
<not-uninit/>
</arg> </arg>
</function> </function>
<!-- void *memset(void *s, int c, size_t n); --> <!-- void *memset(void *s, int c, size_t n); -->
@ -2394,10 +2398,11 @@
<arg nr="3"> <arg nr="3">
<not-bool/> <not-bool/>
<valid>0:</valid> <valid>0:</valid>
<not-uninit/>
</arg> </arg>
</function> </function>
<!-- wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n); --> <!-- wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n); -->
<function name="wmemset"> <function name="wmemset,std::wmemset">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -2410,11 +2415,12 @@
<arg nr="3"> <arg nr="3">
<not-bool/> <not-bool/>
<valid>0:</valid> <valid>0:</valid>
<not-uninit/>
</arg> </arg>
</function> </function>
<!-- time_t mktime(struct tm *tp); --> <!-- time_t mktime(struct tm *tp); -->
<!-- time_t mkxtime(struct tmx *tp); --> <!-- time_t mkxtime(struct tmx *tp); -->
<function name="mktime,mkxtime"> <function name="mktime,std::mktime,mkxtime">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -2425,7 +2431,7 @@
<!-- double modf(double x, double *ip); --> <!-- double modf(double x, double *ip); -->
<!-- float modff(float x, float *ip); --> <!-- float modff(float x, float *ip); -->
<!-- long double modfl(long double x, long double *ip); --> <!-- long double modfl(long double x, long double *ip); -->
<function name="modf,modff,modfl"> <function name="modf,std::modf,modff,modfl">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">
@ -2436,7 +2442,7 @@
</arg> </arg>
</function> </function>
<!-- void perror(const char *string); --> <!-- void perror(const char *string); -->
<function name="perror"> <function name="perror,std::perror">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"> <arg nr="1">

View File

@ -2374,3 +2374,93 @@ void uninitvar_memcmp(void)
// cppcheck-suppress uninitvar // cppcheck-suppress uninitvar
(void)memcmp(s1,s2,n); (void)memcmp(s1,s2,n);
} }
void uninitvar_memcpy(void)
{
void *ct;
void *cs;
size_t n;
// cppcheck-suppress uninitvar
(void)memcpy(ct,cs,n);
}
void uninitvar_wmemcpy(void)
{
wchar_t *cs;
wchar_t *c;
size_t n;
// cppcheck-suppress uninitvar
(void)wmemcpy(cs,c,n);
}
void uninitvar_memmove(void)
{
void *ct;
void *cs;
size_t n;
// cppcheck-suppress uninitvar
(void)memmove(ct,cs,n);
}
void uninitvar_wmemmove(void)
{
wchar_t *cs;
wchar_t *c;
size_t n;
// cppcheck-suppress uninitvar
(void)wmemmove(cs,c,n);
}
void uninitvar_memset(void)
{
void *s;
int c;
size_t n;
// cppcheck-suppress uninitvar
(void)memset(s,c,n);
}
void uninitvar_wmemset(void)
{
wchar_t *cs;
wchar_t c;
size_t n;
// cppcheck-suppress uninitvar
(void)wmemset(cs,c,n);
}
void uninitvar_mktime(void)
{
struct tm *tp;
// cppcheck-suppress uninitvar
(void)mktime(tp);
struct tmx *tpx;
// cppcheck-suppress uninitvar
(void)mkxtime(tpx);
}
void uninivar_modf(void)
{
float f1;
float *f2;
// cppcheck-suppress uninitvar
(void)modff(f1,f2);
double d1;
double *d2;
// cppcheck-suppress uninitvar
(void)modf(d1,d2);
long double ld1;
long double *ld2;
// cppcheck-suppress uninitvar
(void)modfl(ld1,ld2);
}
void uninivar_perror(void)
{
char *string;
// cppcheck-suppress uninitvar
(void)perror(string);
}

View File

@ -1715,3 +1715,89 @@ void uninitvar_memcmp(void)
// cppcheck-suppress uninitvar // cppcheck-suppress uninitvar
(void)std::memcmp(s1,s2,n); (void)std::memcmp(s1,s2,n);
} }
void uninitvar_memcpy(void)
{
void *ct;
void *cs;
size_t n;
// cppcheck-suppress uninitvar
(void)std::memcpy(ct,cs,n);
}
void uninitvar_wmemcpy(void)
{
wchar_t *cs;
wchar_t *c;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wmemcpy(cs,c,n);
}
void uninitvar_memmove(void)
{
void *ct;
void *cs;
size_t n;
// cppcheck-suppress uninitvar
(void)std::memmove(ct,cs,n);
}
void uninitvar_wmemmove(void)
{
wchar_t *cs;
wchar_t *c;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wmemmove(cs,c,n);
}
void uninitvar_memset(void)
{
void *s;
int c;
size_t n;
// cppcheck-suppress uninitvar
(void)std::memset(s,c,n);
}
void uninitvar_wmemset(void)
{
wchar_t *cs;
wchar_t c;
size_t n;
// cppcheck-suppress uninitvar
(void)std::wmemset(cs,c,n);
}
void uninitvar_mktime(void)
{
struct tm *tp;
// cppcheck-suppress uninitvar
(void)std::mktime(tp);
}
void uninivar_modf(void)
{
float f1;
float *f2;
// cppcheck-suppress uninitvar
(void)std::modf(f1,f2);
double d1;
double *d2;
// cppcheck-suppress uninitvar
(void)std::modf(d1,d2);
long double ld1;
long double *ld2;
// cppcheck-suppress uninitvar
(void)std::modf(ld1,ld2);
}
void uninivar_perror(void)
{
char *string;
// cppcheck-suppress uninitvar
(void)std::perror(string);
}