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>
|
||||
</function>
|
||||
<!-- 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>
|
||||
<leak-ignore/>
|
||||
<arg nr="2">
|
||||
|
@ -3382,7 +3382,7 @@
|
|||
</arg>
|
||||
</function>
|
||||
<!-- char *strtok(char *s, const char *ct); -->
|
||||
<function name="strtok">
|
||||
<function name="strtok,std::strtok">
|
||||
<pure/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
|
@ -3396,7 +3396,7 @@
|
|||
</function>
|
||||
<!-- intmax_t strtoimax(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>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -3410,8 +3410,8 @@
|
|||
</function>
|
||||
<!-- float strtof(const char *s, char **endp); -->
|
||||
<!-- double strtod(const char *s, char **endp); -->
|
||||
<!-- long double strtod(const char *s, char **endp); -->
|
||||
<function name="strtof,strtod,strtold">
|
||||
<!-- long double strtold(const char *s, char **endp); -->
|
||||
<function name="strtof,std::strtof,strtod,std::strtod,strtold,std::strtold">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -3425,7 +3425,7 @@
|
|||
<!-- unsigned long strtoul(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); -->
|
||||
<function name="strtol,strtoul,strtoll,strtoull">
|
||||
<function name="strtol,std::strtol,strtoul,std::strtoul,strtoll,std::strtoll,strtoull,std::strtoull">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
@ -3434,11 +3434,12 @@
|
|||
<strz/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
<valid>0,2:36</valid>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- time_t time(time_t *tp); -->
|
||||
<function name="time">
|
||||
<function name="time,std::time">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1">
|
||||
|
|
|
@ -34,8 +34,7 @@ public:
|
|||
FunctionListItem(QListWidget *view,
|
||||
CppcheckLibraryData::Function *function,
|
||||
bool selected)
|
||||
: QListWidgetItem(view), function(function)
|
||||
{
|
||||
: QListWidgetItem(view), function(function) {
|
||||
setText(function->name);
|
||||
setFlags(flags() | Qt::ItemIsEditable);
|
||||
setSelected(selected);
|
||||
|
@ -92,8 +91,8 @@ void LibraryDialog::openCfg()
|
|||
ui->functions->clear();
|
||||
for (struct CppcheckLibraryData::Function &function : data.functions) {
|
||||
ui->functions->addItem(new FunctionListItem(ui->functions,
|
||||
&function,
|
||||
false));
|
||||
&function,
|
||||
false));
|
||||
}
|
||||
ui->sortFunctions->setEnabled(!data.functions.empty());
|
||||
ui->filter->setEnabled(!data.functions.empty());
|
||||
|
@ -185,8 +184,8 @@ void LibraryDialog::sortFunctions(bool sort)
|
|||
ui->functions->clear();
|
||||
for (struct CppcheckLibraryData::Function &function : data.functions) {
|
||||
ui->functions->addItem(new FunctionListItem(ui->functions,
|
||||
&function,
|
||||
selfunction == &function));
|
||||
&function,
|
||||
selfunction == &function));
|
||||
}
|
||||
if (!ui->filter->text().isEmpty())
|
||||
filterFunctions(ui->filter->text());
|
||||
|
|
|
@ -3073,3 +3073,66 @@ void uninivar_wcsrchr(void)
|
|||
// cppcheck-suppress uninitvar
|
||||
(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 <csignal>
|
||||
#include <csetjmp>
|
||||
#include <cinttypes>
|
||||
|
||||
void bufferAccessOutOfBounds(void)
|
||||
{
|
||||
|
@ -2383,3 +2384,65 @@ void uninivar_wcsrchr(void)
|
|||
(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