From 16dc8a0540641d662d0bcc7af808c1b3238735bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 9 Aug 2019 19:00:09 +0200 Subject: [PATCH] GUI: Suppressing addon warnings --- gui/checkthread.cpp | 25 ++++++++++++++++--------- gui/checkthread.h | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index c3414a9d3..c14067446 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -360,12 +360,16 @@ void CheckThread::parseAddonErrors(QString err, const QString &tool) const int column = obj["col"].toInt(); const std::string severity = obj["severity"].toString().toStdString(); const std::string message = obj["message"].toString().toStdString(); - const std::string id = obj["errorId"].toString().toStdString(); + const std::string id = (obj["addon"].toString() + "-" + obj["errorId"].toString()).toStdString(); std::list callstack; callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(filename, lineNumber)); callstack.back().col = column; ErrorLogger::ErrorMessage errmsg(callstack, filename, Severity::fromString(severity), message, id, false); + + if (isSuppressed(errmsg.toSuppressionsErrorMessage())) + continue; + mResult.reportErr(errmsg); } } @@ -452,15 +456,9 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS errorMessage.errorId = e.errorId.toStdString(); errorMessage.symbolNames = e.symbolNames.toStdString(); - bool isSuppressed = false; - foreach (const Suppressions::Suppression &suppression, mSuppressions) { - if (suppression.isSuppressed(errorMessage)) { - isSuppressed = true; - break; - } - } - if (isSuppressed) + if (isSuppressed(errorMessage)) continue; + std::list callstack; foreach (const QErrorPathItem &path, e.errorPath) { callstack.push_back(ErrorLogger::ErrorMessage::FileLocation(path.file.toStdString(), path.info.toStdString(), path.line)); @@ -473,6 +471,15 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS } } +bool CheckThread::isSuppressed(const Suppressions::ErrorMessage &errorMessage) const +{ + foreach (const Suppressions::Suppression &suppression, mSuppressions) { + if (suppression.isSuppressed(errorMessage)) + return true; + } + return false; +} + QString CheckThread::clangCmd() { QString path = QSettings().value(SETTINGS_CLANG_PATH,QString()).toString(); diff --git a/gui/checkthread.h b/gui/checkthread.h index c85c4aa7a..5c9ea19b8 100644 --- a/gui/checkthread.h +++ b/gui/checkthread.h @@ -147,6 +147,8 @@ private: void parseAddonErrors(QString err, const QString &tool); void parseClangErrors(const QString &tool, const QString &file0, QString err); + bool isSuppressed(const Suppressions::ErrorMessage &errorMessage) const; + QStringList mFiles; bool mAnalyseWholeProgram; QStringList mAddonsAndTools;