Skip to content

Commit 52b3864

Browse files
committed
use inline suppressions
1 parent 7118b2d commit 52b3864

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
@@ -6,20 +6,6 @@ varid0:gui/projectfile.cpp
66
naming-privateMemberVariable:gui/test/cppchecklibrarydata/testcppchecklibrarydata.h
77
symbolDatabaseWarning:*/moc_*.cpp
88
simplifyUsing:*/moc_*.cpp
9-
bitwiseOnBoolean:lib/library.cpp
10-
templateInstantiation:lib/checkunusedfunctions.cpp
11-
templateInstantiation:lib/errorlogger.cpp
12-
templateInstantiation:lib/liobrary.cpp
13-
shadowFunction:lib/checkbufferoverrun.cpp
14-
shadowFunction:lib/checkclass.cpp
15-
shadowFunction:lib/checknullpointer.cpp
16-
shadowFunction:lib/cppcheck.cpp
17-
shadowFunction:lib/fwdanalysis.cpp
18-
shadowFunction:lib/library.cpp
19-
shadowFunction:lib/symboldatabase.cpp
20-
shadowFunction:lib/templatesimplifier.cpp
21-
shadowFunction:lib/token.cpp
22-
shadowFunction:tools/triage/mainwindow.cpp
239

2410
# warnings in Qt generated code we cannot fix
2511
funcArgNamesDifferent:*/moc_*.cpp

lib/checkbufferoverrun.cpp

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

954954
Check::FileInfo * CheckBufferOverrun::loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const
955955
{
956+
// cppcheck-suppress shadowFunction - TODO: fix this
956957
const std::string arrayIndex("array-index");
957958
const std::string pointerArith("pointer-arith");
958959

lib/checkclass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,6 +2479,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, Member
24792479
return false;
24802480
const Token* assignTok = end->next()->astParent();
24812481
if (var && assignTok && assignTok->isAssignmentOp() && assignTok->astOperand1() && assignTok->astOperand1()->variable()) {
2482+
// cppcheck-suppress shadowFunction - TODO: fix this
24822483
const Variable* assignVar = assignTok->astOperand1()->variable();
24832484
if (assignVar->isPointer() && !assignVar->isConst() && var->typeScope()) {
24842485
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
@@ -1062,6 +1062,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
10621062
const std::time_t maxTime = mSettings.checksMaxTime > 0 ? std::time(nullptr) + mSettings.checksMaxTime : 0;
10631063

10641064
// call all "runChecks" in all registered Check classes
1065+
// cppcheck-suppress shadowFunction - TODO: fix this
10651066
for (Check *check : Check::instances()) {
10661067
if (Settings::terminated())
10671068
return;
@@ -1104,6 +1105,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
11041105
mAnalyzerInformation.setFileInfo("ctu", fi1->toString());
11051106
}
11061107

1108+
// cppcheck-suppress shadowFunction - TODO: fix this
11071109
for (const Check *check : Check::instances()) {
11081110
if (doUnusedFunctionOnly && dynamic_cast<const CheckUnusedFunctions*>(check) == nullptr)
11091111
continue;
@@ -1735,6 +1737,7 @@ bool CppCheck::analyseWholeProgram()
17351737
ctu.nestedCalls.insert(ctu.nestedCalls.end(), fi2->nestedCalls.cbegin(), fi2->nestedCalls.cend());
17361738
}
17371739
}
1740+
// cppcheck-suppress shadowFunction - TODO: fix this
17381741
for (Check *check : Check::instances())
17391742
errors |= check->analyseWholeProgram(&ctu, mFileInfo, mSettings, *this); // TODO: ctu
17401743
return errors && (mExitCode > 0);
@@ -1785,6 +1788,7 @@ void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::list<
17851788
ctuFileInfo.loadFromXml(e);
17861789
continue;
17871790
}
1791+
// cppcheck-suppress shadowFunction - TODO: fix this
17881792
for (const Check *check : Check::instances()) {
17891793
if (checkClassAttr == check->name())
17901794
fileInfoList.push_back(check->loadFileInfoFromXml(e));
@@ -1796,6 +1800,7 @@ void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::list<
17961800
CTU::maxCtuDepth = mSettings.maxCtuDepth;
17971801

17981802
// Analyse the tokens
1803+
// cppcheck-suppress shadowFunction - TODO: fix this
17991804
for (Check *check : Check::instances())
18001805
check->analyseWholeProgram(&ctuFileInfo, fileInfoList, mSettings, *this);
18011806

lib/errorlogger.cpp

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

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

174175
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
@@ -392,8 +392,10 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
392392
if (end)
393393
mExecutableBlocks[extension].setEnd(end);
394394
const char * offset = blocknode->Attribute("offset");
395-
if (offset)
395+
if (offset) {
396+
// cppcheck-suppress templateInstantiation - TODO: fix this - see #11631
396397
mExecutableBlocks[extension].setOffset(strToInt<int>(offset));
398+
}
397399
}
398400

399401
else
@@ -706,6 +708,7 @@ Library::Error Library::loadFunction(const tinyxml2::XMLElement * const node, co
706708
mReturnValueType[name] = type;
707709
if (const char *container = functionnode->Attribute("container"))
708710
mReturnValueContainer[name] = strToInt<int>(container);
711+
// cppcheck-suppress shadowFunction - TODO: fix this
709712
if (const char *unknownReturnValues = functionnode->Attribute("unknownValues")) {
710713
if (std::strcmp(unknownReturnValues, "all") == 0) {
711714
std::vector<MathLib::bigint> values{LLONG_MIN, LLONG_MAX};
@@ -1305,6 +1308,7 @@ bool Library::isCompliantValidationExpression(const char* p)
13051308
error |= (*(p + 1) == '-');
13061309
}
13071310
else if (*p == ':') {
1311+
// cppcheck-suppress bitwiseOnBoolean - TODO: fix this
13081312
error |= range | (*(p + 1) == '.');
13091313
range = true;
13101314
has_dot = false;
@@ -1319,6 +1323,7 @@ bool Library::isCompliantValidationExpression(const char* p)
13191323
has_dot = false;
13201324
has_E = false;
13211325
} else if (*p == '.') {
1326+
// cppcheck-suppress bitwiseOnBoolean - TODO: fix this
13221327
error |= has_dot | (!std::isdigit(*(p + 1)));
13231328
has_dot = true;
13241329
} else if (*p == 'E' || *p == 'e') {

lib/symboldatabase.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,6 +2364,7 @@ const Type* Variable::smartPointerType() const
23642364
while (Token::Match(typeTok, "%name%|::"))
23652365
typeTok = typeTok->next();
23662366
if (Token::Match(typeTok, "< %name% >")) {
2367+
// cppcheck-suppress shadowFunction - TODO: fix this
23672368
const Scope* scope = typeTok->scope();
23682369
const Type* ptrType{};
23692370
while (scope && !ptrType) {

0 commit comments

Comments
 (0)