Commit f9d72df0 authored by Tobias Hunger's avatar Tobias Hunger

GCC: Fix parsing of gcc 4.6 output

 * Add unit test.
 * Tweak regexp to make the new unit test pass.

Task-number: QTCREATORBUG-5634
Change-Id: I31da8e3ac7fb1c3c5129b4fed6a228d0a73a09ea
Reviewed-on: http://codereview.qt.nokia.com/2395Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 796e1fb4
......@@ -46,7 +46,7 @@ namespace {
GccParser::GccParser()
{
setObjectName(QLatin1String("GCCParser"));
m_regExp.setPattern(QString(QChar('^')) + QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+):(\\d+:)?\\s((fatal |#)?(warning|error|note):?\\s)(.+)$"));
m_regExp.setPattern(QString(QChar('^')) + QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+):(\\d+:)?\\s+((fatal |#)?(warning|error|note):?\\s)?([^\\s].+)$"));
m_regExp.setMinimal(true);
m_regExpIncluded.setPattern(QString::fromLatin1("\\bfrom\\s") + QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+)(:\\d+)?[,:]?$"));
......@@ -636,10 +636,6 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
Constants::TASK_CATEGORY_COMPILE))
<< QString();
/*
In file included from <command-line>:0:0:
./mw.h:4:0: warning: "STUPID_DEFINE" redefined
*/
QTest::newRow("include with line:column info")
<< QString::fromLatin1("In file included from <command-line>:0:0:\n"
"./mw.h:4:0: warning: \"STUPID_DEFINE\" redefined")
......@@ -655,6 +651,26 @@ In file included from <command-line>:0:0:
QLatin1String("./mw.h"), 4,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
QTest::newRow("instanciation with line:column info")
<< QString::fromLatin1("file.h: In function 'void UnitTest::CheckEqual(UnitTest::TestResults&, const Expected&, const Actual&, const UnitTest::TestDetails&) [with Expected = unsigned int, Actual = int]':\n"
"file.cpp:87:10: instantiated from here\n"
"file.h:21:5: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]")
<< OutputParserTester::STDERR
<< QString() << QString()
<< ( QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("In function 'void UnitTest::CheckEqual(UnitTest::TestResults&, const Expected&, const Actual&, const UnitTest::TestDetails&) [with Expected = unsigned int, Actual = int]':"),
QLatin1String("file.h"), -1,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
QLatin1String("instantiated from here"),
QLatin1String("file.cpp"), 87,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Warning,
QLatin1String("comparison between signed and unsigned integer expressions [-Wsign-compare]"),
QLatin1String("file.h"), 21,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment