Skip to content

Commit fd98ecc

Browse files
committed
use inline suppressions
1 parent a613a7c commit fd98ecc

13 files changed

Lines changed: 38 additions & 16 deletions

.selfcheck_suppressions

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,6 @@ missingIncludeSystem
22

33
# temporary suppressions - fix the warnings!
44
simplifyUsing:lib/valueptr.h
5-
bitwiseOnBoolean:lib/library.cpp
6-
templateInstantiation:lib/checkunusedfunctions.cpp
7-
templateInstantiation:lib/errorlogger.cpp
8-
templateInstantiation:lib/liobrary.cpp
9-
shadowFunction:lib/checkbufferoverrun.cpp
10-
shadowFunction:lib/checkclass.cpp
11-
shadowFunction:lib/checknullpointer.cpp
12-
shadowFunction:lib/cppcheck.cpp
13-
shadowFunction:lib/fwdanalysis.cpp
14-
shadowFunction:lib/library.cpp
15-
shadowFunction:lib/symboldatabase.cpp
16-
shadowFunction:lib/templatesimplifier.cpp
17-
shadowFunction:lib/token.cpp
18-
shadowFunction:tools/triage/mainwindow.cpp
195

206
# warnings in Qt generated code we cannot fix
217
symbolDatabaseWarning:gui/temp/moc_*.cpp

lib/checkbufferoverrun.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ Check::FileInfo *CheckBufferOverrun::getFileInfo(const Tokenizer *tokenizer, con
943943

944944
Check::FileInfo * CheckBufferOverrun::loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const
945945
{
946+
// cppcheck-suppress shadowFunction - TODO: fix this
946947
const std::string arrayIndex("array-index");
947948
const std::string pointerArith("pointer-arith");
948949

lib/checkclass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,6 +2471,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, Member
24712471
return false;
24722472
const Token* assignTok = end->next()->astParent();
24732473
if (var && assignTok && assignTok->isAssignmentOp() && assignTok->astOperand1() && assignTok->astOperand1()->variable()) {
2474+
// cppcheck-suppress shadowFunction - TODO: fix this
24742475
const Variable* assignVar = assignTok->astOperand1()->variable();
24752476
if (assignVar->isPointer() && !assignVar->isConst() && var->typeScope()) {
24762477
const auto& funcMap = var->typeScope()->functionMap;

lib/checknullpointer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ static std::string arithmeticTypeString(const Token *tok)
514514

515515
void CheckNullPointer::pointerArithmeticError(const Token* tok, const ValueFlow::Value *value, bool inconclusive)
516516
{
517+
// cppcheck-suppress shadowFunction - TODO: fix this
517518
std::string arithmetic = arithmeticTypeString(tok);
518519
std::string errmsg;
519520
if (tok && tok->str()[0] == '-') {
@@ -532,6 +533,7 @@ void CheckNullPointer::pointerArithmeticError(const Token* tok, const ValueFlow:
532533

533534
void CheckNullPointer::redundantConditionWarning(const Token* tok, const ValueFlow::Value *value, const Token *condition, bool inconclusive)
534535
{
536+
// cppcheck-suppress shadowFunction - TODO: fix this
535537
std::string arithmetic = arithmeticTypeString(tok);
536538
std::string errmsg;
537539
if (tok && tok->str()[0] == '-') {

lib/checkunusedfunctions.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,10 @@ void CheckUnusedFunctions::analyseWholeProgram(const Settings &settings, ErrorLo
459459
}
460460
if (std::strcmp(e2->Name(),"functiondecl") == 0) {
461461
const char* lineNumber = e2->Attribute("lineNumber");
462-
if (lineNumber)
462+
if (lineNumber) {
463+
// cppcheck-suppress templateInstantiation - TODO: fix this - see #11631
463464
decls[functionName] = Location(sourcefile, strToInt<int>(lineNumber));
465+
}
464466
}
465467
}
466468
}

lib/cppcheck.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
10361036
const std::time_t maxTime = mSettings.checksMaxTime > 0 ? std::time(nullptr) + mSettings.checksMaxTime : 0;
10371037

10381038
// call all "runChecks" in all registered Check classes
1039+
// cppcheck-suppress shadowFunction - TODO: fix this
10391040
for (Check *check : Check::instances()) {
10401041
if (Settings::terminated())
10411042
return;
@@ -1078,6 +1079,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
10781079
mAnalyzerInformation.setFileInfo("ctu", fi1->toString());
10791080
}
10801081

1082+
// cppcheck-suppress shadowFunction - TODO: fix this
10811083
for (const Check *check : Check::instances()) {
10821084
if (doUnusedFunctionOnly && dynamic_cast<const CheckUnusedFunctions*>(check) == nullptr)
10831085
continue;
@@ -1700,6 +1702,7 @@ bool CppCheck::analyseWholeProgram()
17001702
ctu.nestedCalls.insert(ctu.nestedCalls.end(), fi2->nestedCalls.cbegin(), fi2->nestedCalls.cend());
17011703
}
17021704
}
1705+
// cppcheck-suppress shadowFunction - TODO: fix this
17031706
for (Check *check : Check::instances())
17041707
errors |= check->analyseWholeProgram(&ctu, mFileInfo, mSettings, *this); // TODO: ctu
17051708
return errors && (mExitCode > 0);
@@ -1750,6 +1753,7 @@ void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::map<s
17501753
ctuFileInfo.loadFromXml(e);
17511754
continue;
17521755
}
1756+
// cppcheck-suppress shadowFunction - TODO: fix this
17531757
for (const Check *check : Check::instances()) {
17541758
if (checkClassAttr == check->name())
17551759
fileInfoList.push_back(check->loadFileInfoFromXml(e));
@@ -1761,6 +1765,7 @@ void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::map<s
17611765
CTU::maxCtuDepth = mSettings.maxCtuDepth;
17621766

17631767
// Analyse the tokens
1768+
// cppcheck-suppress shadowFunction - TODO: fix this
17641769
for (Check *check : Check::instances())
17651770
check->analyseWholeProgram(&ctuFileInfo, fileInfoList, mSettings, *this);
17661771

lib/errorlogger.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg)
168168
severity = attr ? severityFromString(attr) : Severity::none;
169169

170170
attr = errmsg->Attribute("cwe");
171+
// cppcheck-suppress templateInstantiation - TODO: fix this - see #11631
171172
cwe.id = attr ? strToInt<unsigned short>(attr) : 0;
172173

173174
attr = errmsg->Attribute("inconclusive");

lib/fwdanalysis.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ FwdAnalysis::Result FwdAnalysis::checkRecursive(const Token *expr, const Token *
317317
// ({ .. })
318318
if (hasGccCompoundStatement(parent->astParent()->astOperand2()))
319319
return Result(Result::Type::BAILOUT);
320+
// cppcheck-suppress shadowFunction - TODO: fix this
320321
const bool reassign = isSameExpression(mCpp, false, expr, parent, mLibrary, false, false, nullptr);
321322
if (reassign)
322323
return Result(Result::Type::WRITE, parent->astParent());

lib/library.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,10 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
390390
if (end)
391391
mExecutableBlocks[extension].setEnd(end);
392392
const char * offset = blocknode->Attribute("offset");
393-
if (offset)
393+
if (offset) {
394+
// cppcheck-suppress templateInstantiation - TODO: fix this - see #11631
394395
mExecutableBlocks[extension].setOffset(strToInt<int>(offset));
396+
}
395397
}
396398

397399
else
@@ -704,6 +706,7 @@ Library::Error Library::loadFunction(const tinyxml2::XMLElement * const node, co
704706
mReturnValueType[name] = type;
705707
if (const char *container = functionnode->Attribute("container"))
706708
mReturnValueContainer[name] = strToInt<int>(container);
709+
// cppcheck-suppress shadowFunction - TODO: fix this
707710
if (const char *unknownReturnValues = functionnode->Attribute("unknownValues")) {
708711
if (std::strcmp(unknownReturnValues, "all") == 0) {
709712
std::vector<MathLib::bigint> values{LLONG_MIN, LLONG_MAX};
@@ -1303,6 +1306,7 @@ bool Library::isCompliantValidationExpression(const char* p)
13031306
error |= (*(p + 1) == '-');
13041307
}
13051308
else if (*p == ':') {
1309+
// cppcheck-suppress bitwiseOnBoolean - TODO: fix this
13061310
error |= range | (*(p + 1) == '.');
13071311
range = true;
13081312
has_dot = false;
@@ -1317,6 +1321,7 @@ bool Library::isCompliantValidationExpression(const char* p)
13171321
has_dot = false;
13181322
has_E = false;
13191323
} else if (*p == '.') {
1324+
// cppcheck-suppress bitwiseOnBoolean - TODO: fix this
13201325
error |= has_dot | (!std::isdigit(*(p + 1)));
13211326
has_dot = true;
13221327
} else if (*p == 'E' || *p == 'e') {

lib/symboldatabase.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,6 +2368,7 @@ const Type* Variable::smartPointerType() const
23682368
while (Token::Match(typeTok, "%name%|::"))
23692369
typeTok = typeTok->next();
23702370
if (Token::Match(typeTok, "< %name% >")) {
2371+
// cppcheck-suppress shadowFunction - TODO: fix this
23712372
const Scope* scope = typeTok->scope();
23722373
const Type* ptrType{};
23732374
while (scope && !ptrType) {

0 commit comments

Comments
 (0)