From fe2fa4d343fccd3fe346612fe881bce4a6a1ea10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 20 Aug 2016 13:47:25 +0200 Subject: [PATCH] GUI: Only check current platform when checking sln/vcxproj file --- gui/mainwindow.cpp | 5 ++++- lib/importproject.cpp | 10 ++++++++++ lib/importproject.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 68b987629..c670c0575 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -373,7 +373,6 @@ void MainWindow::DoCheckProject(ImportProject p) mUI.mResults->CheckingStarted(p.fileSettings.size()); - mThread->SetProject(p); QDir inf(mCurrentDirectory); const QString checkPath = inf.canonicalPath(); SetPath(SETTINGS_LAST_CHECK_PATH, checkPath); @@ -384,10 +383,14 @@ void MainWindow::DoCheckProject(ImportProject p) Settings checkSettings = GetCppcheckSettings(); checkSettings.force = false; + if (checkSettings.isWindowsPlatform()) + p.ignoreOtherPlatforms(checkSettings.platformType); + if (mProject) qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename(); //mThread->SetCheckProject(true); + mThread->SetProject(p); mThread->Check(checkSettings, true); } diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 0044606cf..5d6cc4d8f 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -43,6 +43,16 @@ void ImportProject::ignorePaths(std::vector &ipaths) } } +void ImportProject::ignoreOtherPlatforms(cppcheck::Platform::PlatformType platformType) +{ + for (std::list::iterator it = fileSettings.begin(); it != fileSettings.end();) { + if (it->platformType != cppcheck::Platform::Unspecified && it->platformType != platformType) + fileSettings.erase(it++); + else + ++it; + } +} + void ImportProject::FileSettings::setDefines(std::string defs) { while (defs.find(";%(") != std::string::npos) { diff --git a/lib/importproject.h b/lib/importproject.h index f8f05f78a..a86442683 100644 --- a/lib/importproject.h +++ b/lib/importproject.h @@ -52,6 +52,7 @@ public: std::list fileSettings; void ignorePaths(std::vector &ipaths); + void ignoreOtherPlatforms(cppcheck::Platform::PlatformType platformType); void import(const std::string &filename); private: