Fixed #9240 (GUI: Issue with file names in suppressions (undesired expansion to full path))

This commit is contained in:
Daniel Marjamäki 2019-08-11 15:53:03 +02:00
parent 9aa97cbb95
commit 6c55d27f19
3 changed files with 2 additions and 21 deletions

View File

@ -461,7 +461,7 @@ void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLibrary, cons
mThread->setAddonsAndTools(mProjectFile->getAddonsAndTools(), mSettings->value(SETTINGS_MISRA_FILE).toString()); mThread->setAddonsAndTools(mProjectFile->getAddonsAndTools(), mSettings->value(SETTINGS_MISRA_FILE).toString());
QString clangHeaders = mSettings->value(SETTINGS_VS_INCLUDE_PATHS).toString(); QString clangHeaders = mSettings->value(SETTINGS_VS_INCLUDE_PATHS).toString();
mThread->setClangIncludePaths(clangHeaders.split(";")); mThread->setClangIncludePaths(clangHeaders.split(";"));
mThread->setSuppressions(mProjectFile->getCheckSuppressions()); mThread->setSuppressions(mProjectFile->getSuppressions());
} }
mThread->setProject(p); mThread->setProject(p);
mThread->check(checkSettings); mThread->check(checkSettings);
@ -860,7 +860,7 @@ Settings MainWindow::getCppcheckSettings()
tryLoadLibrary(&result.library, filename); tryLoadLibrary(&result.library, filename);
} }
foreach (const Suppressions::Suppression &suppression, mProjectFile->getCheckSuppressions()) { foreach (const Suppressions::Suppression &suppression, mProjectFile->getSuppressions()) {
result.nomsg.addSuppression(suppression); result.nomsg.addSuppression(suppression);
} }

View File

@ -574,19 +574,6 @@ void ProjectFile::readStringList(QStringList &stringlist, QXmlStreamReader &read
} while (!allRead); } while (!allRead);
} }
QList<Suppressions::Suppression> ProjectFile::getCheckSuppressions() const
{
QList<Suppressions::Suppression> ret;
const std::string projectFilePath = Path::getPathFromFilename(mFilename.toStdString());
foreach (Suppressions::Suppression suppression, getSuppressions()) {
if (!suppression.fileName.empty() && suppression.fileName[0]!='*' && !Path::isAbsolute(suppression.fileName))
suppression.fileName = Path::simplifyPath(projectFilePath) + suppression.fileName;
ret.append(suppression);
}
return ret;
}
void ProjectFile::setIncludes(const QStringList &includes) void ProjectFile::setIncludes(const QStringList &includes)
{ {
mIncludeDirs = includes; mIncludeDirs = includes;

View File

@ -148,12 +148,6 @@ public:
return mSuppressions; return mSuppressions;
} }
/**
* @brief Get "check" suppressions.
* @return list of suppressions.
*/
QList<Suppressions::Suppression> getCheckSuppressions() const;
/** /**
* @brief Get list addons. * @brief Get list addons.
* @return list of addons. * @return list of addons.