Travis: Try to fix 'make checkcfg'

This commit is contained in:
Daniel Marjamäki 2019-03-02 19:38:11 +01:00
parent cb575576c7
commit 5087f15035
6 changed files with 253 additions and 228 deletions

View File

@ -15,15 +15,15 @@ void uninitvar_strlcat(char *Ct, const char *S, size_t N)
{
char *ct;
char *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)strlcat(ct,s,n);
(void)strlcat(ct,s,n1);
// cppcheck-suppress uninitvar
(void)strlcat(ct,S,N);
// cppcheck-suppress uninitvar
(void)strlcat(Ct,s,N);
// cppcheck-suppress uninitvar
(void)strlcat(Ct,S,n);
(void)strlcat(Ct,S,n2);
// no warning is expected for
(void)strlcat(Ct,S,N);

View File

@ -217,18 +217,18 @@ void invalidFunctionArg()
void uninitvar(int fd)
{
int x;
int x1, x2, x3, x4;
char buf[2];
int decimal, sign;
double d;
void *p;
pthread_mutex_t mutex;
pthread_mutex_t mutex, mutex1, mutex2, mutex3;
// cppcheck-suppress uninitvar
write(x,"ab",2);
write(x1,"ab",2);
// TODO cppcheck-suppress uninitvar
write(fd,buf,2); // #6325
// cppcheck-suppress uninitvar
write(fd,"ab",x);
write(fd,"ab",x2);
// cppcheck-suppress uninitvar
write(fd,p,2);
@ -236,12 +236,12 @@ void uninitvar(int fd)
/* int regcomp(regex_t *restrict preg, const char *restrict pattern, int cflags); */
regex_t reg;
const char * pattern;
int cflags;
int cflags1, cflags2;
// cppcheck-suppress uninitvar
regcomp(&reg, pattern, cflags);
regcomp(&reg, pattern, cflags1);
pattern="";
// cppcheck-suppress uninitvar
regcomp(&reg, pattern, cflags);
regcomp(&reg, pattern, cflags2);
regerror(0, &reg, 0, 0);
#ifndef __CYGWIN__
// cppcheck-suppress uninitvar
@ -264,12 +264,12 @@ void uninitvar(int fd)
// cppcheck-suppress unreadVariable
// cppcheck-suppress uninitvar
int access_ret = access("file", x);
int access_ret = access("file", x3);
// cppcheck-suppress ignoredReturnValue
// cppcheck-suppress leakReturnValNotUsed
// cppcheck-suppress uninitvar
fdopen(x, "rw");
fdopen(x4, "rw");
char *strtok_arg1;
// cppcheck-suppress strtokCalled
@ -277,11 +277,11 @@ void uninitvar(int fd)
strtok(strtok_arg1, ";");
// cppcheck-suppress uninitvar
pthread_mutex_lock(&mutex);
pthread_mutex_lock(&mutex1);
// cppcheck-suppress uninitvar
pthread_mutex_trylock(&mutex);
pthread_mutex_trylock(&mutex2);
// cppcheck-suppress uninitvar
pthread_mutex_unlock(&mutex);
pthread_mutex_unlock(&mutex3);
// after initialization it must be OK to call lock, trylock and unlock for this mutex
pthread_mutex_init(&mutex, NULL);
pthread_mutex_lock(&mutex);
@ -312,20 +312,20 @@ void uninitvar_types(void)
void timet_h(struct timespec* ptp1)
{
clockid_t clk_id;
clockid_t clk_id1, clk_id2, clk_id3;
struct timespec* ptp;
// cppcheck-suppress uninitvar
clock_settime(CLOCK_REALTIME, ptp);
// cppcheck-suppress uninitvar
clock_settime(clk_id, ptp);
clock_settime(clk_id1, ptp);
// cppcheck-suppress uninitvar
clock_settime(clk_id, ptp1);
clock_settime(clk_id2, ptp1);
struct timespec tp;
// TODO cppcheck-suppress uninitvar
clock_settime(CLOCK_REALTIME, &tp); // #6577 - false negative
// cppcheck-suppress uninitvar
clock_settime(clk_id, &tp);
clock_settime(clk_id3, &tp);
time_t clock = time(0);
char buf[26];

View File

@ -1300,16 +1300,16 @@ void uninitvar_fmod(void)
void uninitvar_fprintf(FILE *Stream, char *Format, int Argument)
{
FILE *stream;
char *format;
int argument;
char *format1, *format2;
int argument1, argument2;
// cppcheck-suppress uninitvar
(void)fprintf(stream, format, argument);
(void)fprintf(stream, format1, argument1);
// cppcheck-suppress uninitvar
(void)fprintf(stream, Format, Argument);
// cppcheck-suppress uninitvar
(void)fprintf(Stream, format, Argument);
(void)fprintf(Stream, format2, Argument);
// cppcheck-suppress uninitvar
(void)fprintf(Stream, Format, argument);
(void)fprintf(Stream, Format, argument2);
// no warning is expected
(void)fprintf(Stream, Format, Argument);
@ -1318,15 +1318,15 @@ void uninitvar_fprintf(FILE *Stream, char *Format, int Argument)
void uninitvar_vfprintf(FILE *Stream, const char *Format, va_list Arg)
{
FILE *stream;
char *format;
char *format1, *format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vfprintf(stream, format, arg);
(void)vfprintf(stream, format1, arg);
// cppcheck-suppress uninitvar
(void)vfprintf(stream, Format, Arg);
// cppcheck-suppress uninitvar
(void)vfprintf(Stream, format, Arg);
(void)vfprintf(Stream, format2, Arg);
// no warning is expected
(void)vfprintf(Stream, Format, Arg);
@ -1337,15 +1337,15 @@ void uninitvar_vfprintf(FILE *Stream, const char *Format, va_list Arg)
void uninitvar_vfwprintf(FILE *Stream, wchar_t *Format, va_list Arg)
{
FILE *stream;
wchar_t *format;
wchar_t *format1, *format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vfwprintf(stream, format, arg);
(void)vfwprintf(stream, format1, arg);
// cppcheck-suppress uninitvar
(void)vfwprintf(stream, Format, Arg);
// cppcheck-suppress uninitvar
(void)vfwprintf(Stream, format, Arg);
(void)vfwprintf(Stream, format2, Arg);
// no warning is expected
(void)vfwprintf(Stream, Format, Arg);
@ -1515,16 +1515,16 @@ void uninitvar_mbtowc(void)
void uninitvar_mbrlen(const char* p, size_t m, mbstate_t* s)
{
char* pmb;
size_t max;
mbstate_t* ps;
size_t max1, max2;
mbstate_t* ps1, *ps2;
// cppcheck-suppress uninitvar
(void)mbrlen(pmb,max,ps);
(void)mbrlen(pmb,max1,ps1);
// cppcheck-suppress uninitvar
(void)mbrlen(pmb,m,s);
// cppcheck-suppress uninitvar
(void)mbrlen(p,max,s);
(void)mbrlen(p,max2,s);
// cppcheck-suppress uninitvar
(void)mbrlen(p,m,ps);
(void)mbrlen(p,m,ps2);
// no warning is expected
(void)mbrlen(p,m,s);
}
@ -2581,13 +2581,13 @@ void uninitvar_remquo(void)
void uninitvar_printf(char *Format, int Argument)
{
char * format;
int argument;
int argument1, argument2;
// no warning is expected
(void)printf("x");
// cppcheck-suppress uninitvar
(void)printf(format,argument);
(void)printf(format,argument1);
// cppcheck-suppress uninitvar
(void)printf(Format,argument);
(void)printf(Format,argument2);
// cppcheck-suppress uninitvar
(void)printf(format,Argument);
// cppcheck-suppress uninitvar
@ -2599,29 +2599,29 @@ void uninitvar_printf(char *Format, int Argument)
void uninitvar_vprintf(char *Format, va_list Arg)
{
char * format;
va_list arg;
char * format1, *format2;
va_list arg1, arg2;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vprintf(format,arg);
(void)vprintf(format1,arg1);
// cppcheck-suppress uninitvar
(void)vprintf(format,Arg);
(void)vprintf(format2,Arg);
// no warning is expected
(void)vprintf(Format,Arg);
// cppcheck-suppress va_list_usedBeforeStarted
(void)vprintf(Format,arg);
(void)vprintf(Format,arg2);
}
void uninitvar_vwprintf(wchar_t *Format, va_list Arg)
{
wchar_t * format;
wchar_t * format1, * format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vwprintf(format,arg);
(void)vwprintf(format1,arg);
// cppcheck-suppress uninitvar
(void)vwprintf(format,Arg);
(void)vwprintf(format2,Arg);
// no warning is expected
(void)vwprintf(Format,Arg);
@ -2840,14 +2840,14 @@ void uninitvar_setvbuf(void)
void uninitvar_strcat(char *dest, const char * const source)
{
char *deststr;
char *deststr1, *deststr2;
char *srcstr;
// cppcheck-suppress uninitvar
(void)strcat(deststr,srcstr);
(void)strcat(deststr1,srcstr);
// cppcheck-suppress uninitvar
(void)strcat(dest,srcstr);
// cppcheck-suppress uninitvar
(void)strcat(deststr,source);
(void)strcat(deststr2,source);
// no warning shall be shown for
(void)strcat(dest,source);
@ -2995,15 +2995,17 @@ void uninitvar_strncpy_s(char *Ct, size_t N1, char *S, size_t N2)
char *s;
size_t n1;
size_t n2;
size_t n3;
size_t n4;
// cppcheck-suppress uninitvar
(void)strncpy_s(dest,n1,s,n2);
// cppcheck-suppress uninitvar
(void)strncpy_s(Ct,n1,S,N2);
(void)strncpy_s(Ct,n3,S,N2);
// cppcheck-suppress uninitvar
(void)strncpy_s(Ct,N1,s,N2);
// cppcheck-suppress uninitvar
(void)strncpy_s(Ct,N1,S,n2);
(void)strncpy_s(Ct,N1,S,n4);
// no warning is expected for
(void)strncpy_s(Ct,N1,S,N2);
@ -3022,15 +3024,15 @@ void uninitvar_strncat(char *Ct, char *S, size_t N)
{
char *ct;
char *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)strncat(ct,s,n);
(void)strncat(ct,s,n1);
// cppcheck-suppress uninitvar
(void)strncat(ct,S,N);
// cppcheck-suppress uninitvar
(void)strncat(Ct,s,N);
// cppcheck-suppress uninitvar
(void)strncat(Ct,S,n);
(void)strncat(Ct,S,n2);
// no warning is expected for
(void)strncat(Ct,S,N);
@ -3041,15 +3043,15 @@ void uninitvar_strcat_s(char *Ct, size_t N, char *S)
{
char *ct;
char *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)strcat_s(ct,n,s);
(void)strcat_s(ct,n1,s);
// cppcheck-suppress uninitvar
(void)strcat_s(ct,N,S);
// cppcheck-suppress uninitvar
(void)strcat_s(Ct,N,s);
// cppcheck-suppress uninitvar
(void)strcat_s(Ct,n,S);
(void)strcat_s(Ct,n2,S);
// no warning is expected for
(void) strcat_s(Ct,N,S);
@ -3060,15 +3062,15 @@ void uninitvar_wcscat_s(wchar_t *Ct, size_t N, wchar_t *S)
{
wchar_t *ct;
wchar_t *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)wcscat_s(ct,n,s);
(void)wcscat_s(ct,n1,s);
// cppcheck-suppress uninitvar
(void)wcscat_s(ct,N,S);
// cppcheck-suppress uninitvar
(void)wcscat_s(Ct,N,s);
// cppcheck-suppress uninitvar
(void)wcscat_s(Ct,n,S);
(void)wcscat_s(Ct,n2,S);
// no warning is expected for
(void) wcscat_s(Ct,N,S);
@ -3080,17 +3082,19 @@ void uninitvar_strncat_s(char *Ct, size_t N1, char *S, size_t N2)
char *s;
size_t n1;
size_t n2;
size_t n3;
size_t n4;
// cppcheck-suppress uninitvar
(void)strncat_s(ct,n1,s,n2);
// cppcheck-suppress uninitvar
(void)strncat_s(ct,N1,S,N2);
// cppcheck-suppress uninitvar
(void)strncat_s(Ct,n1,S,N2);
(void)strncat_s(Ct,n3,S,N2);
// cppcheck-suppress uninitvar
(void)strncat_s(Ct,N1,s,N2);
// cppcheck-suppress uninitvar
(void)strncat_s(Ct,N1,S,n2);
(void)strncat_s(Ct,N1,S,n4);
// no warning is expected for
(void)strncat_s(Ct,N1,S,N2);
@ -3100,15 +3104,15 @@ void uninitvar_wcsncat(wchar_t *Ct, wchar_t *S, size_t N)
{
wchar_t *ct;
wchar_t *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)wcsncat(ct,s,n);
(void)wcsncat(ct,s,n1);
// cppcheck-suppress uninitvar
(void)wcsncat(ct,S,N);
// cppcheck-suppress uninitvar
(void)wcsncat(Ct,s,N);
// cppcheck-suppress uninitvar
(void)wcsncat(Ct,S,n);
(void)wcsncat(Ct,S,n2);
// no warning is expected for
(void)wcsncat(Ct,S,N);
@ -3118,15 +3122,15 @@ void uninitvar_strncmp(char *Ct, char *S, size_t N)
{
char *ct;
char *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)strncmp(ct,s,n);
(void)strncmp(ct,s,n1);
// cppcheck-suppress uninitvar
(void)strncmp(ct,S,N);
// cppcheck-suppress uninitvar
(void)strncmp(Ct,s,N);
// cppcheck-suppress uninitvar
(void)strncmp(Ct,S,n);
(void)strncmp(Ct,S,n2);
// no warning is expected for
(void)strncmp(Ct,S,N);
@ -3136,15 +3140,15 @@ void uninitvar_wcsncmp(wchar_t *Ct, wchar_t *S, size_t N)
{
wchar_t *ct;
wchar_t *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)wcsncmp(ct,s,n);
(void)wcsncmp(ct,s,n1);
// cppcheck-suppress uninitvar
(void)wcsncmp(ct,S,N);
// cppcheck-suppress uninitvar
(void)wcsncmp(Ct,s,N);
// cppcheck-suppress uninitvar
(void)wcsncmp(Ct,S,n);
(void)wcsncmp(Ct,S,n2);
// no warning is expected for
(void)wcsncmp(Ct,S,N);
@ -3423,16 +3427,16 @@ void uninitvar_wcstol(void)
void uninitvar_wprintf(wchar_t *Format, int Argument)
{
const wchar_t *format;
int argument;
const wchar_t *format1, *format2, *format3;
int argument1, argument2;
// cppcheck-suppress uninitvar
(void)wprintf(format,argument);
(void)wprintf(format1,argument1);
// cppcheck-suppress uninitvar
(void)wprintf(format);
(void)wprintf(format2);
// cppcheck-suppress uninitvar
(void)wprintf(Format,argument);
(void)wprintf(Format,argument2);
// cppcheck-suppress uninitvar
(void)wprintf(format,Argument);
(void)wprintf(format3,Argument);
// no warning is expected
(void)wprintf(Format,Argument);
(void)wprintf(Format);
@ -3440,17 +3444,17 @@ void uninitvar_wprintf(wchar_t *Format, int Argument)
void uninitvar_sprintf(char *S, char *Format, int Argument)
{
char *s;
const char *format;
int argument;
char *s1, *s2;
const char *format1, *format2;
int argument1, argument2;
// cppcheck-suppress uninitvar
(void)sprintf(s,format,argument);
(void)sprintf(s1,format1,argument1);
// cppcheck-suppress uninitvar
(void)sprintf(s,Format,Argument);
(void)sprintf(s2,Format,Argument);
// cppcheck-suppress uninitvar
(void)sprintf(S,format,Argument);
(void)sprintf(S,format2,Argument);
// cppcheck-suppress uninitvar
(void)sprintf(S,Format,argument);
(void)sprintf(S,Format,argument2);
// no warning is expected for
(void)sprintf(S,Format,Argument);
@ -3515,20 +3519,20 @@ void uninitvar_fwprintf(void)
void uninitvar_snprintf(char *S, size_t N, char *Format, int Int)
{
size_t n;
size_t n1,n2;
char *format;
int i;
char *s;
int i1, i2;
char *s1, *s2;
// cppcheck-suppress uninitvar
(void)snprintf(s,n,format,i);
(void)snprintf(s1,n1,format,i1);
// cppcheck-suppress uninitvar
(void)snprintf(S,n,Format,Int); // n is uninitialized
(void)snprintf(S,n2,Format,Int); // n is uninitialized
// cppcheck-suppress uninitvar
(void)snprintf(S,N,format,Int); // format is uninitialized
// cppcheck-suppress uninitvar
(void)snprintf(S,N,Format,i); // i is uninitialized
(void)snprintf(S,N,Format,i2); // i is uninitialized
// cppcheck-suppress uninitvar
(void)snprintf(s,N,Format,Int);
(void)snprintf(s2,N,Format,Int);
// no warning is expected for
(void)snprintf(S,N,Format,Int);
@ -3536,19 +3540,19 @@ void uninitvar_snprintf(char *S, size_t N, char *Format, int Int)
void uninitvar_vsnprintf(char *S, size_t N, char *Format, va_list Arg)
{
char *s;
size_t n;
char *format;
char *s1, *s2;
size_t n1, n2;
char *format1, *format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)vsnprintf(s,n,format,arg);
(void)vsnprintf(s1,n1,format1,arg);
// cppcheck-suppress uninitvar
(void)vsnprintf(s,N,Format,Arg);
(void)vsnprintf(s2,N,Format,Arg);
// cppcheck-suppress uninitvar
(void)vsnprintf(S,n,Format,Arg);
(void)vsnprintf(S,n2,Format,Arg);
// cppcheck-suppress uninitvar
(void)vsnprintf(S,N,format,Arg);
(void)vsnprintf(S,N,format2,Arg);
// no warning is expected for
(void)vsnprintf(S,N,Format,Arg);
@ -3580,23 +3584,23 @@ void uninitvar_sscanf(void)
void uninitvar_fwscanf(void)
{
FILE* stream;
wchar_t* format;
wchar_t* format1, *format2;
int i;
// cppcheck-suppress uninitvar
(void)fwscanf(stream,format);
(void)fwscanf(stream,format1);
// cppcheck-suppress uninitvar
(void)fwscanf(stream,format,&i);
(void)fwscanf(stream,format2,&i);
}
void uninitvar_swscanf(void)
{
wchar_t* s;
wchar_t* format;
wchar_t* format1, *format2;
int i;
// cppcheck-suppress uninitvar
(void)swscanf(s,format);
(void)swscanf(s,format1);
// cppcheck-suppress uninitvar
(void)swscanf(s,format,&i);
(void)swscanf(s,format2,&i);
}
void uninitvar_system(void)

View File

@ -93,11 +93,11 @@ void uninitvar_abs(void)
void uninivar_imaxabs(void)
{
intmax_t i;
intmax_t i1, i2;
// cppcheck-suppress uninitvar
(void)std::imaxabs(i);
(void)std::imaxabs(i1);
// cppcheck-suppress uninitvar
(void)imaxabs(i);
(void)imaxabs(i2);
}
void uninitvar_isalnum(void)
@ -580,12 +580,12 @@ void uninitvar_div(void)
void uninitvar_imaxdiv(void)
{
intmax_t numer;
intmax_t denom;
intmax_t numer1, numer2;
intmax_t denom1, denom2;
// cppcheck-suppress uninitvar
(void)std::imaxdiv(numer,denom);
(void)std::imaxdiv(numer1,denom1);
// cppcheck-suppress uninitvar
(void)imaxdiv(numer,denom);
(void)imaxdiv(numer2,denom2);
}
void uninitvar_exit(void)
@ -837,16 +837,16 @@ void uninitar_fopen(void)
void uninitar_fprintf(FILE *Stream, char *Format, int Argument)
{
FILE *stream;
char *format;
int argument;
char *format1, *format2;
int argument1, argument2;
// cppcheck-suppress uninitvar
(void)std::fprintf(stream, format, argument);
(void)std::fprintf(stream, format1, argument1);
// cppcheck-suppress uninitvar
(void)std::fprintf(stream, Format, Argument);
// cppcheck-suppress uninitvar
(void)std::fprintf(Stream, format, Argument);
(void)std::fprintf(Stream, format2, Argument);
// cppcheck-suppress uninitvar
(void)std::fprintf(Stream, Format, argument);
(void)std::fprintf(Stream, Format, argument2);
// no warning is expected
(void)std::fprintf(Stream, Format, Argument);
@ -855,15 +855,15 @@ void uninitar_fprintf(FILE *Stream, char *Format, int Argument)
void uninitar_vfprintf(FILE *Stream, const char *Format, va_list Arg)
{
FILE *stream;
char *format;
char *format1, *format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vfprintf(stream, format, arg);
(void)std::vfprintf(stream, format1, arg);
// cppcheck-suppress uninitvar
(void)std::vfprintf(stream, Format, Arg);
// cppcheck-suppress uninitvar
(void)std::vfprintf(Stream, format, Arg);
(void)std::vfprintf(Stream, format2, Arg);
// no warning is expected
(void)std::vfprintf(Stream, Format, Arg);
@ -874,15 +874,15 @@ void uninitar_vfprintf(FILE *Stream, const char *Format, va_list Arg)
void uninitar_vfwprintf(FILE *Stream, wchar_t *Format, va_list Arg)
{
FILE *stream;
wchar_t *format;
wchar_t *format1, *format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vfwprintf(stream, format, arg);
(void)std::vfwprintf(stream, format1, arg);
// cppcheck-suppress uninitvar
(void)std::vfwprintf(stream, Format, Arg);
// cppcheck-suppress uninitvar
(void)std::vfwprintf(Stream, format, Arg);
(void)std::vfwprintf(Stream, format2, Arg);
// no warning is expected
(void)std::vfwprintf(Stream, Format, Arg);
@ -1092,16 +1092,16 @@ void uninitvar_mbtowc(void)
void uninitvar_mbrlen(const char* p, size_t m, mbstate_t* s)
{
char* pmb;
size_t max;
mbstate_t* ps;
size_t max1, max2;
mbstate_t* ps1, *ps2;
// cppcheck-suppress uninitvar
(void)std::mbrlen(pmb,max,ps);
(void)std::mbrlen(pmb,max1,ps1);
// cppcheck-suppress uninitvar
(void)std::mbrlen(pmb,m,s);
// cppcheck-suppress uninitvar
(void)std::mbrlen(p,max,s);
(void)std::mbrlen(p,max2,s);
// cppcheck-suppress uninitvar
(void)std::mbrlen(p,m,ps);
(void)std::mbrlen(p,m,ps2);
// no warning is expected
(void)std::mbrlen(p,m,s);
}
@ -1963,13 +1963,13 @@ void uninitvar_remquo(void)
void uninivar_printf(char *Format, int Argument)
{
char * format;
int argument;
int argument1, argument2;
// no warning is expected
(void)std::printf("x");
// cppcheck-suppress uninitvar
(void)std::printf(format,argument);
(void)std::printf(format,argument1);
// cppcheck-suppress uninitvar
(void)std::printf(Format,argument);
(void)std::printf(Format,argument2);
// cppcheck-suppress uninitvar
(void)std::printf(format,Argument);
// cppcheck-suppress uninitvar
@ -1981,13 +1981,13 @@ void uninivar_printf(char *Format, int Argument)
void uninivar_vprintf(char *Format, va_list Arg)
{
char * format;
char * format1, *format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vprintf(format,arg);
(void)std::vprintf(format1,arg);
// cppcheck-suppress uninitvar
(void)std::vprintf(format,Arg);
(void)std::vprintf(format2,Arg);
// no warning is expected
(void)std::vprintf(Format,Arg);
@ -1997,13 +1997,13 @@ void uninivar_vprintf(char *Format, va_list Arg)
void uninivar_vwprintf(wchar_t *Format, va_list Arg)
{
wchar_t * format;
wchar_t * format1, *format2;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vwprintf(format,arg);
(void)std::vwprintf(format1,arg);
// cppcheck-suppress uninitvar
(void)std::vwprintf(format,Arg);
(void)std::vwprintf(format2,Arg);
// no warning is expected
(void)std::vwprintf(Format,Arg);
@ -2236,14 +2236,14 @@ void uninivar_setvbuf(void)
void uninitvar_strcat(char *dest, const char * const source)
{
char *deststr;
char *deststr1, *deststr2;
char *srcstr;
// cppcheck-suppress uninitvar
(void)std::strcat(deststr,srcstr);
(void)std::strcat(deststr1,srcstr);
// cppcheck-suppress uninitvar
(void)std::strcat(dest,srcstr);
// cppcheck-suppress uninitvar
(void)std::strcat(deststr,source);
(void)std::strcat(deststr2,source);
// no warning shall be shown for
(void)std::strcat(dest,source);
@ -2366,15 +2366,15 @@ void uninivar_strncat(char *Ct, char *S, size_t N)
{
char *ct;
char *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)std::strncat(ct,s,n);
(void)std::strncat(ct,s,n1);
// cppcheck-suppress uninitvar
(void)std::strncat(ct,S,N);
// cppcheck-suppress uninitvar
(void)std::strncat(Ct,s,N);
// cppcheck-suppress uninitvar
(void)std::strncat(Ct,S,n);
(void)std::strncat(Ct,S,n2);
// no warning is expected for
(void)std::strncat(Ct,S,N);
@ -2384,15 +2384,15 @@ void uninivar_wcsncat(wchar_t *Ct, wchar_t *S, size_t N)
{
wchar_t *ct;
wchar_t *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)std::wcsncat(ct,s,n);
(void)std::wcsncat(ct,s,n1);
// cppcheck-suppress uninitvar
(void)std::wcsncat(ct,S,N);
// cppcheck-suppress uninitvar
(void)std::wcsncat(Ct,s,N);
// cppcheck-suppress uninitvar
(void)std::wcsncat(Ct,S,n);
(void)std::wcsncat(Ct,S,n2);
// no warning is expected for
(void)std::wcsncat(Ct,S,N);
@ -2402,15 +2402,15 @@ void uninivar_strncmp(char *Ct, char *S, size_t N)
{
char *ct;
char *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)std::strncmp(ct,s,n);
(void)std::strncmp(ct,s,n1);
// cppcheck-suppress uninitvar
(void)std::strncmp(ct,S,N);
// cppcheck-suppress uninitvar
(void)std::strncmp(Ct,s,N);
// cppcheck-suppress uninitvar
(void)std::strncmp(Ct,S,n);
(void)std::strncmp(Ct,S,n2);
// no warning is expected for
(void)std::strncmp(Ct,S,N);
@ -2420,15 +2420,15 @@ void uninivar_wcsncmp(wchar_t *Ct, wchar_t *S, size_t N)
{
wchar_t *ct;
wchar_t *s;
size_t n;
size_t n1, n2;
// cppcheck-suppress uninitvar
(void)std::wcsncmp(ct,s,n);
(void)std::wcsncmp(ct,s,n1);
// cppcheck-suppress uninitvar
(void)std::wcsncmp(ct,S,N);
// cppcheck-suppress uninitvar
(void)std::wcsncmp(Ct,s,N);
// cppcheck-suppress uninitvar
(void)std::wcsncmp(Ct,S,n);
(void)std::wcsncmp(Ct,S,n2);
// no warning is expected for
(void)std::wcsncmp(Ct,S,N);
@ -2671,39 +2671,54 @@ void uninivar_stoX(void)
{
std::string str;
std::wstring wstr;
size_t* idx;
size_t* idx1;
size_t* idx2;
size_t* idx3;
size_t* idx4;
size_t* idx5;
size_t* idx6;
size_t* idx7;
size_t* idx8;
size_t* idx9;
size_t* idx10;
size_t* idx11;
size_t* idx12;
size_t* idx13;
size_t* idx14;
size_t* idx15;
size_t* idx16;
// cppcheck-suppress uninitvar
(void)std::stod(str,idx);
(void)std::stod(str,idx1);
// cppcheck-suppress uninitvar
(void)std::stod(wstr,idx);
(void)std::stod(wstr,idx2);
// cppcheck-suppress uninitvar
(void)std::stof(str,idx);
(void)std::stof(str,idx3);
// cppcheck-suppress uninitvar
(void)std::stof(wstr,idx);
(void)std::stof(wstr,idx4);
// cppcheck-suppress uninitvar
(void)std::stoi(str,idx);
(void)std::stoi(str,idx5);
// cppcheck-suppress uninitvar
(void)std::stoi(wstr,idx);
(void)std::stoi(wstr,idx6);
// cppcheck-suppress uninitvar
(void)std::stol(str,idx);
(void)std::stol(str,idx7);
// cppcheck-suppress uninitvar
(void)std::stol(wstr,idx);
(void)std::stol(wstr,idx8);
// cppcheck-suppress uninitvar
(void)std::stold(str,idx);
(void)std::stold(str,idx9);
// cppcheck-suppress uninitvar
(void)std::stold(wstr,idx);
(void)std::stold(wstr,idx10);
// cppcheck-suppress uninitvar
(void)std::stoll(str,idx);
(void)std::stoll(str,idx11);
// cppcheck-suppress uninitvar
(void)std::stoll(wstr,idx);
(void)std::stoll(wstr,idx12);
// cppcheck-suppress uninitvar
(void)std::stoul(str,idx);
(void)std::stoul(str,idx13);
// cppcheck-suppress uninitvar
(void)std::stoul(wstr,idx);
(void)std::stoul(wstr,idx14);
// cppcheck-suppress uninitvar
(void)std::stoull(str,idx);
(void)std::stoull(str,idx15);
// cppcheck-suppress uninitvar
(void)std::stoull(wstr,idx);
(void)std::stoull(wstr,idx16);
}
void uninivar_to_string(void)
@ -2824,13 +2839,13 @@ void uninivar_wcstol(void)
void uninitvar_wprintf(wchar_t *Format, int Argument)
{
const wchar_t *format;
int argument;
int argument1, argument2;
// cppcheck-suppress uninitvar
(void)std::wprintf(format,argument);
(void)std::wprintf(format,argument1);
// cppcheck-suppress uninitvar
(void)std::wprintf(format);
// cppcheck-suppress uninitvar
(void)std::wprintf(Format,argument);
(void)std::wprintf(Format,argument2);
// cppcheck-suppress uninitvar
(void)std::wprintf(format,Argument);
// no warning is expected
@ -2888,20 +2903,20 @@ void uninivar_fwprintf(void)
void uninivar_snprintf(char *S, size_t N, char *Format, int Int)
{
size_t n;
size_t n1, n2;
char *format;
int i;
char *s;
int i1, i2;
char *s1, *s2;
// cppcheck-suppress uninitvar
(void)std::snprintf(s,n,format,i);
(void)std::snprintf(s1,n1,format,i1);
// cppcheck-suppress uninitvar
(void)std::snprintf(S,n,Format,Int); // n is uninitialized
(void)std::snprintf(S,n2,Format,Int); // n is uninitialized
// cppcheck-suppress uninitvar
(void)std::snprintf(S,N,format,Int); // format is uninitialized
// cppcheck-suppress uninitvar
(void)std::snprintf(S,N,Format,i); // i is uninitialized
(void)std::snprintf(S,N,Format,i2); // i is uninitialized
// cppcheck-suppress uninitvar
(void)std::snprintf(s,N,Format,Int);
(void)std::snprintf(s2,N,Format,Int);
// no warning is expected for
(void)std::snprintf(S,N,Format,Int);
@ -2909,17 +2924,17 @@ void uninivar_snprintf(char *S, size_t N, char *Format, int Int)
void uninivar_vsnprintf(char *S, size_t N, char *Format, va_list Arg)
{
char *s;
size_t n;
char *s1, *s2;
size_t n1, n2;
char *format;
va_list arg;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
(void)std::vsnprintf(s,n,format,arg);
(void)std::vsnprintf(s1,n1,format,arg);
// cppcheck-suppress uninitvar
(void)std::vsnprintf(s,N,Format,Arg);
(void)std::vsnprintf(s2,N,Format,Arg);
// cppcheck-suppress uninitvar
(void)std::vsnprintf(S,n,Format,Arg);
(void)std::vsnprintf(S,n2,Format,Arg);
// cppcheck-suppress uninitvar
(void)std::vsnprintf(S,N,format,Arg);
@ -2953,23 +2968,23 @@ void uninivar_sscanf(void)
void uninivar_fwscanf(void)
{
FILE* stream;
wchar_t* format;
wchar_t* format1, *format2;
int i;
// cppcheck-suppress uninitvar
(void)std::fwscanf(stream,format);
(void)std::fwscanf(stream,format1);
// cppcheck-suppress uninitvar
(void)std::fwscanf(stream,format,&i);
(void)std::fwscanf(stream,format2,&i);
}
void uninivar_swscanf(void)
{
wchar_t* s;
wchar_t* format;
wchar_t* format1, *format2;
int i;
// cppcheck-suppress uninitvar
(void)std::swscanf(s,format);
(void)std::swscanf(s,format1);
// cppcheck-suppress uninitvar
(void)std::swscanf(s,format,&i);
(void)std::swscanf(s,format2,&i);
}
void uninitvar_system(void)
@ -3028,36 +3043,36 @@ void uninitvar_setbase(void)
void uninitvar_find(std::string s)
{
// testing of size_t find (const string& str, size_t pos = 0)
size_t pos;
size_t pos1, pos2, pos3, pos4, pos5, pos6, pos7;
// cppcheck-suppress uninitvar
(void)s.find("find",pos); // #6991
(void)s.find("find",pos1); // #6991
// testing of size_t find (const char* s, size_t pos = 0) const;
char *pc;
char *pc, *pc2;
// cppcheck-suppress uninitvar
(void)s.find(pc,0);
// cppcheck-suppress uninitvar
(void)s.find(pc,pos);
(void)s.find(pc,pos2);
// cppcheck-suppress uninitvar
(void)s.find("test",pos);
(void)s.find("test",pos3);
// testing of size_t find (char c, size_t pos = 0) const;
char c;
// cppcheck-suppress uninitvar
(void)s.find(c,pos);
(void)s.find(c,pos4);
// testing of size_t find (const char* pc, size_t pos, size_t n) const;
size_t n;
size_t n1,n2,n3;
// cppcheck-suppress uninitvar
(void)s.find(pc,pos,n); // #6991
(void)s.find(pc,pos5,n1); // #6991
// cppcheck-suppress uninitvar
(void)s.find("test",pos,n);
(void)s.find("test",pos6,n2);
// cppcheck-suppress uninitvar
(void)s.find("test",1,n);
(void)s.find("test",1,n3);
// cppcheck-suppress uninitvar
(void)s.find("test",pos,1);
(void)s.find("test",pos7,1);
// cppcheck-suppress uninitvar
(void)s.find(pc,1,1);
(void)s.find(pc2,1,1);
}
void uninivar_ifstream_read(std::ifstream &f)
@ -3339,7 +3354,7 @@ void stdstring()
void stdvector()
{
int uninit;
int uninit1, uninit2, uninit3;
std::vector<int> v;
// cppcheck-suppress ignoredReturnValue
v.size();
@ -3351,15 +3366,15 @@ void stdvector()
// cppcheck-suppress ignoredReturnValue
v.max_size();
// cppcheck-suppress uninitvar
v.push_back(uninit);
v.push_back(uninit1);
// cppcheck-suppress uninitvar
v.reserve(uninit);
v.reserve(uninit2);
// cppcheck-suppress invalidFunctionArg
v.reserve(-1);
// no warning is expected for capacity 0 as it simply has no effect
v.reserve(0);
// cppcheck-suppress uninitvar
v.resize(uninit);
v.resize(uninit3);
// cppcheck-suppress invalidFunctionArg
v.resize(-1);

View File

@ -557,11 +557,11 @@ void uninitvar()
// cppcheck-suppress uninitvar
lstrcat(buf, buf2);
HANDLE hMutex;
HANDLE hMutex1, hMutex2;
// cppcheck-suppress uninitvar
ReleaseMutex(hMutex);
ReleaseMutex(hMutex1);
// cppcheck-suppress uninitvar
CloseHandle(hMutex);
CloseHandle(hMutex2);
HANDLE hEvent;
// cppcheck-suppress uninitvar
@ -573,13 +573,14 @@ void uninitvar()
// cppcheck-suppress uninitvar
CloseHandle(hEvent);
char buf_uninit[10];
char buf_uninit1[10];
char buf_uninit2[10];
// cppcheck-suppress strlwrCalled
// cppcheck-suppress uninitvar
strlwr(buf_uninit);
strlwr(buf_uninit1);
// cppcheck-suppress struprCalled
// cppcheck-suppress uninitvar
strupr(buf_uninit);
strupr(buf_uninit2);
DWORD dwordUninit;
// cppcheck-suppress uninitvar
@ -682,20 +683,20 @@ void allocDealloc_GetModuleHandleEx()
void uninitvar_tolower(_locale_t l)
{
int c;
int c1, c2;
// cppcheck-suppress uninitvar
(void)_tolower(c);
(void)_tolower(c1);
// cppcheck-suppress uninitvar
(void)_tolower_l(c, l);
(void)_tolower_l(c2, l);
}
void uninitvar_toupper(_locale_t l)
{
int c;
int c1, c2;
// cppcheck-suppress uninitvar
(void)_toupper(c);
(void)_toupper(c1);
// cppcheck-suppress uninitvar
(void)_toupper_l(c, l);
(void)_toupper_l(c2, l);
}
void uninitvar_towlower(_locale_t l)

View File

@ -95,13 +95,13 @@ void nullPointer_wxSizer_Add(wxSizer &sizer, wxWindow *w)
void uninitvar_wxSizer_Add(wxSizer &sizer, wxWindow *w,wxObject* userData)
{
int uninit;
int uninit1, uninit2, uninit3;
// cppcheck-suppress uninitvar
sizer.Add(w,uninit);
sizer.Add(w,uninit1);
// cppcheck-suppress uninitvar
sizer.Add(w,4,uninit);
sizer.Add(w,4,uninit2);
// cppcheck-suppress uninitvar
sizer.Add(w,4,2,uninit,userData);
sizer.Add(w,4,2,uninit3,userData);
}
void ignoredReturnValue(const wxString &s)
@ -162,25 +162,30 @@ void uninitvar_wxStaticText(wxStaticText &s)
void uninitvar_wxString_NumberConversion(const wxString &str, const int numberBase)
{
int uninitInteger;
int uninitInteger1;
int uninitInteger2;
int uninitInteger3;
int uninitInteger4;
int uninitInteger5;
int uninitInteger6;
long l;
long long ll;
unsigned long ul;
unsigned long long ull;
// cppcheck-suppress uninitvar
(void)str.ToLong(&l, uninitInteger);
(void)str.ToLong(&l, uninitInteger1);
// cppcheck-suppress uninitvar
(void)str.ToLongLong(&ll, uninitInteger);
(void)str.ToLongLong(&ll, uninitInteger2);
// cppcheck-suppress uninitvar
(void)str.ToULong(&ul, uninitInteger);
(void)str.ToULong(&ul, uninitInteger3);
// cppcheck-suppress uninitvar
(void)str.ToULongLong(&ull, uninitInteger);
(void)str.ToULongLong(&ull, uninitInteger4);
// cppcheck-suppress uninitvar
(void)str.ToCLong(&l, uninitInteger);
(void)str.ToCLong(&l, uninitInteger5);
// cppcheck-suppress uninitvar
(void)str.ToCULong(&ul, uninitInteger);
(void)str.ToCULong(&ul, uninitInteger6);
}
void uninitvar_SetMenuBar(wxFrame * const framePtr, wxMenuBar * const menuBarPtr)