From 9df599e825420d475fb71e282fa2a97aed8a9688 Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 8 Feb 2023 11:19:09 +0100 Subject: [PATCH 1/6] TestFixture: made it possible to set template format --- test/fixture.cpp | 12 ++++++++++++ test/fixture.h | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/test/fixture.cpp b/test/fixture.cpp index 7eaf460cf20..ae2378f2cc2 100644 --- a/test/fixture.cpp +++ b/test/fixture.cpp @@ -394,3 +394,15 @@ void TestFixture::reportErr(const ErrorMessage &msg) if (errout.str().find(errormessage) == std::string::npos) errout << errormessage << std::endl; } + +void TestFixture::setTemplateFormat(const std::string &templateFormat) +{ + if (templateFormat == "multiline") { + mTemplateFormat = "{file}:{line}:{severity}:{message}"; + mTemplateLocation = "{file}:{line}:note:{info}"; + } + else { + mTemplateFormat = templateFormat; + mTemplateLocation = ""; + } +} diff --git a/test/fixture.h b/test/fixture.h index 8baf43d3eff..5a1edd31fcb 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -102,9 +102,10 @@ class TestFixture : public ErrorLogger { mVerbose = v; } + void setTemplateFormat(const std::string &templateFormat); + void setMultiline() { - mTemplateFormat = "{file}:{line}:{severity}:{message}"; - mTemplateLocation = "{file}:{line}:note:{info}"; + setTemplateFormat("multiline"); } void processOptions(const options& args); From f44ab7fa93492373dc750011580171bf5fe3756d Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 8 Feb 2023 11:20:12 +0100 Subject: [PATCH 2/6] TestPreprocessor: use "simple" template format in missing include tests --- test/fixture.cpp | 4 ++++ test/testpreprocessor.cpp | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/test/fixture.cpp b/test/fixture.cpp index ae2378f2cc2..b76c0777a88 100644 --- a/test/fixture.cpp +++ b/test/fixture.cpp @@ -401,6 +401,10 @@ void TestFixture::setTemplateFormat(const std::string &templateFormat) mTemplateFormat = "{file}:{line}:{severity}:{message}"; mTemplateLocation = "{file}:{line}:note:{info}"; } + else if (templateFormat == "simple") { + mTemplateFormat = "{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]"; + mTemplateLocation = ""; + } else { mTemplateFormat = templateFormat; mTemplateLocation = ""; diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 27b7deaf2ed..d7767a6f32d 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -2420,6 +2420,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", ""); @@ -2446,6 +2448,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); std::string code("#include \"header.h\""); @@ -2470,6 +2474,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", "", "inc"); @@ -2497,6 +2503,8 @@ class TestPreprocessor : public TestFixture { settings.severity.clear(); settings.checks.enable(Checks::missingInclude); settings.includePaths.emplace_back("inc"); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", "", "inc"); @@ -2524,6 +2532,8 @@ class TestPreprocessor : public TestFixture { settings.severity.clear(); settings.checks.enable(Checks::missingInclude); settings.includePaths.emplace_back("inc"); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", "", Path::getCurrentPath()); @@ -2550,6 +2560,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); const std::string header = Path::join(Path::getCurrentPath(), "header.h"); @@ -2576,6 +2588,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", ""); @@ -2602,6 +2616,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); std::string code("#include "); @@ -2627,6 +2643,8 @@ class TestPreprocessor : public TestFixture { settings.severity.clear(); settings.checks.enable(Checks::missingInclude); settings.includePaths.emplace_back("system"); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", "", "system"); @@ -2654,6 +2672,8 @@ class TestPreprocessor : public TestFixture { settings.severity.clear(); settings.checks.enable(Checks::missingInclude); settings.includePaths.emplace_back("inc"); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", "", Path::getCurrentPath()); @@ -2680,6 +2700,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); const std::string header = Path::join(Path::getCurrentPath(), "header.h"); @@ -2706,6 +2728,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); Preprocessor preprocessor(settings, this); ScopedFile header("header.h", ""); @@ -2735,6 +2759,8 @@ class TestPreprocessor : public TestFixture { settings.clearIncludeCache = true; settings.checkConfiguration = true; settings.severity.clear(); + settings.templateFormat = "simple"; // has no effect + setTemplateFormat("simple"); settings.includePaths.emplace_back("system"); // needs to be reported regardless of enabled checks Preprocessor preprocessor(settings, this); @@ -2765,12 +2791,12 @@ class TestPreprocessor : public TestFixture { ASSERT_EQUALS(true, Preprocessor::missingIncludeFlag); ASSERT_EQUALS(true, Preprocessor::missingSystemIncludeFlag); - ASSERT_EQUALS("[test.c:1]: (information) Include file: \"missing.h\" not found.\n" - "[test.c:2]: (information) Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.\n" - "[test.c:3]: (information) Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.\n" - "[test.c:6]: (information) Include file: \"header4.h\" not found.\n" - "[test.c:9]: (information) Include file: \"" + missing3 + "\" not found.\n" - "[test.c:11]: (information) Include file: <" + missing4 + "> not found. Please note: Cppcheck does not need standard library headers to get proper results.\n", errout.str()); + ASSERT_EQUALS("test.c:1:0: information: Include file: \"missing.h\" not found. [missingInclude]\n" + "test.c:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n" + "test.c:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n" + "test.c:6:0: information: Include file: \"header4.h\" not found. [missingInclude]\n" + "test.c:9:0: information: Include file: \"" + missing3 + "\" not found. [missingInclude]\n" + "test.c:11:0: information: Include file: <" + missing4 + "> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout.str()); Preprocessor::missingIncludeFlag = false; Preprocessor::missingSystemIncludeFlag = false; From 804ebc6a460f6fbf689364e8aa638347aa6e7e2f Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 8 Feb 2023 11:28:00 +0100 Subject: [PATCH 3/6] Fix #10039 (integrate `--check-config` include findings with normal analysis) --- cli/cmdlineparser.cpp | 3 +- cli/cppcheckexecutor.cpp | 26 ------ lib/preprocessor.cpp | 24 ++---- lib/preprocessor.h | 4 - man/cppcheck.1.xml | 2 +- releasenotes.txt | 3 +- test/cli/test-helloworld.py | 8 +- test/cli/test-other.py | 10 +-- test/testpreprocessor.cpp | 161 ++++-------------------------------- 9 files changed, 35 insertions(+), 206 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 06c754d9a03..a884ac24412 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -1136,8 +1136,7 @@ void CmdLineParser::printHelp() " to only enable this when the whole program is\n" " scanned.\n" " * missingInclude\n" - " Warn if there are missing includes. For\n" - " detailed information, use '--check-config'.\n" + " Warn if there are missing includes.\n" " Several ids can be given if you separate them with\n" " commas. See also --std\n" " --error-exitcode= If errors are found, integer [n] is returned instead of\n" diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 293e62fe8e8..40375b39c4f 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -198,9 +198,6 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c int CppCheckExecutor::check(int argc, const char* const argv[]) { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - CheckUnusedFunctions::clear(); CppCheck cppCheck(*this, true, executeCommand); @@ -380,29 +377,6 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck) if (!settings.checkConfiguration) { cppcheck.tooManyConfigsError(emptyString,0U); - - if (settings.checks.isEnabled(Checks::missingInclude) && (Preprocessor::missingIncludeFlag || Preprocessor::missingSystemIncludeFlag)) { - const std::list callStack; - ErrorMessage msg(callStack, - emptyString, - Severity::information, - "Cppcheck cannot find all the include files (use --check-config for details)\n" - "Cppcheck cannot find all the include files. Cppcheck can check the code without the " - "include files found. But the results will probably be more accurate if all the include " - "files are found. Please check your project's include directories and add all of them " - "as include directories for Cppcheck. To see what files Cppcheck cannot find use " - "--check-config.", - "", - Certainty::normal); - if (Preprocessor::missingIncludeFlag) { - msg.id = "missingInclude"; - reportInfo(msg); - } - if (Preprocessor::missingSystemIncludeFlag) { - msg.id = "missingIncludeSystem"; - reportInfo(msg); - } - } } if (settings.xml) { diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 18de15fd286..583d2ae87ab 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -62,9 +62,6 @@ Directive::Directive(std::string _file, const int _linenr, const std::string &_s str(trim(_str)) {} -std::atomic Preprocessor::missingIncludeFlag; -std::atomic Preprocessor::missingSystemIncludeFlag; - char Preprocessor::macroChar = char(1); Preprocessor::Preprocessor(Settings& settings, ErrorLogger *errorLogger) : mSettings(settings), mErrorLogger(errorLogger) @@ -836,27 +833,19 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, const // Report that include is missing void Preprocessor::missingInclude(const std::string &filename, unsigned int linenr, const std::string &header, HeaderTypes headerType) { - if (!mSettings.checks.isEnabled(Checks::missingInclude) && !mSettings.checkConfiguration) + if (!mSettings.checks.isEnabled(Checks::missingInclude)) return; std::string fname = Path::fromNativeSeparators(filename); + std::string errorId = (headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude"; Suppressions::ErrorMessage errorMessage; - errorMessage.errorId = "missingInclude"; + errorMessage.errorId = errorId; errorMessage.setFileName(std::move(fname)); errorMessage.lineNumber = linenr; if (mSettings.nomsg.isSuppressed(errorMessage)) return; - errorMessage.errorId = "missingIncludeSystem"; - if (headerType == SystemHeader && mSettings.nomsg.isSuppressed(errorMessage)) - return; - - if (headerType == SystemHeader) - missingSystemIncludeFlag = true; - else - missingIncludeFlag = true; - - if (mErrorLogger && mSettings.checkConfiguration) { + if (mErrorLogger) { std::list locationList; if (!filename.empty()) { ErrorMessage::FileLocation loc; @@ -864,11 +853,11 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line loc.setfile(Path::toNativeSeparators(filename)); locationList.push_back(std::move(loc)); } - ErrorMessage errmsg(locationList, mFile0, Severity::information, + ErrorMessage errmsg(std::move(locationList), mFile0, Severity::information, (headerType==SystemHeader) ? "Include file: <" + header + "> not found. Please note: Cppcheck does not need standard library headers to get proper results." : "Include file: \"" + header + "\" not found.", - (headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude", + std::move(errorId), Certainty::normal); mErrorLogger->reportInfo(errmsg); } @@ -878,7 +867,6 @@ void Preprocessor::getErrorMessages(ErrorLogger *errorLogger, const Settings *se { Settings settings2(*settings); Preprocessor preprocessor(settings2, errorLogger); - settings2.checkConfiguration = true; preprocessor.missingInclude(emptyString, 1, emptyString, UserHeader); preprocessor.missingInclude(emptyString, 1, emptyString, SystemHeader); preprocessor.error(emptyString, 1, "#error message"); // #error .. diff --git a/lib/preprocessor.h b/lib/preprocessor.h index 0c97333da05..a78c3d77607 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include #include @@ -87,9 +86,6 @@ class CPPCHECKLIB Preprocessor { explicit Preprocessor(Settings& settings, ErrorLogger *errorLogger = nullptr); virtual ~Preprocessor(); - static std::atomic missingIncludeFlag; - static std::atomic missingSystemIncludeFlag; - void inlineSuppressions(const simplecpp::TokenList &tokens); void setDirectives(const simplecpp::TokenList &tokens); diff --git a/man/cppcheck.1.xml b/man/cppcheck.1.xml index 9f6914d0f0e..bea2a280929 100644 --- a/man/cppcheck.1.xml +++ b/man/cppcheck.1.xml @@ -295,7 +295,7 @@ Example: '-UDEBUG' enables unusedFunction.warningEnable warning messagesstyleEnable all coding style checks. All messages with the severities 'style', 'performance' and 'portability' are enabled.performanceEnable performance messagesportabilityEnable portability messagesinformationEnable information messagesunusedFunctionCheck for unused functions. It is recommend to only - enable this when the whole program is scannedmissingIncludeWarn if there are missing includes. For detailed information use --check-config + enable this when the whole program is scannedmissingIncludeWarn if there are missing includes By default none of the additional checks are enabled. Several ids can be given if you separate them with commas, e.g. --enable=style,unusedFunction. See also --std diff --git a/releasenotes.txt b/releasenotes.txt index 9f18da67d6d..6e678a378cb 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -1,3 +1,4 @@ release notes for cppcheck-2.11 -- The platform type 'Unspecified' within .cppcheck projects has been deprecated and will be removed in Cppcheck 2.14. Please use 'unspecified' instead. \ No newline at end of file +- The platform type 'Unspecified' within .cppcheck projects has been deprecated and will be removed in Cppcheck 2.14. Please use 'unspecified' instead. +- It is no longer necessary to run "--check-config" to get detailed "missingInclude" and "missingIncludeSystem" messages. They will always be issued in the regular analysis if "missingInclude" is enabled. diff --git a/test/cli/test-helloworld.py b/test/cli/test-helloworld.py index 0090cfda362..814b7a7808b 100644 --- a/test/cli/test-helloworld.py +++ b/test/cli/test-helloworld.py @@ -198,12 +198,12 @@ def test_build_dir_dump_output(): assert '' in dump, 'invalid dump data: ...' + dump[-100:] def __test_missing_include_system(use_j): - args = '--enable=missingInclude --suppress=zerodiv helloworld' + args = ['--enable=missingInclude', '--suppress=zerodiv', '--template={file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]', 'helloworld'] if use_j: - args = '-j2 ' + args + args.insert(0, '-j2') - _, _, stderr = cppcheck(args.split()) - assert stderr == 'nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingIncludeSystem]\n\n' + _, _, stderr = cppcheck(args) + assert stderr.replace('\\', '/') == 'helloworld/main.c:1:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n' def test_missing_include_system(): __test_missing_include_system(False) diff --git a/test/cli/test-other.py b/test/cli/test-other.py index d7a0d3466ac..e94342af5b8 100644 --- a/test/cli/test-other.py +++ b/test/cli/test-other.py @@ -13,12 +13,12 @@ def __test_missing_include(tmpdir, use_j): #include "test.h" """) - args = '--enable=missingInclude {}'.format(test_file) + args = ['--enable=missingInclude', '--template={file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]', test_file] if use_j: - args = '-j2 ' + args + args.insert(0, '-j2') - _, _, stderr = cppcheck(args.split()) - assert stderr == 'nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingInclude]\n\n' + _, _, stderr = cppcheck(args) + assert stderr == '{}:2:0: information: Include file: "test.h" not found. [missingInclude]\n'.format(test_file) def test_missing_include(tmpdir): __test_missing_include(tmpdir, False) @@ -40,7 +40,7 @@ def __test_missing_include_check_config(tmpdir, use_j): args = '-j2 ' + args _, _, stderr = cppcheck(args.split()) - assert stderr == '{}:2:0: information: Include file: "test.h" not found. [missingInclude]\n\n^\n'.format(test_file) + assert stderr == '' # --check-config no longer reports the missing includes def test_missing_include_check_config(tmpdir): __test_missing_include_check_config(tmpdir, False) diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index d7767a6f32d..cddb329dbde 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -205,7 +205,6 @@ class TestPreprocessor : public TestFixture { // inline suppression, missingInclude/missingIncludeSystem TEST_CASE(inline_suppression_for_missing_include); - TEST_CASE(inline_suppression_for_missing_include_check_config); // Using -D to predefine symbols TEST_CASE(predefine1); @@ -1947,16 +1946,11 @@ class TestPreprocessor : public TestFixture { preprocess("#define () {(int f(x) }\n", actual); // don't hang } - void inline_suppression_for_missing_include_internal(bool checkConfig) { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + void inline_suppression_for_missing_include() { Settings settings; - settings.checkConfiguration = checkConfig; settings.inlineSuppressions = true; settings.severity.clear(); - // --check-config needs to report this regardless of the emanled checks - if (!checkConfig) - settings.checks.enable(Checks::missingInclude); + settings.checks.enable(Checks::missingInclude); Preprocessor preprocessor(settings, this); const std::string code("// cppcheck-suppress missingInclude\n" @@ -1967,8 +1961,6 @@ class TestPreprocessor : public TestFixture { errout.str(""); preprocessor.getcode(code, "", "test.c"); ASSERT_EQUALS("", errout.str()); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); auto suppressions = settings.nomsg.getSuppressions(); ASSERT_EQUALS(2, suppressions.size()); @@ -1990,14 +1982,6 @@ class TestPreprocessor : public TestFixture { ASSERT_EQUALS(true, suppr.matched); } - void inline_suppression_for_missing_include() { - inline_suppression_for_missing_include_internal(false); - } - - void inline_suppression_for_missing_include_check_config() { - inline_suppression_for_missing_include_internal(true); - } - void predefine1() { const std::string src("#if defined X || Y\n" "Fred & Wilma\n" @@ -2413,9 +2397,6 @@ class TestPreprocessor : public TestFixture { // test for existing local include void testMissingInclude() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2429,21 +2410,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include \"header.h\""); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - // the expected messages are emitted outside of the Preprocessor ASSERT_EQUALS("", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; } // test for missing local include void testMissingInclude2() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2455,21 +2427,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include \"header.h\""); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(true, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - // the expected messages are emitted outside of the Preprocessor - ASSERT_EQUALS("", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + ASSERT_EQUALS("test.c:1:0: information: Include file: \"header.h\" not found. [missingInclude]\n", errout.str()); } // test for missing local include - no include path given void testMissingInclude3() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2483,21 +2446,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include \"header.h\""); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(true, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - // the expected messages are emitted outside of the Preprocessor - ASSERT_EQUALS("", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + ASSERT_EQUALS("test.c:1:0: information: Include file: \"header.h\" not found. [missingInclude]\n", errout.str()); } // test for existing local include - include path provided void testMissingInclude4() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2512,21 +2466,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include \"inc/header.h\""); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - // the expected messages are emitted outside of the Preprocessor ASSERT_EQUALS("", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; } // test for existing local include - absolute path void testMissingInclude5() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2541,21 +2486,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include \"" + header.path() + "\""); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - // the expected messages are emitted outside of the Preprocessor ASSERT_EQUALS("", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; } // test for missing local include - absolute path void testMissingInclude6() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2569,21 +2505,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include \"" + header + "\""); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(true, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - - // the expected messages are emitted outside of the Preprocessor - ASSERT_EQUALS("", errout.str()); - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + ASSERT_EQUALS("test.c:1:0: information: Include file: \"" + header + "\" not found. [missingInclude]\n", errout.str()); } // test for missing system include - system includes are not searched for in relative path void testMissingSystemInclude() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2597,21 +2524,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include "); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(true, Preprocessor::missingSystemIncludeFlag); - - // the expected messages are emitted outside of the Preprocessor - ASSERT_EQUALS("", errout.str()); - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + ASSERT_EQUALS("test.c:1:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout.str()); } // test for missing system include void testMissingSystemInclude2() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2623,28 +2541,20 @@ class TestPreprocessor : public TestFixture { std::string code("#include "); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(true, Preprocessor::missingSystemIncludeFlag); - - // the expected messages are emitted outside of the Preprocessor - ASSERT_EQUALS("", errout.str()); - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + ASSERT_EQUALS("test.c:1:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout.str()); } // test for existing system include in system include path void testMissingSystemInclude3() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); settings.checks.enable(Checks::missingInclude); - settings.includePaths.emplace_back("system"); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); + settings.includePaths.emplace_back("system"); + Preprocessor preprocessor(settings, this); ScopedFile header("header.h", "", "system"); @@ -2652,21 +2562,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include "); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - // the expected messages are emitted outside of the Preprocessor ASSERT_EQUALS("", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; } // test for existing system include - absolute path void testMissingSystemInclude4() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2681,21 +2582,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include <" + header.path() + ">"); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(false, Preprocessor::missingSystemIncludeFlag); - // the expected messages are emitted outside of the Preprocessor ASSERT_EQUALS("", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; } // test for missing system include - absolute path void testMissingSystemInclude5() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2709,21 +2601,12 @@ class TestPreprocessor : public TestFixture { std::string code("#include <" + header + ">"); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(false, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(true, Preprocessor::missingSystemIncludeFlag); - - // the expected messages are emitted outside of the Preprocessor - ASSERT_EQUALS("", errout.str()); - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + ASSERT_EQUALS("test.c:1:0: information: Include file: <" + header + "> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout.str()); } // test for missing local and system include void testMissingIncludeMixed() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; settings.severity.clear(); @@ -2741,28 +2624,21 @@ class TestPreprocessor : public TestFixture { "#include \"header2.h\""); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(true, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(true, Preprocessor::missingSystemIncludeFlag); - - // the expected messages are emitted outside of the Preprocessor - ASSERT_EQUALS("", errout.str()); - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; + ASSERT_EQUALS("test.c:1:0: information: Include file: \"missing.h\" not found. [missingInclude]\n" + "test.c:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n" + "test.c:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout.str()); } void testMissingIncludeCheckConfig() { - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; - Settings settings; settings.clearIncludeCache = true; - settings.checkConfiguration = true; settings.severity.clear(); + settings.checks.enable(Checks::missingInclude); + settings.includePaths.emplace_back("system"); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - settings.includePaths.emplace_back("system"); - // needs to be reported regardless of enabled checks + Preprocessor preprocessor(settings, this); ScopedFile header("header.h", ""); @@ -2788,8 +2664,6 @@ class TestPreprocessor : public TestFixture { "#include <" + missing4 + ">\n"); errout.str(""); preprocessor.getcode(code, "", "test.c"); - ASSERT_EQUALS(true, Preprocessor::missingIncludeFlag); - ASSERT_EQUALS(true, Preprocessor::missingSystemIncludeFlag); ASSERT_EQUALS("test.c:1:0: information: Include file: \"missing.h\" not found. [missingInclude]\n" "test.c:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n" @@ -2797,9 +2671,6 @@ class TestPreprocessor : public TestFixture { "test.c:6:0: information: Include file: \"header4.h\" not found. [missingInclude]\n" "test.c:9:0: information: Include file: \"" + missing3 + "\" not found. [missingInclude]\n" "test.c:11:0: information: Include file: <" + missing4 + "> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout.str()); - - Preprocessor::missingIncludeFlag = false; - Preprocessor::missingSystemIncludeFlag = false; } }; From 716ea42cbe0acee468cb3a751cdc928d9b86b3a2 Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 8 Feb 2023 11:47:38 +0100 Subject: [PATCH 4/6] enabled tests for #11283 and removed selfcheck workaround --- .github/workflows/CI-unixish.yml | 6 ------ releasenotes.txt | 1 + test/cli/test-helloworld.py | 1 - test/cli/test-other.py | 1 - 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 1d280d1dbaf..da3b62a774e 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -449,12 +449,6 @@ jobs: selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings" ec=0 - # work around missingInclude not being reported with -j and the --check-config requirement for detailed warnings - ./cppcheck $selfcheck_options -DCHECK_INTERNAL cli lib --check-config --suppress=missingIncludeSystem --suppress=unmatchedSuppression || ec=1 - ./cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp --check-config --suppress=missingIncludeSystem --suppress=unmatchedSuppression || ec=1 - ./cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp --check-config --suppress=missingIncludeSystem --suppress=unmatchedSuppression || ec=1 - ./cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp --check-config --suppress=missingIncludeSystem --suppress=unmatchedSuppression || ec=1 - # early exit if [ $ec -eq 1 ]; then exit $ec diff --git a/releasenotes.txt b/releasenotes.txt index 6e678a378cb..688b53926f8 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -2,3 +2,4 @@ release notes for cppcheck-2.11 - The platform type 'Unspecified' within .cppcheck projects has been deprecated and will be removed in Cppcheck 2.14. Please use 'unspecified' instead. - It is no longer necessary to run "--check-config" to get detailed "missingInclude" and "missingIncludeSystem" messages. They will always be issued in the regular analysis if "missingInclude" is enabled. +- "missingInclude" and "missingIncludeSystem" are reported with "-j" is > 1 and processes are used in the backend (default in non-Windows binaries) diff --git a/test/cli/test-helloworld.py b/test/cli/test-helloworld.py index 814b7a7808b..9e6e40c63f5 100644 --- a/test/cli/test-helloworld.py +++ b/test/cli/test-helloworld.py @@ -208,6 +208,5 @@ def __test_missing_include_system(use_j): def test_missing_include_system(): __test_missing_include_system(False) -@pytest.mark.xfail def test_missing_include_system_j(): #11283 __test_missing_include_system(True) diff --git a/test/cli/test-other.py b/test/cli/test-other.py index e94342af5b8..80dd63180fd 100644 --- a/test/cli/test-other.py +++ b/test/cli/test-other.py @@ -23,7 +23,6 @@ def __test_missing_include(tmpdir, use_j): def test_missing_include(tmpdir): __test_missing_include(tmpdir, False) -@pytest.mark.xfail def test_missing_include_j(tmpdir): #11283 __test_missing_include(tmpdir, True) From e38c5f4f146420c7b7d99550aaf7ee8d663c1da7 Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 8 Feb 2023 13:10:04 +0100 Subject: [PATCH 5/6] apply `--error-exitcode` if `missingInclude` and `missingIncludeSystem` are being reported / suppress `missingIncludeSystem` in selfcheck --- .selfcheck_suppressions | 1 + lib/preprocessor.cpp | 2 +- releasenotes.txt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.selfcheck_suppressions b/.selfcheck_suppressions index 7e1de66f2af..2d1b563e36e 100644 --- a/.selfcheck_suppressions +++ b/.selfcheck_suppressions @@ -1,3 +1,4 @@ +missingIncludeSystem shadowFunction bitwiseOnBoolean diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 583d2ae87ab..a791a0140dc 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -859,7 +859,7 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line "Include file: \"" + header + "\" not found.", std::move(errorId), Certainty::normal); - mErrorLogger->reportInfo(errmsg); + mErrorLogger->reportErr(errmsg); } } diff --git a/releasenotes.txt b/releasenotes.txt index 688b53926f8..be9e51342e4 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -3,3 +3,4 @@ release notes for cppcheck-2.11 - The platform type 'Unspecified' within .cppcheck projects has been deprecated and will be removed in Cppcheck 2.14. Please use 'unspecified' instead. - It is no longer necessary to run "--check-config" to get detailed "missingInclude" and "missingIncludeSystem" messages. They will always be issued in the regular analysis if "missingInclude" is enabled. - "missingInclude" and "missingIncludeSystem" are reported with "-j" is > 1 and processes are used in the backend (default in non-Windows binaries) +- "missingInclude" and "missingIncludeSystem" will now cause the "--error-exitcode" to be applied \ No newline at end of file From 90b38cb0425e752c6fccaab9f724b6bcdaa7551e Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 8 Feb 2023 13:46:47 +0100 Subject: [PATCH 6/6] generate missing GUI dependencies for sanitizer selfchecks in CI --- .github/workflows/asan.yml | 20 +++++++++++++++++--- .github/workflows/ubsan.yml | 20 +++++++++++++++++--- .selfcheck_suppressions | 2 ++ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 343e8940108..ff59f86b51d 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-22.04 env: + QT_VERSION: 5.15.2 ASAN_OPTIONS: detect_stack_use_after_return=1 steps: @@ -35,9 +36,16 @@ jobs: chmod +x llvm.sh sudo ./llvm.sh 16 + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v3 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + cache: true + - name: CMake run: | - cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On + cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On env: CC: clang-16 CXX: clang++-16 @@ -53,6 +61,12 @@ jobs: - name: Run tests run: ./cmake.output/bin/testrunner + - name: Generate dependencies + run: | + # make sure auto-generated GUI files exist + make -C cmake.output autogen + make -C cmake.output gui-build-deps triage-build-ui-deps + # TODO: this is currently way too slow (~60 minutes) to enable it # TODO: only fail the step on sanitizer issues - name: Self check @@ -61,7 +75,7 @@ jobs: selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 exit $ec diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index 5bddbba856d..c422c72728c 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-22.04 env: + QT_VERSION: 5.15.2 UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1 steps: @@ -35,9 +36,16 @@ jobs: chmod +x llvm.sh sudo ./llvm.sh 16 + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v3 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + cache: true + - name: CMake run: | - cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On + cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On env: CC: clang-16 CXX: clang++-16 @@ -53,13 +61,19 @@ jobs: - name: Run tests run: ./cmake.output/bin/testrunner + - name: Generate dependencies + run: | + # make sure auto-generated GUI files exist + make -C cmake.output autogen + make -C cmake.output gui-build-deps triage-build-ui-deps + # TODO: only fail the step on sanitizer issues - name: Self check run: | selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp || ec=1 + ./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1 exit $ec diff --git a/.selfcheck_suppressions b/.selfcheck_suppressions index 2d1b563e36e..ba35bede778 100644 --- a/.selfcheck_suppressions +++ b/.selfcheck_suppressions @@ -12,7 +12,9 @@ simplifyUsing:gui/temp/moc_*.cpp funcArgNamesDifferent:gui/temp/moc_*.cpp symbolDatabaseWarning:tools/triage/temp/moc_*.cpp naming-varname:gui/temp/ui_*.h +naming-varname:cmake.output/gui/ui_*.h functionStatic:gui/temp/ui_fileview.h +functionStatic:cmake.output/gui/ui_fileview.h # --debug-warnings suppressions valueFlowBailout