From 59d827c697d481f56baa6b2e19d104308b2a286a Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Fri, 19 Mar 2010 15:17:47 +0100
Subject: [PATCH] Fix QTCREATORBUG-904 and 905

 * Also handle TeamBuilder issues similar to QTCB-904
---
 src/plugins/projectexplorer/gccparser.cpp | 29 ++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index 1d773956d10..4d54b1574f1 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -59,9 +59,26 @@ GccParser::GccParser()
 void GccParser::stdError(const QString &line)
 {
     QString lne = line.trimmed();
-    if (lne.startsWith(QLatin1String("collect2:")) ||
+
+    // Blacklist some lines to not handle them:
+    if (lne.startsWith(QLatin1String("TeamBuilder ")) ||
+        lne.startsWith(QLatin1String("distcc["))) {
+        IOutputParser::stdError(line);
+        return;
+    }
+    // Handle linker issues:
+    if (lne.startsWith(QLatin1String("ld: fatal: "))) {
+        QString description = lne.mid(11);
+        emit addTask(Task(Task::Error, description, QString(), -1, Constants::TASK_CATEGORY_COMPILE));
+        return;
+    } else if (lne.startsWith(QLatin1String("ld: warning: "))) {
+        QString description = lne.mid(13);
+        emit addTask(Task(Task::Warning, description, QString(), -1, Constants::TASK_CATEGORY_COMPILE));
+        return;
+    } else if (lne.startsWith(QLatin1String("collect2:")) ||
         lne.startsWith(QLatin1String("ERROR:")) ||
         lne == QLatin1String("* cpp failed")) {
+        // Handle misc. strange lines:
         emit addTask(Task(Task::Error,
                           lne /* description */,
                           QString() /* filename */,
@@ -342,6 +359,16 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
                          QString(), -1,
                          Constants::TASK_CATEGORY_COMPILE))
             << QString();
+    QTest::newRow("ld fatal")
+            << QString::fromLatin1("ld: fatal: Symbol referencing errors. No output written to testproject")
+            << OutputParserTester::STDERR
+            << QString() << QString()
+            << ( QList<ProjectExplorer::Task>()
+                 << Task(Task::Error,
+                         QLatin1String("Symbol referencing errors. No output written to testproject"),
+                         QString(), -1,
+                         Constants::TASK_CATEGORY_COMPILE))
+            << QString();
     QTest::newRow("Teambuilder issues")
             << QString::fromLatin1("TeamBuilder Client:: error: could not find Scheduler, running Job locally...")
             << OutputParserTester::STDERR
-- 
GitLab