summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2010-04-07 17:24:26 +0200
committercon <qtc-committer@nokia.com>2010-04-13 17:20:17 +0200
commitc7be07e504595d3434c61e79631b81a32099cc1e (patch)
tree81219d199ade0a968ea8c94467e6e48ae6335022
parent7f8607702dd40c7e281963ac65102c08aeb5e738 (diff)
downloadqt-creator-c7be07e504595d3434c61e79631b81a32099cc1e.tar.gz
Handle "/usr/bin/ld: cannot find -lsomelib" in gccparser
* Document the hariest regexp * Simplify the parser a bit * Catch "/usr/bin/ld: cannot find -lsomelib" (and others) as errors. (cherry picked from commit 8b969a67a0a300641779ba31f7c630dc5ab2ba2c)
-rw-r--r--src/plugins/projectexplorer/gccparser.cpp50
1 files changed, 33 insertions, 17 deletions
diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index ea2f2e359e..2f98f8dbd5 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -51,7 +51,13 @@ GccParser::GccParser()
m_regExpLinker.setPattern(QString::fromLatin1(FILE_PATTERN) + '(' + QLatin1String(POSITION_PATTERN) + ")?\\s(.+)$");
m_regExpLinker.setMinimal(true);
- m_regExpGccNames.setPattern("^([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(gcc|g\\+\\+)(-[0-9\\.]+)?: ");
+ // treat ld (and gold) as part of gcc for simplicity
+ // optional path with trailing slash
+ // optional arm-linux-none-thingy
+ // name of executable
+ // optional trailing version number
+ // optional .exe postfix
+ m_regExpGccNames.setPattern("^(.*[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(gcc|g\\+\\+|ld|gold)(-[0-9\\.]+)?(\\.exe)?: ");
m_regExpGccNames.setMinimal(true);
m_regExpInFunction.setPattern("^In (static |member )*function ");
@@ -68,19 +74,11 @@ void GccParser::stdError(const QString &line)
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:")) ||
+
+ // Handle misc issues:
+ 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 */,
@@ -88,11 +86,19 @@ void GccParser::stdError(const QString &line)
Constants::TASK_CATEGORY_COMPILE));
return;
} else if (m_regExpGccNames.indexIn(lne) > -1) {
- emit addTask(Task(Task::Error,
- lne.mid(m_regExpGccNames.matchedLength()), /* description */
- QString(), /* filename */
- -1, /* line */
- Constants::TASK_CATEGORY_COMPILE));
+ QString description = lne.mid(m_regExpGccNames.matchedLength());
+ Task task(Task::Error,
+ description,
+ QString(), /* filename */
+ -1, /* line */
+ Constants::TASK_CATEGORY_COMPILE);
+ if (description.startsWith(QLatin1String("warning: "))) {
+ task.type = Task::Warning;
+ task.description = description.mid(9);
+ } else if (description.startsWith(QLatin1String("fatal: "))) {
+ task.description = description.mid(7);
+ }
+ emit addTask(task);
return;
} else if (m_regExp.indexIn(lne) > -1) {
QString filename = m_regExp.cap(1);
@@ -413,6 +419,16 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
<< QString() << QString("ranlib: file: libSupport.a(HashTable.o) has no symbols")
<< QList<ProjectExplorer::Task>()
<< QString();
+ QTest::newRow("ld: missing library")
+ << QString::fromLatin1("/usr/bin/ld: cannot find -ldoesnotexist")
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << ( QList<ProjectExplorer::Task>()
+ << Task(Task::Error,
+ QLatin1String("cannot find -ldoesnotexist"),
+ QString(), -1,
+ Constants::TASK_CATEGORY_COMPILE))
+ << QString();
}
void ProjectExplorerPlugin::testGccOutputParsers()