forked from qt-creator/qt-creator
Parse "fatal error"s correctly
* Gcc 4.5 reports fatal errors. Parse them correctly.
This commit is contained in:
@@ -42,13 +42,12 @@ namespace {
|
|||||||
|
|
||||||
GccParser::GccParser()
|
GccParser::GccParser()
|
||||||
{
|
{
|
||||||
m_regExp.setPattern(QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+):(\\d+:)?\\s(#?(warning|error|note):?\\s)(.+)$"));
|
m_regExp.setPattern(QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+):(\\d+:)?\\s((fatal |#)?(warning|error|note):?\\s)(.+)$"));
|
||||||
m_regExp.setMinimal(true);
|
m_regExp.setMinimal(true);
|
||||||
|
|
||||||
m_regExpIncluded.setPattern("^.*from\\s([^:]+):(\\d+)(,|:)$");
|
m_regExpIncluded.setPattern("^.*from\\s([^:]+):(\\d+)(,|:)$");
|
||||||
m_regExpIncluded.setMinimal(true);
|
m_regExpIncluded.setMinimal(true);
|
||||||
|
|
||||||
// treat ld (and gold) as part of gcc for simplicity
|
|
||||||
// optional path with trailing slash
|
// optional path with trailing slash
|
||||||
// optional arm-linux-none-thingy
|
// optional arm-linux-none-thingy
|
||||||
// name of executable
|
// name of executable
|
||||||
@@ -99,12 +98,12 @@ void GccParser::stdError(const QString &line)
|
|||||||
QString filename = m_regExp.cap(1);
|
QString filename = m_regExp.cap(1);
|
||||||
int lineno = m_regExp.cap(3).toInt();
|
int lineno = m_regExp.cap(3).toInt();
|
||||||
Task task(Task::Unknown,
|
Task task(Task::Unknown,
|
||||||
m_regExp.cap(7) /* description */,
|
m_regExp.cap(8) /* description */,
|
||||||
filename, lineno,
|
filename, lineno,
|
||||||
Constants::TASK_CATEGORY_COMPILE);
|
Constants::TASK_CATEGORY_COMPILE);
|
||||||
if (m_regExp.cap(6) == QLatin1String("warning"))
|
if (m_regExp.cap(7) == QLatin1String("warning"))
|
||||||
task.type = Task::Warning;
|
task.type = Task::Warning;
|
||||||
else if (m_regExp.cap(6) == QLatin1String("error") ||
|
else if (m_regExp.cap(7) == QLatin1String("error") ||
|
||||||
task.description.startsWith(QLatin1String("undefined reference to")))
|
task.description.startsWith(QLatin1String("undefined reference to")))
|
||||||
task.type = Task::Error;
|
task.type = Task::Error;
|
||||||
|
|
||||||
@@ -479,6 +478,17 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
|
|||||||
QLatin1String("../../scriptbug/main.cpp"), 5,
|
QLatin1String("../../scriptbug/main.cpp"), 5,
|
||||||
Constants::TASK_CATEGORY_COMPILE))
|
Constants::TASK_CATEGORY_COMPILE))
|
||||||
<< QString();
|
<< QString();
|
||||||
|
|
||||||
|
QTest::newRow("gcc 4.5 fatal error")
|
||||||
|
<< QString::fromLatin1("/home/code/test.cpp:54:38: fatal error: test.moc: No such file or directory")
|
||||||
|
<< OutputParserTester::STDERR
|
||||||
|
<< QString() << QString()
|
||||||
|
<< ( QList<ProjectExplorer::Task>()
|
||||||
|
<< Task(Task::Error,
|
||||||
|
QLatin1String("test.moc: No such file or directory"),
|
||||||
|
QLatin1String("/home/code/test.cpp"), 54,
|
||||||
|
Constants::TASK_CATEGORY_COMPILE))
|
||||||
|
<< QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::testGccOutputParsers()
|
void ProjectExplorerPlugin::testGccOutputParsers()
|
||||||
|
|||||||
Reference in New Issue
Block a user