Fix wrong task type returned by gccparser

* Fix "instantiated from" with leading spaces being wrongly considered
   an error.
 * Add a unit test to cover this case
This commit is contained in:
Tobias Hunger
2010-07-15 12:36:24 +02:00
parent 615cda8430
commit 503b35340c
2 changed files with 33 additions and 1 deletions

View File

@@ -515,6 +515,38 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
QString(), -1, QString(), -1,
Constants::TASK_CATEGORY_COMPILE)) Constants::TASK_CATEGORY_COMPILE))
<< QString(); << QString();
QTest::newRow("instantiated from here should not be an error")
<< QString::fromLatin1("../stl/main.cpp: In member function typename _Vector_base<_Tp, _Alloc>::_Tp_alloc_type::const_reference Vector<_Tp, _Alloc>::at(int) [with _Tp = Point, _Alloc = Allocator<Point>]:\n"
"../stl/main.cpp:38: instantiated from here\n"
"../stl/main.cpp:31: warning: returning reference to temporary\n"
"../stl/main.cpp: At global scope:\n"
"../stl/main.cpp:31: warning: unused parameter index")
<< OutputParserTester::STDERR
<< QString() << QString()
<< ( QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("In member function typename _Vector_base<_Tp, _Alloc>::_Tp_alloc_type::const_reference Vector<_Tp, _Alloc>::at(int) [with _Tp = Point, _Alloc = Allocator<Point>]:"),
QLatin1String("../stl/main.cpp"), -1,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
QLatin1String("instantiated from here"),
QLatin1String("../stl/main.cpp"), 38,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Warning,
QLatin1String("returning reference to temporary"),
QLatin1String("../stl/main.cpp"), 31,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
QLatin1String("At global scope:"),
QLatin1String("../stl/main.cpp"), -1,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Warning,
QLatin1String("unused parameter index"),
QLatin1String("../stl/main.cpp"), 31,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
} }
void ProjectExplorerPlugin::testGccOutputParsers() void ProjectExplorerPlugin::testGccOutputParsers()

View File

@@ -89,7 +89,7 @@ void LdParser::stdError(const QString &line)
int lineno = m_regExpLinker.cap(4).toInt(&ok); int lineno = m_regExpLinker.cap(4).toInt(&ok);
if (!ok) if (!ok)
lineno = -1; lineno = -1;
QString description = m_regExpLinker.cap(5); QString description = m_regExpLinker.cap(5).trimmed();
Task task(Task::Error, Task task(Task::Error,
description, description,
m_regExpLinker.cap(1) /* filename */, m_regExpLinker.cap(1) /* filename */,