From 531cba58128b4ddfd251ac7c392e5355b68d691e Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 19 Jul 2013 10:17:14 +0300 Subject: [PATCH] LdParser: Do not interpret .data as a source filename Change-Id: Ide088490db3c48f5036cc2969d4841e08d9a15cd Reviewed-by: Friedemann Kleint Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/gccparser.cpp | 21 +++++++++++++++++++++ src/plugins/projectexplorer/ldparser.cpp | 9 ++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp index e0f051c6b38..1753e122586 100644 --- a/src/plugins/projectexplorer/gccparser.cpp +++ b/src/plugins/projectexplorer/gccparser.cpp @@ -839,6 +839,27 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() ) << QString(); + QTest::newRow("ld: .data section") + << QString::fromLatin1("foo.o:(.data+0x0): multiple definition of `foo'\n" + "bar.o:(.data+0x0): first defined here\n" + "collect2: error: ld returned 1 exit status") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Error, + QLatin1String("multiple definition of `foo'"), + Utils::FileName::fromUserInput(QLatin1String("foo.o")), -1, + categoryCompile) + << Task(Task::Unknown, + QLatin1String("first defined here"), + Utils::FileName::fromUserInput(QLatin1String("bar.o")), -1, + categoryCompile) + << Task(Task::Error, + QLatin1String("collect2: error: ld returned 1 exit status"), + Utils::FileName(), -1, + categoryCompile) + ) + << QString(); } void ProjectExplorerPlugin::testGccOutputParsers() diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp index 839b2d75973..47ff09bc4c0 100644 --- a/src/plugins/projectexplorer/ldparser.cpp +++ b/src/plugins/projectexplorer/ldparser.cpp @@ -97,9 +97,12 @@ void LdParser::stdError(const QString &line) if (!ok) lineno = -1; Utils::FileName filename = Utils::FileName::fromUserInput(m_regExpLinker.cap(1)); - if (!m_regExpLinker.cap(4).isEmpty() - && !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text"))) - filename = Utils::FileName::fromUserInput(m_regExpLinker.cap(4)); + const QString sourceFileName = m_regExpLinker.cap(4); + if (!sourceFileName.isEmpty() + && !sourceFileName.startsWith(QLatin1String("(.text")) + && !sourceFileName.startsWith(QLatin1String("(.data"))) { + filename = Utils::FileName::fromUserInput(sourceFileName); + } QString description = m_regExpLinker.cap(8).trimmed(); Task task(Task::Error, description, filename, lineno, Core::Id(Constants::TASK_CATEGORY_COMPILE));