From cf21db02a5d9f2065025d94ee7710623e047a4a2 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 7 May 2021 11:16:10 +0200 Subject: [PATCH] ProjectExplorer: Restrain the LdParser We cannot blindly catch any string with two colons in it. Use a whitelist instead. We can easily extend it when needed. Fixes: QTCREATORBUG-25677 Change-Id: I72f63860584af51220d6c4b71c07d2355f6bb57c Reviewed-by: hjk --- src/plugins/projectexplorer/ldparser.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp index 2d85f8f28cf..33cf1b85ade 100644 --- a/src/plugins/projectexplorer/ldparser.cpp +++ b/src/plugins/projectexplorer/ldparser.cpp @@ -26,6 +26,7 @@ #include "ldparser.h" #include "projectexplorerconstants.h" +#include #include using namespace ProjectExplorer; @@ -140,10 +141,21 @@ Utils::OutputLineParser::Result LdParser::handleLine(const QString &line, Utils: type = Task::Warning; description = description.mid(9); } - LinkSpecs linkSpecs; - addLinkSpecForAbsoluteFilePath(linkSpecs, filename, lineno, match, capIndex); - scheduleTask(CompileTask(type, description, filename, lineno), 1); - return {Status::Done, linkSpecs}; + static const QStringList keywords{ + "File format not recognized", + "undefined reference", + "first defined here", + "feupdateenv is not implemented and will always fail", // yes, this is quite special ... + }; + const auto descriptionContainsKeyword = [&description](const QString &keyword) { + return description.contains(keyword); + }; + if (Utils::anyOf(keywords, descriptionContainsKeyword)) { + LinkSpecs linkSpecs; + addLinkSpecForAbsoluteFilePath(linkSpecs, filename, lineno, match, capIndex); + scheduleTask(CompileTask(type, description, filename, lineno), 1); + return {Status::Done, linkSpecs}; + } } return Status::NotHandled;