diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 50a4114a49c..4b2c478ec98 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -623,8 +623,9 @@ jobs: - name: Self check run: | - selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive" + selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive" cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" + gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt" ec=0 # TODO: add --check-config @@ -643,10 +644,10 @@ jobs: ./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json --enable=internal lib || ec=1 # check gui with qt settings mkdir b2 - ./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b2 -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 + ./cppcheck $selfcheck_options $cppcheck_options $gui_options --cppcheck-build-dir=b2 --addon=naming.json --suppress=simplifyUsing:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 # self check test and tools ./cppcheck $selfcheck_options $cppcheck_options -Ifrontend -Icli test/*.cpp || ec=1 ./cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1 # triage - ./cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 + ./cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 exit $ec diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 636205cce8f..70b3a30f0ae 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -142,15 +142,17 @@ jobs: - name: Self check if: false run: | - selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive" + selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive" cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" + gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt" + gui_options="$gui_options --suppress=autoNoType:*/moc_*.cpp --suppress=symbolDatabaseWarning:*/moc_*.cpp" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json frontend || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -Ifrontend cli || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json --enable=internal lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options --addon=naming.json --suppress=constVariablePointer:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli -Ifrontend test/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 exit $ec diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml index 411f0298bbb..f667dc78451 100644 --- a/.github/workflows/selfcheck.yml +++ b/.github/workflows/selfcheck.yml @@ -16,6 +16,7 @@ permissions: contents: read jobs: + # TODO: enable information build: runs-on: ubuntu-22.04 diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index 954f69c39dd..27ed6606386 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -143,16 +143,18 @@ jobs: - name: Self check if: false run: | - selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive" + selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive" selfcheck_options="$selfcheck_options --executor=thread" cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" + gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt" + gui_options="$gui_options --suppress=autoNoType:*/moc_*.cpp --suppress=symbolDatabaseWarning:*/moc_*.cpp" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json frontend || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -Ifrontend cli || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json --enable=internal lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options --addon=naming.json --suppress=constVariablePointer:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli -Ifrontend test/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 exit $ec diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index 60e3eb26254..64eb02a4b25 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -137,15 +137,17 @@ jobs: # TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError - name: Self check run: | - selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude --exception-handling --debug-warnings --check-level=exhaustive" + selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=file-total -D__GNUC__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,information --exception-handling --debug-warnings --check-level=exhaustive" cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" + gui_options="-DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt" + gui_options="$gui_options --suppress=autoNoType:*/moc_*.cpp --suppress=symbolDatabaseWarning:*/moc_*.cpp" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json frontend || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -Ifrontend cli || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json --enable=internal lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt --addon=naming.json -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options --addon=naming.json --suppress=constVariablePointer:*/moc_*.cpp -Icmake.output/gui -Ifrontend -Igui gui/*.cpp cmake.output/gui || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli -Ifrontend test/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli tools/dmake/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options $gui_options -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage || ec=1 exit $ec diff --git a/.selfcheck_suppressions b/.selfcheck_suppressions index 05898ec2e29..5ee35b35068 100644 --- a/.selfcheck_suppressions +++ b/.selfcheck_suppressions @@ -1,30 +1,51 @@ missingIncludeSystem +# should not be reported - see #13387 +checkersReport # temporary suppressions - fix the warnings! simplifyUsing:lib/valueptr.h -varid0:gui/projectfile.cpp naming-privateMemberVariable:gui/test/cppchecklibrarydata/testcppchecklibrarydata.h -symbolDatabaseWarning:*/moc_*.cpp -simplifyUsing:*/moc_*.cpp +bitwiseOnBoolean:lib/library.cpp +templateInstantiation:lib/checkunusedfunctions.cpp +templateInstantiation:lib/errorlogger.cpp +templateInstantiation:lib/liobrary.cpp +shadowFunction:lib/checkbufferoverrun.cpp +shadowFunction:lib/checkclass.cpp +shadowFunction:lib/checknullpointer.cpp +shadowFunction:lib/cppcheck.cpp +shadowFunction:lib/fwdanalysis.cpp +shadowFunction:lib/library.cpp +shadowFunction:lib/symboldatabase.cpp +shadowFunction:lib/templatesimplifier.cpp +shadowFunction:lib/token.cpp +shadowFunction:tools/triage/mainwindow.cpp # warnings in Qt generated code we cannot fix -funcArgNamesDifferent:*/moc_*.cpp -naming-varname:*/ui_*.h +funcArgNamesDifferent:*/moc_checkthread.cpp +funcArgNamesDifferent:*/moc_codeeditstylecontrols.cpp +funcArgNamesDifferent:*/moc_resultstree.cpp +funcArgNamesDifferent:*/moc_resultsview.cpp +funcArgNamesDifferent:*/moc_threadhandler.cpp +funcArgNamesDifferent:*/moc_threadresult.cpp +naming-varname:*/gui/ui_*.h functionStatic:*/ui_fileview.h -constVariablePointer:*/moc_test*.cpp # --debug-warnings suppressions valueFlowBailout valueFlowBailoutIncompleteVar -autoNoType +autoNoType:externals/simplecpp/simplecpp.cpp +autoNoType:cli/*.cpp +autoNoType:lib/*.cpp +autoNoType:lib/library.h +autoNoType:gui/*.cpp +autoNoType:test/*.cpp +autoNoType:tools/triage/mainwindow.cpp # ticket 11631 templateInstantiation:test/testutils.cpp naming-varname:externals/simplecpp/simplecpp.h naming-privateMemberVariable:externals/simplecpp/simplecpp.h -valueFlowMaxIterations:externals/tinyxml2/tinyxml2.cpp - # TODO: these warnings need to be addressed upstream uninitMemberVar:externals/tinyxml2/tinyxml2.h noExplicitConstructor:externals/tinyxml2/tinyxml2.h @@ -32,8 +53,6 @@ missingOverride:externals/tinyxml2/tinyxml2.h invalidPrintfArgType_sint:externals/tinyxml2/tinyxml2.h naming-privateMemberVariable:externals/tinyxml2/tinyxml2.h functionStatic:externals/tinyxml2/tinyxml2.cpp -invalidPrintfArgType_uint:externals/tinyxml2/tinyxml2.cpp funcArgNamesDifferent:externals/tinyxml2/tinyxml2.cpp nullPointerRedundantCheck:externals/tinyxml2/tinyxml2.cpp -knownConditionTrueFalse:externals/tinyxml2/tinyxml2.cpp useStlAlgorithm:externals/simplecpp/simplecpp.cpp diff --git a/cli/signalhandler.cpp b/cli/signalhandler.cpp index a8f3d898b71..4f84f036c7e 100644 --- a/cli/signalhandler.cpp +++ b/cli/signalhandler.cpp @@ -108,7 +108,6 @@ static const Signalmap_t listofsignals = { * but when ending up here something went terribly wrong anyway. * And all which is left is just printing some information and terminate. */ -// cppcheck-suppress constParameterCallback static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context) { int type = -1; diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index 50c1f4ab8d9..440bfa11624 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -58,7 +58,7 @@ static QString unquote(QString s) { } // NOLINTNEXTLINE(performance-unnecessary-value-param) - used as callback so we need to preserve the signature -int CheckThread::executeCommand(std::string exe, std::vector args, std::string redirect, std::string &output) // cppcheck-suppress [passedByValue,passedByValueCallback] +int CheckThread::executeCommand(std::string exe, std::vector args, std::string redirect, std::string &output) // cppcheck-suppress passedByValueCallback { output.clear(); diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 2e8cf3cf121..ec6c00b8dc4 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -3193,7 +3193,6 @@ void CheckClass::checkCopyCtorAndEqOperator() { // This is disabled because of #8388 // The message must be clarified. How is the behaviour different? - // cppcheck-suppress unreachableCode - remove when code is enabled again if ((true) || !mSettings->severity.isEnabled(Severity::warning)) // NOLINT(readability-simplify-boolean-expr) return; diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 315ecceb4a2..5f35f443cbf 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -1341,7 +1341,6 @@ void CheckCondition::checkIncorrectLogicOperator() const std::string text = cond1str + " " + tok->str() + " " + cond2str; incorrectLogicOperatorError(tok, text, alwaysTrue, inconclusive, std::move(errorPath)); } else if (printStyle && (firstTrue || secondTrue)) { - // cppcheck-suppress accessMoved - TODO: FP - see #12174 const int which = isfloat ? sufficientCondition(std::move(op1), not1, d1, std::move(op2), not2, d2, isAnd) : sufficientCondition(std::move(op1), not1, i1, std::move(op2), not2, i2, isAnd); std::string text; if (which != 0) { diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index 55547b8e2d3..b45200d7128 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -533,9 +533,7 @@ void CheckUnusedFunctions::updateFunctionData(const CheckUnusedFunctions& check) usage.fileIndex = entry.second.fileIndex; if (usage.filename.empty()) usage.filename = entry.second.filename; - // cppcheck-suppress bitwiseOnBoolean - TODO: FP usage.usedOtherFile |= entry.second.usedOtherFile; - // cppcheck-suppress bitwiseOnBoolean - TODO: FP usage.usedSameFile |= entry.second.usedSameFile; } mFunctionDecl.insert(mFunctionDecl.cend(), check.mFunctionDecl.cbegin(), check.mFunctionDecl.cend()); diff --git a/lib/keywords.cpp b/lib/keywords.cpp index c850c959f0d..91bad4e9338 100644 --- a/lib/keywords.cpp +++ b/lib/keywords.cpp @@ -176,7 +176,6 @@ static const std::unordered_set cpp26_keywords_all = { // cppcheck-suppress unusedFunction const std::unordered_set& Keywords::getAll(Standards::cstd_t cStd) { - // cppcheck-suppress missingReturn switch (cStd) { case Standards::cstd_t::C89: return c89_keywords_all; @@ -196,7 +195,6 @@ const std::unordered_set& Keywords::getAll(Standards::cstd_t cStd) // cppcheck-suppress unusedFunction const std::unordered_set& Keywords::getAll(Standards::cppstd_t cppStd) { - // cppcheck-suppress missingReturn switch (cppStd) { case Standards::cppstd_t::CPP03: return cpp03_keywords_all; @@ -219,7 +217,6 @@ const std::unordered_set& Keywords::getAll(Standards::cppstd_t cppS // cppcheck-suppress unusedFunction const std::unordered_set& Keywords::getOnly(Standards::cstd_t cStd) { - // cppcheck-suppress missingReturn switch (cStd) { case Standards::cstd_t::C89: return c89_keywords; @@ -240,7 +237,6 @@ const std::unordered_set& Keywords::getOnly(Standards::cstd_t cStd) // cppcheck-suppress unusedFunction const std::unordered_set& Keywords::getOnly(Standards::cppstd_t cppStd) { - // cppcheck-suppress missingReturn switch (cppStd) { case Standards::cppstd_t::CPP03: return cpp03_keywords; diff --git a/lib/path.cpp b/lib/path.cpp index 91ccfabc213..4f18192c7c0 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -325,7 +325,6 @@ static bool hasEmacsCppMarker(const char* path) Standards::Language Path::identify(const std::string &path, bool cppHeaderProbe, bool *header) { - // cppcheck-suppress uninitvar - TODO: FP if (header) *header = false; @@ -343,7 +342,6 @@ Standards::Language Path::identify(const std::string &path, bool cppHeaderProbe, return Standards::Language::CPP; if (c_src_exts.find(ext) != c_src_exts.end()) return Standards::Language::C; - // cppcheck-suppress knownConditionTrueFalse - TODO: FP if (!caseInsensitiveFilesystem()) strTolower(ext); if (ext == ".h") { diff --git a/lib/smallvector.h b/lib/smallvector.h index 6665ef5f8dd..eba447fbfca 100644 --- a/lib/smallvector.h +++ b/lib/smallvector.h @@ -36,7 +36,6 @@ template struct TaggedAllocator : std::allocator { template - // cppcheck-suppress noExplicitConstructor // NOLINTNEXTLINE(google-explicit-constructor) TaggedAllocator(Ts && ... ts) : std::allocator(std::forward(ts)...) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 1f2ec5c5b2c..07270e25c78 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3634,7 +3634,6 @@ void Tokenizer::concatenateNegativeNumberAndAnyPositive() tok->deleteNext(); if (Token::Match(tok->next(), "+|- %num%")) { - // cppcheck-suppress redundantCopyLocalConst - cannot make it a reference because it is deleted afterwards std::string prefix = tok->strAt(1); tok->deleteNext(); tok->next()->str(prefix + tok->strAt(1)); diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 632b2329add..b5f69da405a 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -6077,7 +6077,7 @@ static void addToErrorPath(ValueFlow::Value& value, const ValueFlow::Value& from } static std::vector findAllUsages(const Variable* var, - Token* start, // cppcheck-suppress constParameterPointer // FP + Token* start, const Library& library) { // std::vector result; diff --git a/lib/vf_settokenvalue.cpp b/lib/vf_settokenvalue.cpp index 4ba82b15e24..0140b45ae06 100644 --- a/lib/vf_settokenvalue.cpp +++ b/lib/vf_settokenvalue.cpp @@ -406,7 +406,6 @@ namespace ValueFlow } } else if (!value.isImpossible()) { // is condition only depending on 1 variable? - // cppcheck-suppress[variableScope] #8541 nonneg int varId = 0; bool ret = false; visitAstNodes(parent->astOperand1(), diff --git a/test/redirect.h b/test/redirect.h index 9f67dc591a1..e420d62e0d2 100644 --- a/test/redirect.h +++ b/test/redirect.h @@ -52,7 +52,7 @@ class RedirectOutputError { { const std::string s = _out.str(); if (!s.empty()) - throw std::runtime_error("unconsumed stdout: " + s); // cppcheck-suppress exceptThrowInDestructor - FP #11031 + throw std::runtime_error("unconsumed stdout: " + s); } { diff --git a/test/testother.cpp b/test/testother.cpp index d1fc966d6ff..85153d1dc78 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -10834,7 +10834,6 @@ class TestOther : public TestFixture { // cppcheck-suppress unusedPrivateFunction void redundantMemWrite() { // Simple tests - // cppcheck-suppress unreachableCode - remove when code is enabled again check("void f() {\n" " char a[10];\n" " memcpy(a, foo, bar);\n" diff --git a/test/testtoken.cpp b/test/testtoken.cpp index 4537defbe3d..1a94e092ac9 100644 --- a/test/testtoken.cpp +++ b/test/testtoken.cpp @@ -138,13 +138,11 @@ class TestToken : public TestFixture { Token *last = token->tokAt(2); ASSERT_EQUALS(token->str(), "1"); ASSERT_EQUALS(token->strAt(1), "2"); - // cppcheck-suppress redundantNextPrevious - this is intentional ASSERT_EQUALS(token->tokAt(2)->str(), "3"); ASSERT_EQUALS_MSG(true, last->next() == nullptr, "Null was expected"); ASSERT_EQUALS(last->str(), "3"); ASSERT_EQUALS(last->strAt(-1), "2"); - // cppcheck-suppress redundantNextPrevious - this is intentional ASSERT_EQUALS(last->tokAt(-2)->str(), "1"); ASSERT_EQUALS_MSG(true, token->previous() == nullptr, "Null was expected"); @@ -787,24 +785,18 @@ class TestToken : public TestFixture { void matchOr() const { const SimpleTokenList bitwiseOr(";|;"); - // cppcheck-suppress simplePatternError - this is intentional ASSERT_EQUALS(true, Token::Match(bitwiseOr.front(), "; %or%")); ASSERT_EQUALS(true, Token::Match(bitwiseOr.front(), "; %op%")); - // cppcheck-suppress simplePatternError - this is intentional ASSERT_EQUALS(false, Token::Match(bitwiseOr.front(), "; %oror%")); const SimpleTokenList bitwiseOrAssignment(";|=;"); - // cppcheck-suppress simplePatternError - this is intentional ASSERT_EQUALS(false, Token::Match(bitwiseOrAssignment.front(), "; %or%")); ASSERT_EQUALS(true, Token::Match(bitwiseOrAssignment.front(), "; %op%")); - // cppcheck-suppress simplePatternError - this is intentional ASSERT_EQUALS(false, Token::Match(bitwiseOrAssignment.front(), "; %oror%")); const SimpleTokenList logicalOr(";||;"); - // cppcheck-suppress simplePatternError - this is intentional ASSERT_EQUALS(false, Token::Match(logicalOr.front(), "; %or%")); ASSERT_EQUALS(true, Token::Match(logicalOr.front(), "; %op%")); - // cppcheck-suppress simplePatternError - this is intentional ASSERT_EQUALS(true, Token::Match(logicalOr.front(), "; %oror%")); ASSERT_EQUALS(true, Token::Match(logicalOr.front(), "; &&|%oror%")); ASSERT_EQUALS(true, Token::Match(logicalOr.front(), "; %oror%|&&")); diff --git a/test/testutils.cpp b/test/testutils.cpp index 791aadb322d..37c1030000d 100644 --- a/test/testutils.cpp +++ b/test/testutils.cpp @@ -521,7 +521,6 @@ class TestUtils : public TestFixture { void f() { written = true; } - // cppcheck-suppress functionStatic - needs to be const void f() const {} };