From b888759ba180e9c13763091d80e81b0ecf738ea6 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 13 Jan 2021 10:05:25 +0100 Subject: [PATCH] Suppress issues for .pro files that are excluded from exact parse If a subdir in a subdir .pro file is excluded from the build with a scope, it still is parsed with an exact parser (in case cumulative parsing fails? see e.g. 440c40f53411054255f41f3efc96ec0a537e234c) In that case we may not add issues to the issues pane from the exact parser though, since for the subdir it is unexpected to be handled in that situation. Post to messages pane like before (without popping it up though). Fixes: QTCREATORBUG-25201 Change-Id: If626a5cbc0001170f28bce89ae17394323af2a7b Reviewed-by: hjk Reviewed-by: Christian Kandeler --- src/plugins/qtsupport/profilereader.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/qtsupport/profilereader.cpp b/src/plugins/qtsupport/profilereader.cpp index 7730ab95540..d012acab27e 100644 --- a/src/plugins/qtsupport/profilereader.cpp +++ b/src/plugins/qtsupport/profilereader.cpp @@ -34,6 +34,16 @@ using namespace ProjectExplorer; using namespace QtSupport; +static QString format(const QString &fileName, int lineNo, const QString &msg) +{ + if (lineNo > 0) + return QString::fromLatin1("%1(%2): %3").arg(fileName, QString::number(lineNo), msg); + else if (lineNo) + return QString::fromLatin1("%1: %3").arg(fileName, msg); + else + return msg; +} + ProMessageHandler::ProMessageHandler(bool verbose, bool exact) : m_verbose(verbose) , m_exact(exact) @@ -54,8 +64,12 @@ void ProMessageHandler::message(int type, const QString &msg, const QString &fil { if ((type & CategoryMask) == ErrorMessage && ((type & SourceMask) == SourceParser || m_verbose)) { // parse error in qmake files - TaskHub::addTask( - BuildSystemTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo)); + if (m_exact) { + TaskHub::addTask( + BuildSystemTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo)); + } else { + appendMessage(format(fileName, lineNo, msg)); + } } } @@ -64,9 +78,9 @@ void ProMessageHandler::fileMessage(int type, const QString &msg) // message(), warning() or error() calls in qmake files if (!m_verbose) return; - if (type == QMakeHandler::ErrorMessage) + if (m_exact && type == QMakeHandler::ErrorMessage) TaskHub::addTask(BuildSystemTask(Task::Error, msg)); - else if (type == QMakeHandler::WarningMessage) + else if (m_exact && type == QMakeHandler::WarningMessage) TaskHub::addTask(BuildSystemTask(Task::Warning, msg)); else appendMessage(msg);