Skip to content
Snippets Groups Projects
Commit 1057261a authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Improve handling of "(included ) from" lines

 * Reuse filename pattern
 * Make it work with "from foo:X," lines reported by GCCE
 * Add unit tests
parent 55ccbba0
No related branches found
No related tags found
No related merge requests found
...@@ -36,16 +36,17 @@ using namespace ProjectExplorer; ...@@ -36,16 +36,17 @@ using namespace ProjectExplorer;
namespace { namespace {
// opt. drive letter + filename: (2 brackets) // opt. drive letter + filename: (2 brackets)
const char * const FILE_PATTERN = "^(([A-Za-z]:)?[^:]+\\.[^:]+):"; const char * const FILE_PATTERN = "(([A-Za-z]:)?[^:]+\\.[^:]+):";
const char * const COMMAND_PATTERN = "^(.*[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(gcc|g\\+\\+)(-[0-9\\.]+)?(\\.exe)?: "; const char * const COMMAND_PATTERN = "^(.*[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(gcc|g\\+\\+)(-[0-9\\.]+)?(\\.exe)?: ";
} }
GccParser::GccParser() GccParser::GccParser()
{ {
m_regExp.setPattern(QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+):(\\d+:)?\\s((fatal |#)?(warning|error|note):?\\s)(.+)$")); setObjectName(QLatin1String("GCCParser"));
m_regExp.setPattern(QString(QChar('^')) + 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(QString::fromLatin1("^.*from\\s") + QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+)[,:]?$"));
m_regExpIncluded.setMinimal(true); m_regExpIncluded.setMinimal(true);
// optional path with trailing slash // optional path with trailing slash
...@@ -118,7 +119,7 @@ void GccParser::stdError(const QString &line) ...@@ -118,7 +119,7 @@ void GccParser::stdError(const QString &line)
emit addTask(Task(Task::Unknown, emit addTask(Task(Task::Unknown,
lne /* description */, lne /* description */,
m_regExpIncluded.cap(1) /* filename */, m_regExpIncluded.cap(1) /* filename */,
m_regExpIncluded.cap(2).toInt() /* linenumber */, m_regExpIncluded.cap(3).toInt() /* linenumber */,
Constants::TASK_CATEGORY_COMPILE)); Constants::TASK_CATEGORY_COMPILE));
return; return;
} }
...@@ -547,6 +548,32 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() ...@@ -547,6 +548,32 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
Constants::TASK_CATEGORY_COMPILE)) Constants::TASK_CATEGORY_COMPILE))
<< QString(); << QString();
QTest::newRow("GCCE from lines")
<< QString::fromLatin1("In file included from C:/Symbian_SDK/epoc32/include/e32cmn.h:6792,\n"
" from C:/Symbian_SDK/epoc32/include/e32std.h:25,\n"
"C:/Symbian_SDK/epoc32/include/e32cmn.inl: In member function 'SSecureId::operator const TSecureId&() const':\n"
"C:/Symbian_SDK/epoc32/include/e32cmn.inl:7094: warning: returning reference to temporary")
<< OutputParserTester::STDERR
<< QString() << QString()
<< ( QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("In file included from C:/Symbian_SDK/epoc32/include/e32cmn.h:6792,"),
QLatin1String("C:/Symbian_SDK/epoc32/include/e32cmn.h"), 6792,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
QLatin1String("from C:/Symbian_SDK/epoc32/include/e32std.h:25,"),
QLatin1String("C:/Symbian_SDK/epoc32/include/e32std.h"), 25,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
QLatin1String("In member function 'SSecureId::operator const TSecureId&() const':"),
QLatin1String("C:/Symbian_SDK/epoc32/include/e32cmn.inl"), -1,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Warning,
QLatin1String("returning reference to temporary"),
QLatin1String("C:/Symbian_SDK/epoc32/include/e32cmn.inl"), 7094,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
} }
void ProjectExplorerPlugin::testGccOutputParsers() void ProjectExplorerPlugin::testGccOutputParsers()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment