From e6edd74099522374359ecf14aee648d00689c2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 12 Jan 2019 19:11:44 +0100 Subject: [PATCH] Temporarily suppress Cppcheck false positives --- .travis.yml | 2 +- lib/checkclass.cpp | 1 + lib/ctu.cpp | 1 + lib/preprocessor.cpp | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8723a0f8..f544c5fdf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -156,7 +156,7 @@ script: - cd ../ # use same hack as for clang to work around cppchecks broken exit status with -j 2 ; create file, tee everything to the file and stdout, grep for errors in the file - touch /tmp/cppcheck.cppcheck - - ${CPPCHECK} --error-exitcode=1 --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling --suppressions-list=.travis_suppressions -itest/synthetic -iaddons -igui . -j 2 |& tee /tmp/cppcheck.cppcheck + - ${CPPCHECK} --error-exitcode=1 --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling --inline-suppr --suppressions-list=.travis_suppressions -itest/synthetic -iaddons -igui . -j 2 |& tee /tmp/cppcheck.cppcheck # check gui with qt settings - ${CPPCHECK} --library=qt --error-exitcode=1 -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling -j 2 gui --suppressions-list=.travis_suppressions -igui/test |& tee --append /tmp/cppcheck.cppcheck - sh -c "! grep '^\[' /tmp/cppcheck.cppcheck" diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 7bd18ab8a..ef6b6ce6b 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2413,6 +2413,7 @@ void CheckClass::pureVirtualFunctionCallInConstructorError( for (const Token *tok : tokStack) errorPath.emplace_back(tok, "Calling " + tok->str()); if (!errorPath.empty()) + // cppcheck-suppress unreadVariable // FP errorPath.back().second = purefuncname + " is a pure virtual method without body"; reportError(tokStack, Severity::warning, "pureVirtualCall", diff --git a/lib/ctu.cpp b/lib/ctu.cpp index 75d897073..ae90b0b90 100644 --- a/lib/ctu.cpp +++ b/lib/ctu.cpp @@ -213,6 +213,7 @@ void CTU::FileInfo::loadFromXml(const tinyxml2::XMLElement *xmlElement) if (std::strcmp(e->Name(), "function-call") == 0) { FunctionCall functionCall; if (functionCall.loadFromXml(e)) + // cppcheck-suppress uninitStructMember // FP functionCalls.push_back(functionCall); } else if (std::strcmp(e->Name(), "nested-call") == 0) { NestedCall nestedCall; diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 681d7a85d..9598ea0eb 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -822,7 +822,8 @@ void Preprocessor::getErrorMessages(ErrorLogger *errorLogger, const Settings *se { Settings settings2(*settings); Preprocessor preprocessor(settings2, errorLogger); - settings2.checkConfiguration=true; + // cppcheck-suppress unreadVariable // FP + settings2.checkConfiguration = true; preprocessor.missingInclude(emptyString, 1, emptyString, UserHeader); preprocessor.missingInclude(emptyString, 1, emptyString, SystemHeader); preprocessor.validateCfgError(emptyString, 1, "X", "X");