test/cfg: Improved testing of std.cfg regarding uninitialized variables.
This commit is contained in:
parent
a32aa03035
commit
60770a8fdc
15
cfg/std.cfg
15
cfg/std.cfg
|
@ -3367,7 +3367,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- size_t wcsrtombs(char *dst, const wchar_t **src, size_t len, mbstate_t *ps); -->
|
<!-- size_t wcsrtombs(char *dst, const wchar_t **src, size_t len, mbstate_t *ps); -->
|
||||||
<function name="wcsrtombs">
|
<function name="wcsrtombs,std::wcsrtombs">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="2">
|
<arg nr="2">
|
||||||
|
@ -3382,7 +3382,7 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- char *strtok(char *s, const char *ct); -->
|
<!-- char *strtok(char *s, const char *ct); -->
|
||||||
<function name="strtok">
|
<function name="strtok,std::strtok">
|
||||||
<pure/>
|
<pure/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
|
@ -3396,7 +3396,7 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- intmax_t strtoimax(const char *s, char **endp, int base); -->
|
<!-- intmax_t strtoimax(const char *s, char **endp, int base); -->
|
||||||
<!-- uintmax_t strtoumax(const char *s, char **endp, int base); -->
|
<!-- uintmax_t strtoumax(const char *s, char **endp, int base); -->
|
||||||
<function name="strtoimax,strtoumax">
|
<function name="strtoimax,std::strtoimax,strtoumax,std::strtoumax">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -3410,8 +3410,8 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- float strtof(const char *s, char **endp); -->
|
<!-- float strtof(const char *s, char **endp); -->
|
||||||
<!-- double strtod(const char *s, char **endp); -->
|
<!-- double strtod(const char *s, char **endp); -->
|
||||||
<!-- long double strtod(const char *s, char **endp); -->
|
<!-- long double strtold(const char *s, char **endp); -->
|
||||||
<function name="strtof,strtod,strtold">
|
<function name="strtof,std::strtof,strtod,std::strtod,strtold,std::strtold">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -3425,7 +3425,7 @@
|
||||||
<!-- unsigned long strtoul(const char *s, char **endp, int base); -->
|
<!-- unsigned long strtoul(const char *s, char **endp, int base); -->
|
||||||
<!-- long long strtoll(const char *s, char **endp, int base); -->
|
<!-- long long strtoll(const char *s, char **endp, int base); -->
|
||||||
<!-- unsigned long long strtoull(const char *s, char **endp, int base); -->
|
<!-- unsigned long long strtoull(const char *s, char **endp, int base); -->
|
||||||
<function name="strtol,strtoul,strtoll,strtoull">
|
<function name="strtol,std::strtol,strtoul,std::strtoul,strtoll,std::strtoll,strtoull,std::strtoull">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -3434,11 +3434,12 @@
|
||||||
<strz/>
|
<strz/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="3">
|
<arg nr="3">
|
||||||
|
<not-uninit/>
|
||||||
<valid>0,2:36</valid>
|
<valid>0,2:36</valid>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- time_t time(time_t *tp); -->
|
<!-- time_t time(time_t *tp); -->
|
||||||
<function name="time">
|
<function name="time,std::time">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
|
|
@ -34,8 +34,7 @@ public:
|
||||||
FunctionListItem(QListWidget *view,
|
FunctionListItem(QListWidget *view,
|
||||||
CppcheckLibraryData::Function *function,
|
CppcheckLibraryData::Function *function,
|
||||||
bool selected)
|
bool selected)
|
||||||
: QListWidgetItem(view), function(function)
|
: QListWidgetItem(view), function(function) {
|
||||||
{
|
|
||||||
setText(function->name);
|
setText(function->name);
|
||||||
setFlags(flags() | Qt::ItemIsEditable);
|
setFlags(flags() | Qt::ItemIsEditable);
|
||||||
setSelected(selected);
|
setSelected(selected);
|
||||||
|
|
|
@ -3073,3 +3073,66 @@ void uninivar_wcsrchr(void)
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
(void)wcsrchr(ws,wc);
|
(void)wcsrchr(ws,wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uninivar_wcsrtombs(void)
|
||||||
|
{
|
||||||
|
char *dst;
|
||||||
|
const wchar_t * p;;
|
||||||
|
size_t len;
|
||||||
|
mbstate_t *ps;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)wcsrtombs(dst,&p,len,ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtok(void)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
char *ct;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtok(s,ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtoimax(void)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
char **endp;
|
||||||
|
int base;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtoimax(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtoumax(s,endp,base);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtof(void)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
char **endp;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtof(s,endp);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtod(s,endp);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtold(s,endp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtol(void)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
char **endp;
|
||||||
|
int base;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtol(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtoll(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtoul(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strtoull(s,endp,base);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitvar_time(void)
|
||||||
|
{
|
||||||
|
time_t *tp;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)time(tp);
|
||||||
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <csetjmp>
|
#include <csetjmp>
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
void bufferAccessOutOfBounds(void)
|
void bufferAccessOutOfBounds(void)
|
||||||
{
|
{
|
||||||
|
@ -2383,3 +2384,65 @@ void uninivar_wcsrchr(void)
|
||||||
(void)std::wcsrchr(ws,wc);
|
(void)std::wcsrchr(ws,wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uninivar_wcsrtombs(void)
|
||||||
|
{
|
||||||
|
char *dst;
|
||||||
|
const wchar_t * p;;
|
||||||
|
size_t len;
|
||||||
|
mbstate_t *ps;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::wcsrtombs(dst,&p,len,ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtok(void)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
char *ct;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtok(s,ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtoimax(void)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
char **endp;
|
||||||
|
int base;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtoimax(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtoumax(s,endp,base);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtof(void)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
char **endp;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtof(s,endp);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtod(s,endp);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtold(s,endp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninivar_strtol(void)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
char **endp;
|
||||||
|
int base;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtol(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtoll(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtoul(s,endp,base);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::strtoull(s,endp,base);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitvar_time(void)
|
||||||
|
{
|
||||||
|
time_t *tp;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)std::time(tp);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue