BareMetal: Handle missed stdout error generated by IAR linker

Change-Id: I767363697dc56d9314ff6c34605a907807975864
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Denis Shienkov
2019-10-25 12:20:38 +03:00
parent 83c6a4d922
commit 0a7b9db9b4
2 changed files with 33 additions and 1 deletions

View File

@@ -179,6 +179,22 @@ bool IarParser::parseErrorInCommandLineMessage(const QString &lne)
return true; return true;
} }
bool IarParser::parseErrorMessage1(const QString &lne)
{
const QRegularExpression re("^(Error)\\[(.+)\\]:\\s(.+)$");
const QRegularExpressionMatch match = re.match(lne);
if (!match.hasMatch())
return false;
enum CaptureIndex { MessageTypeIndex = 1, MessageCodeIndex, DescriptionIndex };
const Task::TaskType type = taskType(match.captured(MessageTypeIndex));
const QString descr = QString("[%1]: %2").arg(match.captured(MessageCodeIndex),
match.captured(DescriptionIndex));
// This task has not a file path and line number (as it is a linker message)
const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
return true;
}
void IarParser::stdError(const QString &line) void IarParser::stdError(const QString &line)
{ {
IOutputParser::stdError(line); IOutputParser::stdError(line);
@@ -225,7 +241,10 @@ void IarParser::stdOutput(const QString &line)
const QString lne = rightTrimmed(line); const QString lne = rightTrimmed(line);
if (!parseErrorInCommandLineMessage(lne)) // The call sequence has the meaning!
const bool leastOneParsed = parseErrorInCommandLineMessage(lne)
|| parseErrorMessage1(lne);
if (!leastOneParsed)
return; return;
doFlush(); doFlush();
@@ -297,6 +316,18 @@ void BareMetalPlugin::testIarOutputParsers_data()
categoryCompile)) categoryCompile))
<< QString(); << QString();
QTest::newRow("Linker error")
<< QString::fromLatin1("Error[e46]: Some error")
<< OutputParserTester::STDOUT
<< QString::fromLatin1("Error[e46]: Some error\n")
<< QString()
<< (Tasks() << Task(Task::Error,
QLatin1String("[e46]: Some error"),
Utils::FilePath(),
-1,
categoryCompile))
<< QString();
// For std error. // For std error.
QTest::newRow("No details warning") QTest::newRow("No details warning")
<< QString::fromLatin1("\"c:\\foo\\main.c\",63 Warning[Pe223]:\n" << QString::fromLatin1("\"c:\\foo\\main.c\",63 Warning[Pe223]:\n"

View File

@@ -50,6 +50,7 @@ private:
bool parseErrorOrFatalErrorDetailsMessage2(const QString &lne); bool parseErrorOrFatalErrorDetailsMessage2(const QString &lne);
bool parseWarningOrErrorOrFatalErrorDetailsMessage1(const QString &lne); bool parseWarningOrErrorOrFatalErrorDetailsMessage1(const QString &lne);
bool parseErrorInCommandLineMessage(const QString &lne); bool parseErrorInCommandLineMessage(const QString &lne);
bool parseErrorMessage1(const QString &lne);
void stdError(const QString &line) final; void stdError(const QString &line) final;
void stdOutput(const QString &line) final; void stdOutput(const QString &line) final;