Qmake: moc notes no longer are considered to be errors

Change-Id: Ifccd877d5096279f38a0084a4cb0eba0e7705d87
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-02-11 11:55:00 +01:00
parent 3990c1c7ed
commit eb651f9fd6
6 changed files with 65 additions and 7 deletions

View File

@@ -31,11 +31,12 @@ using namespace ProjectExplorer;
static Task::TaskType taskType(const QString &capture) static Task::TaskType taskType(const QString &capture)
{ {
if (capture == QLatin1String("warning")) const QString lc = capture.toLower();
if (lc == QLatin1String("error"))
return Task::Error;
if (lc == QLatin1String("warning"))
return Task::Warning; return Task::Warning;
else if (capture == QLatin1String("note")) return Task::Unknown;
return Task::Unknown;
return Task::Error;
} }
// opt. drive letter + filename: (2 brackets) // opt. drive letter + filename: (2 brackets)
@@ -249,6 +250,17 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
Utils::FileName(), -1, Utils::FileName(), -1,
categoryCompile)) categoryCompile))
<< QString(); << QString();
QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("Note: No relevant classes found. No output generated."),
Utils::FileName::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0,
categoryCompile)
)
<< QString();
} }
void ProjectExplorerPlugin::testClangOutputParser() void ProjectExplorerPlugin::testClangOutputParser()

View File

@@ -880,6 +880,17 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
categoryCompile) categoryCompile)
) )
<< QString(); << QString();
QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("Note: No relevant classes found. No output generated."),
Utils::FileName::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0,
categoryCompile)
)
<< QString();
} }
void ProjectExplorerPlugin::testGccOutputParsers() void ProjectExplorerPlugin::testGccOutputParsers()

View File

@@ -120,7 +120,8 @@ void LdParser::stdError(const QString &line)
description.startsWith(QLatin1String("At top level")) || description.startsWith(QLatin1String("At top level")) ||
description.startsWith(QLatin1String("instantiated from ")) || description.startsWith(QLatin1String("instantiated from ")) ||
description.startsWith(QLatin1String("In ")) || description.startsWith(QLatin1String("In ")) ||
description.startsWith(QLatin1String("first defined here"))) { description.startsWith(QLatin1String("first defined here")) ||
description.startsWith(QLatin1String("note:"), Qt::CaseInsensitive)) {
type = Task::Unknown; type = Task::Unknown;
} else if (description.startsWith(QLatin1String("warning: "), Qt::CaseInsensitive)) { } else if (description.startsWith(QLatin1String("warning: "), Qt::CaseInsensitive)) {
type = Task::Warning; type = Task::Warning;

View File

@@ -215,6 +215,17 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
Utils::FileName::fromUserInput(QLatin1String("main.cpp")), 41, Utils::FileName::fromUserInput(QLatin1String("main.cpp")), 41,
Constants::TASK_CATEGORY_COMPILE)) Constants::TASK_CATEGORY_COMPILE))
<< QString(); << QString();
QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("Note: No relevant classes found. No output generated."),
Utils::FileName::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0,
Constants::TASK_CATEGORY_COMPILE)
)
<< QString();
} }
void ProjectExplorerPlugin::testLinuxIccOutputParsers() void ProjectExplorerPlugin::testLinuxIccOutputParsers()

View File

@@ -504,6 +504,12 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
Utils::FileName::fromUserInput(QLatin1String("D:\\Project\\types.h")), 71, Utils::FileName::fromUserInput(QLatin1String("D:\\Project\\types.h")), 71,
Constants::TASK_CATEGORY_COMPILE)) Constants::TASK_CATEGORY_COMPILE))
<< QString(); << QString();
QTest::newRow("ignore moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.\n")
<< (QList<ProjectExplorer::Task>())
<< QString();
} }
void ProjectExplorerPlugin::testMsvcOutputParsers() void ProjectExplorerPlugin::testMsvcOutputParsers()

View File

@@ -44,14 +44,21 @@ void QMakeParser::stdError(const QString &line)
if (m_error.indexIn(lne) > -1) { if (m_error.indexIn(lne) > -1) {
QString fileName = m_error.cap(1); QString fileName = m_error.cap(1);
Task::TaskType type = Task::Error; Task::TaskType type = Task::Error;
const QString description = m_error.cap(3);
if (fileName.startsWith(QLatin1String("WARNING: "))) { if (fileName.startsWith(QLatin1String("WARNING: "))) {
type = Task::Warning; type = Task::Warning;
fileName = fileName.mid(9); fileName = fileName.mid(9);
} else if (fileName.startsWith(QLatin1String("ERROR: "))) { } else if (fileName.startsWith(QLatin1String("ERROR: "))) {
fileName = fileName.mid(7); fileName = fileName.mid(7);
} }
if (description.startsWith(QLatin1String("note:"), Qt::CaseInsensitive))
type = Task::Unknown;
else if (description.startsWith(QLatin1String("warning:"), Qt::CaseInsensitive))
type = Task::Warning;
else if (description.startsWith(QLatin1String("error:"), Qt::CaseInsensitive))
type = Task::Error;
Task task = Task(type, Task task = Task(type,
m_error.cap(3) /* description */, description,
Utils::FileName::fromUserInput(fileName), Utils::FileName::fromUserInput(fileName),
m_error.cap(2).toInt() /* line */, m_error.cap(2).toInt() /* line */,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
@@ -173,7 +180,17 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers_data()
Utils::FileName::fromUserInput(QLatin1String("e:\\QtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl")), 1, Utils::FileName::fromUserInput(QLatin1String("e:\\QtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl")), 1,
categoryBuildSystem)) categoryBuildSystem))
<< QString(); << QString();
} QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("Note: No relevant classes found. No output generated."),
Utils::FileName::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0,
categoryBuildSystem)
)
<< QString();}
void QmakeProjectManagerPlugin::testQmakeOutputParsers() void QmakeProjectManagerPlugin::testQmakeOutputParsers()
{ {