Improved testing of std.cfg regarding uninitialized variables.
This commit is contained in:
parent
f653189bd4
commit
d1ba919e39
|
@ -1033,7 +1033,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- size_t fread(void *ptr, size_t size, size_t nobj, FILE *stream); -->
|
<!-- size_t fread(void *ptr, size_t size, size_t nobj, FILE *stream); -->
|
||||||
<function name="fread">
|
<function name="fread,std::fread">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -1052,14 +1052,14 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void free(void *block); -->
|
<!-- void free(void *block); -->
|
||||||
<function name="free">
|
<function name="free,std::free">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- FILE *freopen(const char *filename, const char *mode, FILE *stream); -->
|
<!-- FILE *freopen(const char *filename, const char *mode, FILE *stream); -->
|
||||||
<function name="freopen">
|
<function name="freopen,std::freopen">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
|
|
@ -1296,6 +1296,34 @@ void uninitvar_fputws(void)
|
||||||
(void)fputws(string,stream);
|
(void)fputws(string,stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uninitvar_fread(void)
|
||||||
|
{
|
||||||
|
void *ptr;
|
||||||
|
size_t size;
|
||||||
|
size_t nobj;
|
||||||
|
FILE *stream;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)fread(ptr,size,nobj,stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitvar_free(void)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress unassignedVariable
|
||||||
|
void *block;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
free(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitvar_freopen(void)
|
||||||
|
{
|
||||||
|
char *filename;
|
||||||
|
char *mode;
|
||||||
|
FILE *stream;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
FILE * p = freopen(filename,mode,stream);
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
|
|
||||||
void ignoreretrn(void)
|
void ignoreretrn(void)
|
||||||
{
|
{
|
||||||
char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff";
|
char szNumbers[] = "2001 60c0c0 -1101110100110100100000 0x6fffff";
|
||||||
|
|
|
@ -818,3 +818,31 @@ void uninitvar_fputws(void)
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
(void)std::fputws(string,stream);
|
(void)std::fputws(string,stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uninitvar_fread(void)
|
||||||
|
{
|
||||||
|
void *ptr;
|
||||||
|
size_t size;
|
||||||
|
size_t nobj;
|
||||||
|
FILE *stream;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::fread(ptr,size,nobj,stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitvar_free(void)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress unassignedVariable
|
||||||
|
void *block;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
std::free(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitvar_freopen(void)
|
||||||
|
{
|
||||||
|
char *filename;
|
||||||
|
char *mode;
|
||||||
|
FILE *stream;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
FILE * p = std::freopen(filename,mode,stream);
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue