Qt Creator 2.4.0 Intel Compiler Error Parsing under Windows
-
Hello folks,
I´m developing under Windows with the newest Intel Compiler (Ver. 12.1.2.278) and using the Qt Creator 2.4.0.
Once you have set up your compiler to work with Qt Creator you will soon find the the error parsing does not work properly (at least for me). Sadly I found no option in the Qt Creator that allows me to set parsing parameters for my compiler. So I downloaded the Qt Creator source and found the parserfiles in the projectexplorer project. As my Creator uses the msvc Toolchain it uses the msvcparser.cpp to parse the errors. With some little changes it will parse the intel compiler errors and warnings. But this is a quick and dirty fix not tested well. At the moment it will not work with the Microsoft compiler nor will it parse the linker Errors. But this can be easily achieved by modifying the QRegExps. After changing you youst have to build the projectexplorer.dll and replace it with the old one. Hopes this helps anyone.Code: msvcparser.cpp located at ..\qt-creator-2.4.0-src\src\plugins\projectexplorer
@static const char FILE_POS_PATTERN[] = "(cl|icl|LINK|.+): ";
static const char ERROR_PATTERN[] = ":";static QPair<QString, int> parseFileName(const QString &input)
{
QString fileName = input;
if (fileName.startsWith(QLatin1String("LINK"))
|| fileName.startsWith(QLatin1String("cl"))
|| fileName.startsWith(QLatin1String("icl")))
return qMakePair(QString(), -1);// Extract linenumber (if it is there): int linenumber = -1; if (fileName.endsWith(QLatin1Char(')'))) { int pos = fileName.lastIndexOf(QLatin1Char('(')); if (pos >= 0) { bool ok = false; int n = fileName.mid(pos + 1, fileName.count() - pos - 2).toInt(&ok); if (ok) { fileName = fileName.left(pos); linenumber = n; } } } return qMakePair(fileName, linenumber);
}
using namespace ProjectExplorer;
MsvcParser::MsvcParser()
{
setObjectName(QLatin1String("MsvcParser"));
m_compileRegExp.setPattern(QString::fromLatin1("^") + QLatin1String(FILE_POS_PATTERN)
+ QLatin1String("(Command line |fatal |catastrophic )?(warning|error)(")
+ QLatin1String(ERROR_PATTERN) + QLatin1String(".)$"));
m_compileRegExp.setMinimal(true);
m_additionalInfoRegExp.setPattern(QString::fromLatin1("^ (.)\((\d+)\) : (.*)$"));
m_additionalInfoRegExp.setMinimal(true);
}@Again. This is a dirty fix. One can do it better, but unfortunately i dont have more time to spend on this.
Maybe with this it would run with both compilers icl & cl, but not tested:
@static const char ERROR_PATTERN[] = "(:|[A-Z]\d\d\d\d ?:)";@
@ + QLatin1String("(Command line |fatal |catastrophic )?(warning|error) ?(")@If someone develops a the parser that works with both compilers (under windows) and linkers it would be nice to share it with us here.
So long
-
I would be happy to add support for intel compilers, but this is just too dirty a hack!
Note that already is (limited) support for linux ICC. Maybe that could get extended to work on windows as well. I am not familiar with the compiler, so I am not sure.
If you seriously consider to help with adding support for new compilers, please provide unit tests for the parsers. Without good unit test coverage it is really impossible to update the QRegExp!
-
I know its a dirty hack and I'm not happy with it. Like I said, I'm very busy at the moment and can not estimate when i can find time to make it clean with an extensive unit-test. Because of that I shared this hack, for people who relly want this and maybe someone will do the time-consuming work :).
-
I appreciate your posting, it is just that I wanted to point out what needs to be done to get this into our codebase.
I don't want people telling me "there is a patch on devnet for ages, so why is that not in Qt Creator x.y.z" :-)