Commit 8f39e05e authored by Friedemann Kleint's avatar Friedemann Kleint

Adapt MSVC output parser to MSVC 2015.

The space character after the line number was removed from
the compiler messages.

Change-Id: Ia249a6d4416744c67aada2eb2c5c26cf87bd7ef7
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent 66f60362
......@@ -34,7 +34,8 @@
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
static const char FILE_POS_PATTERN[] = "(cl|LINK|.+) : ";
// As of MSVC 2015: "foo.cpp(42) :" -> "foo.cpp(42):"
static const char FILE_POS_PATTERN[] = "(cl|LINK|.+[^ ]) ?: ";
static const char ERROR_PATTERN[] = "[A-Z]+\\d\\d\\d\\d ?:";
static QPair<Utils::FileName, int> parseFileName(const QString &input)
......@@ -225,6 +226,16 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
Constants::TASK_CATEGORY_COMPILE))
<< QString();
QTest::newRow("labeled error-2015")
<< QString::fromLatin1("qmlstandalone\\main.cpp(54): error C4716: 'findUnresolvedModule' : must return a value") << OutputParserTester::STDOUT
<< QString() << QString()
<< (QList<Task>()
<< Task(Task::Error,
QLatin1String("C4716: 'findUnresolvedModule' : must return a value"),
Utils::FileName::fromUserInput(QLatin1String("qmlstandalone\\main.cpp")), 54,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
QTest::newRow("labeled warning")
<< QString::fromLatin1("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp(69) : warning C4100: 'something' : unreferenced formal parameter") << OutputParserTester::STDOUT
<< QString() << QString()
......
......@@ -37,6 +37,13 @@
namespace ProjectExplorer {
static inline QByteArray msgFileComparisonFail(const Utils::FileName &f1, const Utils::FileName &f2)
{
const QString result = QLatin1Char('"') + f1.toUserOutput()
+ QLatin1String("\" != \"") + f2.toUserOutput() + QLatin1Char('"');
return result.toLocal8Bit();
}
OutputParserTester::OutputParserTester() :
m_debug(false)
{ }
......@@ -83,7 +90,8 @@ void OutputParserTester::testParsing(const QString &lines,
for (int i = 0; i < tasks.size(); ++i) {
QCOMPARE(m_receivedTasks.at(i).category, tasks.at(i).category);
QCOMPARE(m_receivedTasks.at(i).description, tasks.at(i).description);
QCOMPARE(m_receivedTasks.at(i).file, tasks.at(i).file);
QVERIFY2(m_receivedTasks.at(i).file == tasks.at(i).file,
msgFileComparisonFail(m_receivedTasks.at(i).file, tasks.at(i).file));
QCOMPARE(m_receivedTasks.at(i).line, tasks.at(i).line);
QCOMPARE(static_cast<int>(m_receivedTasks.at(i).type), static_cast<int>(tasks.at(i).type));
}
......@@ -103,7 +111,8 @@ void OutputParserTester::testTaskMangling(const Task &input,
if (m_receivedTasks.size() == 1) {
QCOMPARE(m_receivedTasks.at(0).category, output.category);
QCOMPARE(m_receivedTasks.at(0).description, output.description);
QCOMPARE(m_receivedTasks.at(0).file, output.file);
QVERIFY2(m_receivedTasks.at(0).file == output.file,
msgFileComparisonFail(m_receivedTasks.at(0).file, output.file));
QCOMPARE(m_receivedTasks.at(0).line, output.line);
QCOMPARE(m_receivedTasks.at(0).type, output.type);
}
......
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