Improved testing of std.cfg regarding uninitialized variables.
This commit is contained in:
parent
117bdef19c
commit
c955fafd84
24
cfg/std.cfg
24
cfg/std.cfg
|
@ -2551,7 +2551,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- void* bsearch(const void* key, const void* base, size_t num, size_t size, int(*compar)(const void*,const void*));-->
|
||||
<function name="bsearch">
|
||||
<function name="bsearch,std::bsearch">
|
||||
<use-retval/>
|
||||
<pure/>
|
||||
<noreturn>false</noreturn>
|
||||
|
@ -2576,7 +2576,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- void qsort(void *base, size_t n, size_t size, int (*cmp)(const void *, const void *)); -->
|
||||
<function name="qsort">
|
||||
<function name="qsort,std::qsort">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2595,7 +2595,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int putc(int c, FILE *stream); -->
|
||||
<function name="putc">
|
||||
<function name="putc,std::putc">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2609,7 +2609,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- wint_t putwc(wchar_t wc, FILE* stream); -->
|
||||
<function name="putwc">
|
||||
<function name="putwc,std::putwc">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2621,7 +2621,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int puthchar(int c); -->
|
||||
<function name="putchar">
|
||||
<function name="putchar,std::putchar">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2631,7 +2631,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- wint_t putwchar(wchar_t wc); -->
|
||||
<function name="putwchar">
|
||||
<function name="putwchar,std::putwchar">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2639,7 +2639,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int puts(const char *string); -->
|
||||
<function name="puts">
|
||||
<function name="puts,std::puts">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2650,7 +2650,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- void *realloc(void *block, size_t newsize); -->
|
||||
<function name="realloc">
|
||||
<function name="realloc,std::realloc">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
|
@ -2660,7 +2660,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int remove(const char *filename); -->
|
||||
<function name="remove">
|
||||
<function name="remove,std::remove">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2670,7 +2670,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int rename(const char *oldname, const char *newname); -->
|
||||
<function name="rename">
|
||||
<function name="rename,std::rename">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2685,7 +2685,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- void rewind(FILE *stream); -->
|
||||
<function name="rewind">
|
||||
<function name="rewind,std::rewind">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2696,7 +2696,7 @@
|
|||
<!-- double round(double x); -->
|
||||
<!-- float roundf(float x); -->
|
||||
<!-- long double roundl(long double x); -->
|
||||
<function name="round,roundf,roundl">
|
||||
<function name="round,std::round,roundf,std::roundf,roundl,std::roundl">
|
||||
<use-retval/>
|
||||
<pure/>
|
||||
<noreturn>false</noreturn>
|
||||
|
|
102
test/cfg/std.c
102
test/cfg/std.c
|
@ -2557,3 +2557,105 @@ void uninivar_vwprintf(void)
|
|||
// cppcheck-suppress uninitvar
|
||||
(void)vwprintf(format,arg);
|
||||
}
|
||||
|
||||
void uninivar_bsearch(void)
|
||||
{
|
||||
void* key;
|
||||
void* base;
|
||||
size_t num;
|
||||
size_t size;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)bsearch(key,base,num,size,(int(*)(const void*,const void*)) strcmp);
|
||||
}
|
||||
|
||||
void uninitvar_qsort(void)
|
||||
{
|
||||
void *base;
|
||||
size_t n;
|
||||
size_t size;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)qsort(base,n,size, (int(*)(const void*,const void*)) strcmp);
|
||||
}
|
||||
|
||||
void uninitvar_putc(void)
|
||||
{
|
||||
int c;
|
||||
FILE *stream;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)putc(c,stream);
|
||||
}
|
||||
|
||||
void uninitvar_putwc(void)
|
||||
{
|
||||
wchar_t c;
|
||||
FILE *stream;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)putc(c,stream);
|
||||
}
|
||||
|
||||
void uninitvar_putchar(void)
|
||||
{
|
||||
int c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)putchar(c);
|
||||
}
|
||||
|
||||
void uninitvar_putwchar(void)
|
||||
{
|
||||
wchar_t c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)putwchar(c);
|
||||
}
|
||||
|
||||
void uninitvar_puts(void)
|
||||
{
|
||||
char *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)puts(s);
|
||||
}
|
||||
|
||||
void uninitvar_realloc(void)
|
||||
{
|
||||
void *block;
|
||||
size_t newsize;
|
||||
// cppcheck-suppress uninitvar
|
||||
void *p = realloc(block, newsize);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void uninitvar_remove(void)
|
||||
{
|
||||
char *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)remove(s);
|
||||
}
|
||||
|
||||
void uninitvar_rename(void)
|
||||
{
|
||||
char *s1;
|
||||
char *s2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)rename(s1,s2);
|
||||
}
|
||||
|
||||
void uninitvar_rewind(void)
|
||||
{
|
||||
FILE *f;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)rewind(f);
|
||||
}
|
||||
|
||||
void uninitvar_round(void)
|
||||
{
|
||||
float f;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)roundf(f);
|
||||
|
||||
double d;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)round(d);
|
||||
|
||||
long double ld;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)roundl(ld);
|
||||
}
|
||||
|
|
102
test/cfg/std.cpp
102
test/cfg/std.cpp
|
@ -1879,3 +1879,105 @@ void uninivar_vwprintf(void)
|
|||
// cppcheck-suppress uninitvar
|
||||
(void)std::vwprintf(format,arg);
|
||||
}
|
||||
|
||||
void uninivar_bsearch(void)
|
||||
{
|
||||
void* key;
|
||||
void* base;
|
||||
size_t num;
|
||||
size_t size;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::bsearch(key,base,num,size,(int(*)(const void*,const void*)) strcmp);
|
||||
}
|
||||
|
||||
void uninitvar_qsort(void)
|
||||
{
|
||||
void *base;
|
||||
size_t n;
|
||||
size_t size;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::qsort(base,n,size, (int(*)(const void*,const void*)) strcmp);
|
||||
}
|
||||
|
||||
void uninitvar_putc(void)
|
||||
{
|
||||
int c;
|
||||
FILE *stream;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::putc(c,stream);
|
||||
}
|
||||
|
||||
void uninitvar_putwc(void)
|
||||
{
|
||||
wchar_t c;
|
||||
FILE *stream;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::putc(c,stream);
|
||||
}
|
||||
|
||||
void uninitvar_putchar(void)
|
||||
{
|
||||
int c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::putchar(c);
|
||||
}
|
||||
|
||||
void uninitvar_putwchar(void)
|
||||
{
|
||||
wchar_t c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::putwchar(c);
|
||||
}
|
||||
|
||||
void uninitvar_puts(void)
|
||||
{
|
||||
char *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::puts(s);
|
||||
}
|
||||
|
||||
void uninitvar_realloc(void)
|
||||
{
|
||||
void *block;
|
||||
size_t newsize;
|
||||
// cppcheck-suppress uninitvar
|
||||
void *p = std::realloc(block, newsize);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void uninitvar_remove(void)
|
||||
{
|
||||
char *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::remove(s);
|
||||
}
|
||||
|
||||
void uninitvar_rename(void)
|
||||
{
|
||||
char *s1;
|
||||
char *s2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::rename(s1,s2);
|
||||
}
|
||||
|
||||
void uninitvar_rewind(void)
|
||||
{
|
||||
FILE *f;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::rewind(f);
|
||||
}
|
||||
|
||||
void uninitvar_round(void)
|
||||
{
|
||||
float f;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::roundf(f);
|
||||
|
||||
double d;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::round(d);
|
||||
|
||||
long double ld;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::roundl(ld);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue