From 5a75b87b37a89b8ebec7b5507239204b51fe1c03 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 2 Mar 2015 14:34:06 +0100 Subject: [PATCH] OutputParser: Treat ranlib warnings as warnings Task-number: QTCREATORBUG-13111 Change-Id: Ifead2f7fa8d00eb044894b6d9ef0e7626e13f867 Reviewed-by: Eike Ziller --- src/plugins/projectexplorer/gccparser.cpp | 30 +++++++++++++++++------ src/plugins/projectexplorer/ldparser.cpp | 15 +++++++++++- src/plugins/projectexplorer/ldparser.h | 1 + 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp index c5eb12025c6..61dadc78330 100644 --- a/src/plugins/projectexplorer/gccparser.cpp +++ b/src/plugins/projectexplorer/gccparser.cpp @@ -88,7 +88,6 @@ void GccParser::stdError(const QString &line) } QRegularExpressionMatch match = m_regExpGccNames.match(lne); - if (match.hasMatch()) { QString description = lne.mid(match.capturedLength()); Task::TaskType type = Task::Error; @@ -458,12 +457,6 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() << QString() << QString::fromLatin1("rm: cannot remove `release/moc_mainwindow.cpp': No such file or directory\n") << QList() << QString(); - QTest::newRow("ranlib false positive") - << QString::fromLatin1("ranlib: file: libSupport.a(HashTable.o) has no symbols") - << OutputParserTester::STDERR - << QString() << QString::fromLatin1("ranlib: file: libSupport.a(HashTable.o) has no symbols\n") - << QList() - << QString(); QTest::newRow("ld: missing library") << QString::fromLatin1("/usr/bin/ld: cannot find -ldoesnotexist") << OutputParserTester::STDERR @@ -866,6 +859,29 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() categoryCompile) ) << QString(); + + QTest::newRow("Mac: ranlib warning") + << QString::fromLatin1("ranlib: file: lib/libtest.a(Test0.cpp.o) has no symbols") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Warning, + QLatin1String("file: lib/libtest.a(Test0.cpp.o) has no symbols"), + Utils::FileName(), -1, + categoryCompile) + ) + << QString(); + QTest::newRow("Mac: ranlib warning2") + << QString::fromLatin1("/path/to/XCode/and/ranlib: file: lib/libtest.a(Test0.cpp.o) has no symbols") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Warning, + QLatin1String("file: lib/libtest.a(Test0.cpp.o) has no symbols"), + Utils::FileName(), -1, + categoryCompile) + ) + << QString(); } void ProjectExplorerPlugin::testGccOutputParsers() diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp index 2786f866421..696583c47e4 100644 --- a/src/plugins/projectexplorer/ldparser.cpp +++ b/src/plugins/projectexplorer/ldparser.cpp @@ -42,11 +42,14 @@ namespace { // line no. or elf segment + offset (1 bracket) const char * const POSITION_PATTERN = "(\\d+|\\(\\..+?[+-]0x[a-fA-F0-9]+\\)):"; const char * const COMMAND_PATTERN = "^(.*[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(ld|gold)(-[0-9\\.]+)?(\\.exe)?: "; + const char *const RANLIB_PATTERN = "ranlib(.exe)?: (file: (.*) has no symbols)$"; } LdParser::LdParser() { setObjectName(QLatin1String("LdParser")); + m_ranlib.setPattern(QLatin1String(RANLIB_PATTERN)); + QTC_CHECK(m_ranlib.isValid()); m_regExpLinker.setPattern(QLatin1Char('^') + QString::fromLatin1(FILE_PATTERN) + QLatin1Char('(') + QString::fromLatin1(FILE_PATTERN) + QLatin1String(")?(") + @@ -76,7 +79,17 @@ void LdParser::stdError(const QString &line) return; } - QRegularExpressionMatch match = m_regExpGccNames.match(lne); + QRegularExpressionMatch match = m_ranlib.match(lne); + if (match.hasMatch()) { + QString description = match.captured(2); + Task task(Task::Warning, description, + Utils::FileName(), -1, + Constants::TASK_CATEGORY_COMPILE); + emit addTask(task); + return; + } + + match = m_regExpGccNames.match(lne); if (match.hasMatch()) { QString description = lne.mid(match.capturedLength()); Task::TaskType type = Task::Error; diff --git a/src/plugins/projectexplorer/ldparser.h b/src/plugins/projectexplorer/ldparser.h index 4c9b66f7cf0..04471a28720 100644 --- a/src/plugins/projectexplorer/ldparser.h +++ b/src/plugins/projectexplorer/ldparser.h @@ -46,6 +46,7 @@ public: void stdError(const QString &line); private: + QRegularExpression m_ranlib; QRegularExpression m_regExpLinker; QRegularExpression m_regExpGccNames; };