Fixed #8076 (unmatched suppression when calling ./runtests.sh (test/cfg))

This commit is contained in:
Daniel Marjamäki 2018-01-10 15:52:06 +01:00
parent dc0bcce3c2
commit 58034dee86
5 changed files with 30 additions and 51 deletions

View File

@ -163,7 +163,7 @@ void uninitvar(int fd)
void *p;
// cppcheck-suppress uninitvar
write(x,"ab",2);
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
write(fd,buf,2); // #6325
// cppcheck-suppress uninitvar
write(fd,"ab",x);
@ -232,10 +232,9 @@ void timet_h(struct timespec* ptp1)
clock_settime(clk_id, ptp1);
struct timespec tp;
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
clock_settime(CLOCK_REALTIME, &tp); // #6577 - false negative
// cppcheck-suppress uninitvar
// cppcheck-suppress clock_settimeCalled
clock_settime(clk_id, &tp);
time_t clock = time(0);

View File

@ -24,7 +24,6 @@ void QString1(QString s)
int QString2()
{
QString s;
// cppcheck-suppress ignoredReturnValue
// cppcheck-suppress reademptycontainer
return s.size();
}

View File

@ -7,7 +7,7 @@ if [[ $(pwd) == */test/cfg ]] ; then # we are in test/cfg
DIR=""
else # assume we are in repo root
CPPCHECK="./cppcheck"
DIR=./test/cfg/
DIR=test/cfg/
fi
# Cppcheck options

View File

@ -162,7 +162,7 @@ void nullpointer(int value)
// #6100 False positive nullPointer - calling mbstowcs(NULL,)
res += mbstowcs(0,"",0);
// cppcheck-suppress unreadVariable
// TODO cppcheck-suppress unreadVariable
res += wcstombs(0,L"",0);
strtok(NULL,"xyz");
@ -441,7 +441,7 @@ void uninitvar_asctime(void)
void uninitvar_assert(void)
{
int i;
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
assert(i);
}
#endif
@ -1206,17 +1206,14 @@ void uninitvar_floor(void)
void uninitvar_fma(void)
{
// cppcheck-suppress unassignedVariable
float f1,f2,f3;
// cppcheck-suppress uninitvar
(void)fmaf(f1,f2,f3);
// cppcheck-suppress unassignedVariable
double d1,d2,d3;
// cppcheck-suppress uninitvar
(void)fma(d1,d2,d3);
// cppcheck-suppress unassignedVariable
long double ld1,ld2,ld3;
// cppcheck-suppress uninitvar
(void)fmal(ld1,ld2,ld3);
@ -3364,17 +3361,14 @@ void uninitvar_sprintf(char *S, char *Format, int Argument)
int argument;
// cppcheck-suppress uninitvar
(void)sprintf(s,format,argument);
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
(void)sprintf(s,Format,Argument);
// cppcheck-suppress uninitvar
(void)sprintf(S,format,Argument);
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
(void)sprintf(S,Format,argument);
// no warning is expected for
// cppcheck-suppress redundantCopy
(void)sprintf(S,Format,Argument);
}
@ -3427,18 +3421,14 @@ void uninivar_snprintf(char *S, size_t N, char *Format, int Int)
(void)snprintf(s,n,format,i);
// cppcheck-suppress uninitvar
(void)snprintf(S,n,Format,Int); // n is uninitialized
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
(void)snprintf(S,N,format,Int); // format is uninitialized
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
(void)snprintf(S,N,Format,i); // i is uninitialized
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
(void)snprintf(s,N,Format,Int);
// no warning is expected for
// cppcheck-suppress redundantCopy
(void)snprintf(S,N,Format,Int);
}
@ -3587,7 +3577,6 @@ void ignoredReturnValue_abs(int i)
{
// cppcheck-suppress ignoredReturnValue
abs(i);
// cppcheck-suppress constStatement
// cppcheck-suppress ignoredReturnValue
abs(-100);
}
@ -3691,7 +3680,7 @@ void invalidPrintfArgType_printf(void)
// #7016
uint8_t n = 7;
// cppcheck-suppress invalidPrintfArgType_uint
// TODO cppcheck-suppress invalidPrintfArgType_uint
printf("%"PRIi16"\n", n);
}
@ -3707,41 +3696,41 @@ void valueFlow(void)
// When adding functions below, please sort alphabetically.
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(strlen(abc) == 3);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(abs(three) == 3);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(abs(minusThree) == 3);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(isblank(blank) == 1);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(isblank(tab) == 1);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(isblank(c0) == 0);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(isdigit(c0) == 1);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(isdigit(ca) == 0);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(iswblank(wblank) == 1);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(iswblank(wtab) == 1);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(iswblank(w0) == 0);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(iswdigit(w0) == 0);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(iswdigit(wtab) == 1);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(labs(three) == 3);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(labs(minusThree) == 3);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(llabs(three) == 3);
// cppcheck-suppress knownConditionTrueFalse
// TODO cppcheck-suppress knownConditionTrueFalse
AssertAlwaysTrue(llabs(minusThree) == 3);
}

View File

@ -132,7 +132,7 @@ void uninitvar_proj(void)
{
double d;
const std::complex<double> dc(d,d);
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
(void)std::proj(dc);
}
@ -725,17 +725,14 @@ void uninitvar_floor(void)
void uninitvar_fma(void)
{
// cppcheck-suppress unassignedVariable
float f1,f2,f3;
// cppcheck-suppress uninitvar
(void)std::fmaf(f1,f2,f3);
// cppcheck-suppress unassignedVariable
double d1,d2,d3;
// cppcheck-suppress uninitvar
(void)std::fma(d1,d2,d3);
// cppcheck-suppress unassignedVariable
long double ld1,ld2,ld3;
// cppcheck-suppress uninitvar
(void)std::fmal(ld1,ld2,ld3);
@ -2842,18 +2839,14 @@ void uninivar_snprintf(char *S, size_t N, char *Format, int Int)
(void)std::snprintf(s,n,format,i);
// cppcheck-suppress uninitvar
(void)std::snprintf(S,n,Format,Int); // n is uninitialized
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
(void)std::snprintf(S,N,format,Int); // format is uninitialized
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
(void)std::snprintf(S,N,Format,i); // i is uninitialized
// cppcheck-suppress redundantCopy
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
(void)std::snprintf(s,N,Format,Int);
// no warning is expected for
// cppcheck-suppress redundantCopy
(void)std::snprintf(S,N,Format,Int);
}
@ -2939,14 +2932,14 @@ void uninitvar_setw(void)
void uninitvar_setiosflags(void)
{
std::ios_base::fmtflags mask;
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
std::cout << std::setiosflags(mask); // #6987 - false negative
}
void uninitvar_resetiosflags(void)
{
std::ios_base::fmtflags mask;
// cppcheck-suppress uninitvar
// TODO cppcheck-suppress uninitvar
std::cout << std::resetiosflags(mask); // #6987 - false negative
}
@ -3040,20 +3033,19 @@ void ignoredReturnValue_abs(int i)
{
// cppcheck-suppress ignoredReturnValue
std::abs(i);
// cppcheck-suppress constStatement
// cppcheck-suppress ignoredReturnValue
std::abs(-199);
}
void nullPointer_ifstream_read(std::ifstream &f)
{
// cppcheck-suppress nullPointer
// TODO cppcheck-suppress nullPointer
f.read(NULL, 10);
}
void nullPointer_istream_read(std::istream &f)
{
// cppcheck-suppress nullPointer
// TODO cppcheck-suppress nullPointer
f.read(NULL, 10);
}