Improved testing of std.cfg regarding uninitialized variables.
This commit is contained in:
parent
27b3461e84
commit
6304eb35f9
28
cfg/std.cfg
28
cfg/std.cfg
|
@ -86,6 +86,7 @@
|
|||
<!-- void assert(int expression) -->
|
||||
<function name="assert">
|
||||
<leak-ignore/>
|
||||
<noreturn>true</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
@ -2749,50 +2750,62 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int scanf(const char *format, ...); -->
|
||||
<function name="scanf">
|
||||
<function name="scanf,std::scanf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<formatstr scan="true"/>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<formatstr/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- int vsscanf(const char *s, const char *format, va_list arg); -->
|
||||
<function name="vsscanf">
|
||||
<function name="vsscanf,std::vsscanf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<formatstr scan="true"/>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
<formatstr/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="3"/>
|
||||
</function>
|
||||
<!-- int vswscanf(const wchar_t *s, const wchar_t *format, va_list arg); -->
|
||||
<function name="vswscanf">
|
||||
<function name="vswscanf,std::vswscanf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<formatstr scan="true"/>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
<formatstr/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="3"/>
|
||||
</function>
|
||||
<!-- int vscanf(const char *format, va_list arg); -->
|
||||
<function name="vscanf">
|
||||
<function name="vscanf,std::vscanf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<formatstr scan="true"/>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<formatstr/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="2"/>
|
||||
</function>
|
||||
<!-- int vscanf(const wchar_t *format, va_list arg); -->
|
||||
<function name="vwscanf">
|
||||
<function name="vwscanf,std::vwscanf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<formatstr scan="true"/>
|
||||
|
@ -2803,7 +2816,7 @@
|
|||
<arg nr="2"/>
|
||||
</function>
|
||||
<!-- void setbuf(FILE *stream, char *buf); -->
|
||||
<function name="setbuf">
|
||||
<function name="setbuf,std::setbuf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -2815,7 +2828,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- int setvbuf(FILE* stream, char *buf, int mode, size_t size); -->
|
||||
<function name="setvbuf">
|
||||
<function name="setvbuf,std::setvbuf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -3908,6 +3921,7 @@
|
|||
<podtype name="lldiv_t"/>
|
||||
<podtype name="mbstate_t"/>
|
||||
<podtype name="wint_t"/>
|
||||
<podtype name="jmp_buf"/>
|
||||
<!--Not part of standard, but widely supported by runtime libraries-->
|
||||
<function name="itoa">
|
||||
<noreturn>false</noreturn>
|
||||
|
|
|
@ -405,14 +405,12 @@ void uninitvar_asctime(void)
|
|||
(void)asctime(tm);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void uninitvar_assert(void)
|
||||
{
|
||||
int i;
|
||||
// cppcheck-suppress uninitvar
|
||||
assert(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
void uninitvar_sqrt(void)
|
||||
{
|
||||
|
@ -2716,3 +2714,74 @@ void uninivar_raise(void)
|
|||
// cppcheck-suppress uninitvar
|
||||
(void)raise(i);
|
||||
}
|
||||
|
||||
void uninivar_scanf(void)
|
||||
{
|
||||
char *format;
|
||||
char str[42];
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)scanf(format, str);
|
||||
}
|
||||
|
||||
void uninivar_vsscanf(void)
|
||||
{
|
||||
char *s;
|
||||
char *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)vsscanf(s,format,arg);
|
||||
}
|
||||
|
||||
void uninivar_vswscanf(void)
|
||||
{
|
||||
wchar_t *s;
|
||||
wchar_t *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)vswscanf(s,format,arg);
|
||||
}
|
||||
|
||||
void uninivar_vscanf(void)
|
||||
{
|
||||
char *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)vscanf(format,arg);
|
||||
}
|
||||
|
||||
void uninivar_vwscanf(void)
|
||||
{
|
||||
wchar_t *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)vwscanf(format,arg);
|
||||
}
|
||||
|
||||
void uninivar_setbuf(void)
|
||||
{
|
||||
FILE *stream;
|
||||
char *buf;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)setbuf(stream,buf);
|
||||
}
|
||||
|
||||
void uninivar_setvbuf(void)
|
||||
{
|
||||
FILE *stream;
|
||||
char *buf;
|
||||
int mode;
|
||||
size_t size;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)setvbuf(stream,buf,mode,size);
|
||||
}
|
||||
|
||||
void uninivar_setjmp(void) // #6977
|
||||
{
|
||||
jmp_buf j;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)setjmp(j);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <csetjmp>
|
||||
#include <cmath>
|
||||
#include <csignal>
|
||||
#include <csetjmp>
|
||||
|
||||
void bufferAccessOutOfBounds(void)
|
||||
{
|
||||
|
@ -2039,3 +2040,67 @@ void uninivar_raise(void)
|
|||
// cppcheck-suppress uninitvar
|
||||
(void)std::raise(i);
|
||||
}
|
||||
|
||||
void uninivar_scanf(void)
|
||||
{
|
||||
char *format;
|
||||
char str[42];
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::scanf(format, str);
|
||||
}
|
||||
|
||||
void uninivar_vsscanf(void)
|
||||
{
|
||||
char *s;
|
||||
char *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::vsscanf(s,format,arg);
|
||||
}
|
||||
|
||||
void uninivar_vswscanf(void)
|
||||
{
|
||||
wchar_t *s;
|
||||
wchar_t *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::vswscanf(s,format,arg);
|
||||
}
|
||||
|
||||
void uninivar_vscanf(void)
|
||||
{
|
||||
char *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::vscanf(format,arg);
|
||||
}
|
||||
|
||||
void uninivar_vwscanf(void)
|
||||
{
|
||||
wchar_t *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::vwscanf(format,arg);
|
||||
}
|
||||
|
||||
void uninivar_setbuf(void)
|
||||
{
|
||||
FILE *stream;
|
||||
char *buf;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::setbuf(stream,buf);
|
||||
}
|
||||
|
||||
void uninivar_setvbuf(void)
|
||||
{
|
||||
FILE *stream;
|
||||
char *buf;
|
||||
int mode;
|
||||
size_t size;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::setvbuf(stream,buf,mode,size);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue