From c2c4aca72c085cc1f3343feda845c99c4dfb8a80 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 3 Jun 2025 21:00:15 +0200 Subject: [PATCH 1/6] gui/mainwindow.cpp: added TODOs --- gui/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index af9dbc2a3ba..6f1910aba50 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -797,7 +797,7 @@ void MainWindow::analyzeFiles() p.ignoreOtherConfigs(cfg.toStdString()); } - doAnalyzeProject(p); + doAnalyzeProject(p); // TODO: avoid copy return; } @@ -1960,7 +1960,7 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const QStringLis msg.exec(); return; } - doAnalyzeProject(p, checkLibrary, checkConfiguration); + doAnalyzeProject(p, checkLibrary, checkConfiguration); // TODO: avoid copy return; } From e8c5e0ceccd516d3f5e89e0603198caebbd5d42f Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 3 Jun 2025 21:15:00 +0200 Subject: [PATCH 2/6] moved `enforcedLang` from `Settings` to `CmdLineParser` --- cli/cmdlineparser.cpp | 12 ++++++------ cli/cmdlineparser.h | 6 ++++-- gui/mainwindow.cpp | 2 +- lib/settings.h | 3 --- test/testcmdlineparser.cpp | 8 ++++---- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 0ad4648d0af..5de6e0113ce 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -221,14 +221,14 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[]) mFileSettings.clear(); - if (mSettings.enforcedLang != Standards::Language::None) + if (mEnforcedLang != Standards::Language::None) { // apply enforced language for (auto& fs : fileSettings) { if (mSettings.library.markupFile(fs.filename())) continue; - fs.file.setLang(mSettings.enforcedLang); + fs.file.setLang(mEnforcedLang); } } else @@ -324,14 +324,14 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[]) files = std::move(filesResolved); } - if (mSettings.enforcedLang != Standards::Language::None) + if (mEnforcedLang != Standards::Language::None) { // apply enforced language for (auto& f : files) { if (mSettings.library.markupFile(f.path())) continue; - f.setLang(mSettings.enforcedLang); + f.setLang(mEnforcedLang); } } else @@ -985,9 +985,9 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a } if (str == "c") - mSettings.enforcedLang = Standards::Language::C; + mEnforcedLang = Standards::Language::C; else if (str == "c++") - mSettings.enforcedLang = Standards::Language::CPP; + mEnforcedLang = Standards::Language::CPP; else { mLogger.printError("unknown language '" + str + "' enforced."); return Result::Fail; diff --git a/cli/cmdlineparser.h b/cli/cmdlineparser.h index f352db70a68..93c7d30c1dc 100644 --- a/cli/cmdlineparser.h +++ b/cli/cmdlineparser.h @@ -27,6 +27,7 @@ #include "cmdlinelogger.h" #include "filesettings.h" +#include "standards.h" #include "utils.h" class Settings; @@ -46,6 +47,7 @@ class Library; * class internal options. */ class CmdLineParser { + friend class TestCmdlineParser; public: /** * The constructor. @@ -175,8 +177,8 @@ class CmdLineParser { Settings &mSettings; Suppressions &mSuppressions; bool mAnalyzeAllVsConfigsSetOnCmdLine = false; - - friend class TestCmdlineParser; + /** @brief Name of the language that is enforced. Empty per default. */ + Standards::Language mEnforcedLang{Standards::Language::None}; }; /// @} diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 6f1910aba50..d44ef700e8e 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1208,7 +1208,7 @@ bool MainWindow::getCppcheckSettings(Settings& settings, Suppressions& supprs) settings.platform.set(static_cast(mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt())); settings.standards.setCPP(mSettings->value(SETTINGS_STD_CPP, QString()).toString().toStdString()); settings.standards.setC(mSettings->value(SETTINGS_STD_C, QString()).toString().toStdString()); - settings.enforcedLang = static_cast(mSettings->value(SETTINGS_ENFORCED_LANGUAGE, 0).toInt()); + Standards::Language enforcedLang = static_cast(mSettings->value(SETTINGS_ENFORCED_LANGUAGE, 0).toInt()); settings.jobs = std::max(settings.jobs, 1u); diff --git a/lib/settings.h b/lib/settings.h index f01614d6911..eb33f44540b 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -236,9 +236,6 @@ class CPPCHECKLIB WARN_UNUSED Settings { /** @brief Do not filter duplicated errors. */ bool emitDuplicates{}; - /** @brief Name of the language that is enforced. Empty per default. */ - Standards::Language enforcedLang{}; - #if defined(USE_WINDOWS_SEH) || defined(USE_UNIX_SIGNAL_HANDLING) /** @brief Is --exception-handling given */ bool exceptionHandling{}; diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 3d984eb3727..3246e3ccd6e 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -765,14 +765,14 @@ class TestCmdlineParser : public TestFixture { REDIRECT; const char * const argv[] = {"cppcheck", "file.cpp"}; ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parseFromArgs(argv)); - ASSERT_EQUALS(Standards::Language::None, settings->enforcedLang); + ASSERT_EQUALS(Standards::Language::None, parser->mEnforcedLang); } void enforceLanguage2() { REDIRECT; const char * const argv[] = {"cppcheck", "-x", "c++", "file.cpp"}; ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parseFromArgs(argv)); - ASSERT_EQUALS(Standards::Language::CPP, settings->enforcedLang); + ASSERT_EQUALS(Standards::Language::CPP, parser->mEnforcedLang); } void enforceLanguage3() { @@ -793,14 +793,14 @@ class TestCmdlineParser : public TestFixture { REDIRECT; const char * const argv[] = {"cppcheck", "--language=c++", "file.cpp"}; ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parseFromArgs(argv)); - ASSERT_EQUALS(Standards::Language::CPP, settings->enforcedLang); + ASSERT_EQUALS(Standards::Language::CPP, parser->mEnforcedLang); } void enforceLanguage6() { REDIRECT; const char * const argv[] = {"cppcheck", "--language=c", "file.cpp"}; ASSERT_EQUALS_ENUM(CmdLineParser::Result::Success, parseFromArgs(argv)); - ASSERT_EQUALS(Standards::Language::C, settings->enforcedLang); + ASSERT_EQUALS(Standards::Language::C, parser->mEnforcedLang); } void enforceLanguage7() { From 6916e84dda1857baa56864212005ee4de87f5121 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 3 Jun 2025 21:32:28 +0200 Subject: [PATCH 3/6] fixed #13909 / refs #13914 - added (enforced) language handling for imported projects in GUI --- Makefile | 6 ++- cli/cmdlineparser.cpp | 37 ++--------------- frontend/frontend.cpp | 48 ++++++++++++++++++++- frontend/frontend.h | 14 ++++++- gui/mainwindow.cpp | 7 +++- test/testfrontend.cpp | 92 +++++++++++++++++++++++++++++++++++++++++ test/testrunner.vcxproj | 1 + 7 files changed, 166 insertions(+), 39 deletions(-) create mode 100644 test/testfrontend.cpp diff --git a/Makefile b/Makefile index 74c4b819ce3..09319c8ac6a 100644 --- a/Makefile +++ b/Makefile @@ -295,6 +295,7 @@ TESTOBJ = test/fixture.o \ test/testexecutor.o \ test/testfilelister.o \ test/testfilesettings.o \ + test/testfrontend.o \ test/testfunctions.o \ test/testgarbage.o \ test/testimportproject.o \ @@ -659,7 +660,7 @@ $(libcppdir)/vf_settokenvalue.o: lib/vf_settokenvalue.cpp lib/addoninfo.h lib/as $(libcppdir)/vfvalue.o: lib/vfvalue.cpp lib/config.h lib/errortypes.h lib/mathlib.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/vfvalue.h $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/vfvalue.cpp -frontend/frontend.o: frontend/frontend.cpp frontend/frontend.h +frontend/frontend.o: frontend/frontend.cpp frontend/frontend.h lib/addoninfo.h lib/checkers.h lib/config.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/utils.h $(CXX) ${INCLUDE_FOR_FE} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ frontend/frontend.cpp cli/cmdlineparser.o: cli/cmdlineparser.cpp cli/cmdlinelogger.h cli/cmdlineparser.h cli/filelister.h externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/check.h lib/checkers.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/pathmatch.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h lib/xml.h @@ -770,6 +771,9 @@ test/testfilelister.o: test/testfilelister.cpp cli/filelister.h lib/addoninfo.h test/testfilesettings.o: test/testfilesettings.cpp lib/addoninfo.h lib/check.h lib/checkers.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/utils.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testfilesettings.cpp +test/testfrontend.o: test/testfrontend.cpp lib/addoninfo.h lib/check.h lib/checkers.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/utils.h test/fixture.h + $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testfrontend.cpp + test/testfunctions.o: test/testfunctions.cpp lib/addoninfo.h lib/check.h lib/checkers.h lib/checkfunctions.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testfunctions.cpp diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 5de6e0113ce..7a52c298cfd 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -39,6 +39,8 @@ #include "timer.h" #include "utils.h" +#include "frontend.h" + #include #include #include @@ -221,40 +223,7 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[]) mFileSettings.clear(); - if (mEnforcedLang != Standards::Language::None) - { - // apply enforced language - for (auto& fs : fileSettings) - { - if (mSettings.library.markupFile(fs.filename())) - continue; - fs.file.setLang(mEnforcedLang); - } - } - else - { - // identify files - for (auto& fs : fileSettings) - { - if (mSettings.library.markupFile(fs.filename())) - continue; - assert(fs.file.lang() == Standards::Language::None); - bool header = false; - fs.file.setLang(Path::identify(fs.filename(), mSettings.cppHeaderProbe, &header)); - // unknown extensions default to C++ - if (!header && fs.file.lang() == Standards::Language::None) - fs.file.setLang(Standards::Language::CPP); - } - } - - // enforce the language since markup files are special and do not adhere to the enforced language - for (auto& fs : fileSettings) - { - if (mSettings.library.markupFile(fs.filename())) { - assert(fs.file.lang() == Standards::Language::None); - fs.file.setLang(Standards::Language::C); - } - } + frontend::applyLang(fileSettings, mSettings, mEnforcedLang); // sort the markup last std::copy_if(fileSettings.cbegin(), fileSettings.cend(), std::back_inserter(mFileSettings), [&](const FileSettings &fs) { diff --git a/frontend/frontend.cpp b/frontend/frontend.cpp index 133ab8ac8fe..eaaf34f33fd 100644 --- a/frontend/frontend.cpp +++ b/frontend/frontend.cpp @@ -18,5 +18,49 @@ #include "frontend.h" -namespace frontend -{} +#include "filesettings.h" +#include "library.h" +#include "path.h" +#include "settings.h" + +#include + +namespace frontend { + void applyLang(std::list& fileSettings, const Settings& settings, Standards::Language enforcedLang) + { + if (enforcedLang != Standards::Language::None) + { + // apply enforced language + for (auto& fs : fileSettings) + { + if (settings.library.markupFile(fs.filename())) + continue; + fs.file.setLang(enforcedLang); + } + } + else + { + // identify files + for (auto& fs : fileSettings) + { + if (settings.library.markupFile(fs.filename())) + continue; + assert(fs.file.lang() == Standards::Language::None); + bool header = false; + fs.file.setLang(Path::identify(fs.filename(), settings.cppHeaderProbe, &header)); + // unknown extensions default to C++ + if (!header && fs.file.lang() == Standards::Language::None) + fs.file.setLang(Standards::Language::CPP); + } + } + + // enforce the language since markup files are special and do not adhere to the enforced language + for (auto& fs : fileSettings) + { + if (settings.library.markupFile(fs.filename())) { + assert(fs.file.lang() == Standards::Language::None); + fs.file.setLang(Standards::Language::C); + } + } + } +} diff --git a/frontend/frontend.h b/frontend/frontend.h index 50a20264af1..1a8a92743b2 100644 --- a/frontend/frontend.h +++ b/frontend/frontend.h @@ -19,7 +19,19 @@ #ifndef FRONTEND_H #define FRONTEND_H +#include "standards.h" + +#include + +struct FileSettings; +class Settings; + namespace frontend -{} +{ + /** + Applies the enforced language as all as identifying remaining files - also taking markup files into consideration. + */ + void applyLang(std::list &fileSettings, const Settings &settings, Standards::Language enforcedLang); +} #endif // FRONTEND_H diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index d44ef700e8e..9ee68cf7ee9 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -54,6 +54,8 @@ #include "ui_mainwindow.h" +#include "frontend.h" + #include #include #include @@ -604,6 +606,10 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLibrary, cons mThread->setClangIncludePaths(clangHeaders.split(";")); mThread->setSuppressions(mProjectFile->getSuppressions()); } + + const Standards::Language enforcedLang = static_cast(mSettings->value(SETTINGS_ENFORCED_LANGUAGE, 0).toInt()); + frontend::applyLang(p.fileSettings, checkSettings, enforcedLang); + mThread->setProject(p); mThread->check(checkSettings, supprs); mUI->mResults->setCheckSettings(checkSettings); @@ -1208,7 +1214,6 @@ bool MainWindow::getCppcheckSettings(Settings& settings, Suppressions& supprs) settings.platform.set(static_cast(mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt())); settings.standards.setCPP(mSettings->value(SETTINGS_STD_CPP, QString()).toString().toStdString()); settings.standards.setC(mSettings->value(SETTINGS_STD_C, QString()).toString().toStdString()); - Standards::Language enforcedLang = static_cast(mSettings->value(SETTINGS_ENFORCED_LANGUAGE, 0).toInt()); settings.jobs = std::max(settings.jobs, 1u); diff --git a/test/testfrontend.cpp b/test/testfrontend.cpp new file mode 100644 index 00000000000..941394863f3 --- /dev/null +++ b/test/testfrontend.cpp @@ -0,0 +1,92 @@ +/* + * Cppcheck - A tool for static C/C++ code analysis + * Copyright (C) 2007-2025 Cppcheck team. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "fixture.h" +#include "frontend.h" +#include "settings.h" +#include "standards.h" + +#include +#include + +class TestFrontend : public TestFixture { +public: + TestFrontend() : TestFixture("TestFrontend") {} + +private: + void run() override { + TEST_CASE(applyLangFS); + } + + void applyLangFS() const { + const char xmldata[] = R"()"; + const Settings s = settingsBuilder().libraryxml(xmldata).build(); + + const std::list fs = { + {"nolang", Standards::Language::None, 0 }, + {"c", Standards::Language::None, 0 }, // TODO: should be C - FileSettings are currently expected to not be pre-identified + {"cpp", Standards::Language::None, 0 }, // TODO: should be CPP - FileSettings arecurrently expected to not be pre-identified + {"nolang.c", Standards::Language::None, 0 }, + {"nolang.cpp", Standards::Language::None, 0 }, + {"nolang.ml", Standards::Language::None, 0 } + }; + + // no language to enforce - identify only + { + std::list fs1 = fs; + frontend::applyLang(fs1, s, Standards::Language::None); + auto it = fs1.cbegin(); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); // unknown defaults to C++ + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); // unknown defaults to C++ + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); // unknown defaults to C++ + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); // markup files are always C + } + + // language to enforce (C) + { + std::list fs1 = fs; + frontend::applyLang(fs1, s, Standards::Language::C); + auto it = fs1.cbegin(); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); // markup files are always C + } + + // language to enforce (C++) + { + std::list fs1 = fs; + frontend::applyLang(fs1, s, Standards::Language::CPP); + auto it = fs1.cbegin(); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::CPP); + ASSERT_EQUALS_ENUM((it++)->file.lang(), Standards::Language::C); // markup files are always C + } + } +}; + +REGISTER_TEST(TestFrontend) diff --git a/test/testrunner.vcxproj b/test/testrunner.vcxproj index 176f9737ad9..8e1ce01f07e 100755 --- a/test/testrunner.vcxproj +++ b/test/testrunner.vcxproj @@ -65,6 +65,7 @@ + From 4d6fc1a95f865acdf82795ce2190bb9f7e63a394 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 10 Jun 2025 11:36:40 +0200 Subject: [PATCH 4/6] added some TODOs about missing handling of enforced language in GUI --- gui/checkthread.cpp | 2 ++ gui/mainwindow.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index e83a2d09dd2..808ef8a5225 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -143,6 +143,7 @@ void CheckThread::run() qDebug() << "Whole program analysis"; std::list files2; std::transform(mFiles.cbegin(), mFiles.cend(), std::back_inserter(files2), [&](const QString& file) { + // TODO: apply enforcedLanguage return FileWithDetails{file.toStdString(), Path::identify(file.toStdString(), mSettings.cppHeaderProbe), 0}; }); cppcheck.analyseWholeProgram(mSettings.buildDir, files2, {}, ctuInfo); @@ -151,6 +152,7 @@ void CheckThread::run() return; } + // TODO: apply enforcedLanguage const FileWithDetails* file = nullptr; mResult.getNextFile(file); while (file && mState == Running) { diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 9ee68cf7ee9..cfc181768c2 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -709,6 +709,7 @@ void MainWindow::analyzeCode(const QString& code, const QString& filename) checkLockDownUI(); clearResults(); mUI->mResults->checkingStarted(1); + // TODO: apply enforcedLanguage cppcheck.check(FileWithDetails(filename.toStdString(), Path::identify(filename.toStdString(), false), 0), code.toStdString()); analysisDone(); From cedc572c630c5ba225435e07d9288387b89cd25c Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 22 Jun 2025 18:29:48 +0200 Subject: [PATCH 5/6] Makefile: added missing `frontend` include for `testrunner` --- Makefile | 2 +- tools/dmake/dmake.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 09319c8ac6a..dea7b5b7cd6 100644 --- a/Makefile +++ b/Makefile @@ -171,7 +171,7 @@ ifndef INCLUDE_FOR_CLI endif ifndef INCLUDE_FOR_TEST - INCLUDE_FOR_TEST=-Ilib -Icli -isystem externals/simplecpp -isystem externals/tinyxml2 + INCLUDE_FOR_TEST=-Ilib -Ifrontend -Icli -isystem externals/simplecpp -isystem externals/tinyxml2 endif BIN=$(DESTDIR)$(PREFIX)/bin diff --git a/tools/dmake/dmake.cpp b/tools/dmake/dmake.cpp index 1dc58916b48..f54907c3759 100644 --- a/tools/dmake/dmake.cpp +++ b/tools/dmake/dmake.cpp @@ -754,7 +754,7 @@ int main(int argc, char **argv) makeConditionalVariable(fout, "INCLUDE_FOR_LIB", "-Ilib -isystem externals -isystem externals/picojson -isystem externals/simplecpp -isystem externals/tinyxml2"); makeConditionalVariable(fout, "INCLUDE_FOR_FE", "-Ilib"); makeConditionalVariable(fout, "INCLUDE_FOR_CLI", "-Ilib -Ifrontend -isystem externals/picojson -isystem externals/simplecpp -isystem externals/tinyxml2"); - makeConditionalVariable(fout, "INCLUDE_FOR_TEST", "-Ilib -Icli -isystem externals/simplecpp -isystem externals/tinyxml2"); + makeConditionalVariable(fout, "INCLUDE_FOR_TEST", "-Ilib -Ifrontend -Icli -isystem externals/simplecpp -isystem externals/tinyxml2"); fout << "BIN=$(DESTDIR)$(PREFIX)/bin\n\n"; fout << "# For 'make man': sudo apt-get install xsltproc docbook-xsl docbook-xml on Linux\n"; From 73e37f5b004afc819a0ceb7d20166fc98c025b48 Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 22 Jun 2025 20:25:45 +0200 Subject: [PATCH 6/6] adjusted selfchecks for `frontend` --- .github/workflows/CI-unixish.yml | 8 +++++--- .github/workflows/asan.yml | 8 +++++--- .github/workflows/tsan.yml | 8 +++++--- .github/workflows/ubsan.yml | 8 +++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 964948b4fb9..66da4e21bdd 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -523,13 +523,15 @@ jobs: ./cppcheck $selfcheck_options externals || ec=1 # self check lib/cli mkdir b1 - ./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json cli frontend || ec=1 + ./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json frontend || ec=1 + ./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json -Ifrontend cli || ec=1 ./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 -Igui gui/*.cpp cmake.output/gui || ec=1 + ./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 # self check test and tools - ./cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/dmake/*.cpp || ec=1 + ./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 exit $ec diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 44b490cbf94..2609007b391 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -145,9 +145,11 @@ jobs: cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json cli frontend || 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 -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/dmake/*.cpp || 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/*.cpp || 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/*.cpp || ec=1 exit $ec diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index 3fa13777bd8..5243361dd85 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -148,9 +148,11 @@ jobs: cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json cli frontend || 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 -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/dmake/*.cpp || 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/*.cpp || 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/*.cpp || ec=1 exit $ec diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index 349be66c201..b36e275ba07 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -142,9 +142,11 @@ jobs: cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2" ec=0 ./cmake.output/bin/cppcheck $selfcheck_options externals || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json cli frontend || 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 -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1 - ./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/dmake/*.cpp || 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/*.cpp || 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/*.cpp || ec=1 exit $ec