diff --git a/kdevplatform/outputview/outputfilteringstrategies.cpp b/kdevplatform/outputview/outputfilteringstrategies.cpp --- a/kdevplatform/outputview/outputfilteringstrategies.cpp +++ b/kdevplatform/outputview/outputfilteringstrategies.cpp @@ -259,30 +259,30 @@ ErrorFormat( QStringLiteral("^([a-zA-Z]:\\\\.+)\\(([1-9][0-9]*)\\): ((?:error|warning) .+\\:).*$"), 1, 2, 3 ), #endif // GCC - another case, eg. for #include "pixmap.xpm" which does not exists - ErrorFormat( QStringLiteral("^([^:\\t]+):([0-9]+):([0-9]+):([^0-9]+)"), 1, 2, 4, 3 ), + ErrorFormat( QStringLiteral("^(.:?[^:\\t]+):([0-9]+):([0-9]+):([^0-9]+)"), 1, 2, 4, 3 ), // ant ErrorFormat( QStringLiteral("\\[javac\\][\\s]+([^:\\t]+):([0-9]+): (warning: .*|error: .*)"), 1, 2, 3, QStringLiteral("javac")), // GCC - ErrorFormat( QStringLiteral("^([^:\\t]+):([0-9]+):([^0-9]+)"), 1, 2, 3 ), + ErrorFormat( QStringLiteral("^(.:?[^:\\t]+):([0-9]+):([^0-9]+)"), 1, 2, 3 ), // GCC - ErrorFormat( QStringLiteral("^(In file included from |[ ]+from )([^:\\t]+):([0-9]+)(:|,)(|[0-9]+)"), 2, 3, 5 ), + ErrorFormat( QStringLiteral("^(In file included from |[ ]+from )(..[^:\\t]+):([0-9]+)(:|,)(|[0-9]+)"), 2, 3, 5 ), // ICC - ErrorFormat( QStringLiteral("^([^:\\t]+)\\(([0-9]+)\\):([^0-9]+)"), 1, 2, 3, QStringLiteral("intel") ), + ErrorFormat( QStringLiteral("^(.:?[^:\\t]+)\\(([0-9]+)\\):([^0-9]+)"), 1, 2, 3, QStringLiteral("intel") ), //libtool link ErrorFormat( QStringLiteral("^(libtool):( link):( warning): "), 0, 0, 0 ), // make ErrorFormat( QStringLiteral("No rule to make target"), 0, 0, 0 ), // cmake - multiline expression - ErrorFormat( QStringLiteral("(^\\/[\\w|\\/| |\\.]+):([0-9]+):"), 1, 2, 0, QStringLiteral("cmake") ), + ErrorFormat( QStringLiteral("((^\\/|^[a-zA-Z]:)[\\w|\\/| |\\.]+):([0-9]+):"), 1, 2, 0, QStringLiteral("cmake") ), // cmake ErrorFormat( QStringLiteral("CMake (Error|Warning) (|\\([a-zA-Z]+\\) )(in|at) ([^:]+):($|[0-9]+)"), 4, 5, 1, QStringLiteral("cmake") ), // cmake/automoc // example: AUTOMOC: error: /foo/bar.cpp The file includes (...), // example: AUTOMOC: error: /foo/bar.cpp: The file includes (...) // note: ':' after file name isn't always appended, see http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=317d8498aa02c9f486bf5071963bb2034777cdd6 // example: AUTOGEN: error: /foo/bar.cpp: The file includes (...) // note: AUTOMOC got renamed to AUTOGEN at some point - ErrorFormat( QStringLiteral("^(AUTOMOC|AUTOGEN): error: ([^:]+):? (The file .*)$"), 2, 0, 0 ), + ErrorFormat( QStringLiteral("^(AUTOMOC|AUTOGEN): error: (.*?) (The file .*)$"), 2, 0, 0 ), // via qt4_automoc // example: automoc4: The file "/foo/bar.cpp" includes the moc file "bar1.moc", but ... ErrorFormat( QStringLiteral("^automoc4: The file \"([^\"]+)\" includes the moc file"), 1, 0, 0 ), diff --git a/kdevplatform/outputview/tests/test_filteringstrategy.cpp b/kdevplatform/outputview/tests/test_filteringstrategy.cpp --- a/kdevplatform/outputview/tests/test_filteringstrategy.cpp +++ b/kdevplatform/outputview/tests/test_filteringstrategy.cpp @@ -74,24 +74,29 @@ QTest::addColumn("line"); QTest::addColumn("expected"); - QTest::newRow("cppcheck-info-line") - << buildCppCheckInformationLine() << FilteredItem::InvalidItem; - for (TestPathType pathType : {UnixFilePathNoSpaces, UnixFilePathWithSpaces}) { + for (TestPathType pathType : +#ifdef Q_OS_WIN + {WindowsFilePathNoSpaces, WindowsFilePathWithSpaces} + +#else + {UnixFilePathNoSpaces, UnixFilePathWithSpaces} +#endif + ) { QTest::newRowForPathType("cppcheck-error-line", pathType) << buildCppCheckErrorLine(pathType) << FilteredItem::InvalidItem; QTest::newRowForPathType("compiler-line", pathType) << buildCompilerLine(pathType) << FilteredItem::InvalidItem; QTest::newRowForPathType("compiler-error-line", pathType) << buildCompilerErrorLine(pathType) << FilteredItem::InvalidItem; - } - QTest::newRow("compiler-action-line") - << buildCompilerActionLine() << FilteredItem::InvalidItem; - for (TestPathType pathType : {UnixFilePathNoSpaces, UnixFilePathWithSpaces}) { QTest::newRowForPathType("compiler-information-line", pathType) << buildCompilerInformationLine(pathType) << FilteredItem::InvalidItem; QTest::newRowForPathType("python-error-line", pathType) << buildPythonErrorLine(pathType) << FilteredItem::InvalidItem; } + QTest::newRow("cppcheck-info-line") + << buildCppCheckInformationLine() << FilteredItem::InvalidItem; + QTest::newRow("compiler-action-line") + << buildCompilerActionLine() << FilteredItem::InvalidItem; } void TestFilteringStrategy::testNoFilterStrategy() @@ -114,7 +119,13 @@ QTest::newRow("cppcheck-info-line") << buildCppCheckInformationLine() << FilteredItem::InvalidItem << FilteredItem::InvalidItem << UnixFilePathNoSpaces; - for (TestPathType pathType : {UnixFilePathNoSpaces, UnixFilePathWithSpaces}) { + for (TestPathType pathType : +#ifdef Q_OS_WIN + {WindowsFilePathNoSpaces, WindowsFilePathWithSpaces} +#else + {UnixFilePathNoSpaces, UnixFilePathWithSpaces} +#endif + ) { QTest::newRowForPathType("cppcheck-error-line", pathType) << buildCppCheckErrorLine(pathType) << FilteredItem::InvalidItem << FilteredItem::InvalidItem << pathType; QTest::newRowForPathType("compiler-line", pathType) @@ -127,26 +138,22 @@ << buildInfileIncludedFromFirstLine(pathType) << FilteredItem::InformationItem << FilteredItem::InvalidItem << pathType; QTest::newRowForPathType("compiler-information-line3", pathType) << buildInfileIncludedFromSecondLine(pathType) << FilteredItem::InformationItem << FilteredItem::InvalidItem << pathType; - } - QTest::newRow("cmake-error-line1") - << "CMake Error at CMakeLists.txt:2 (cmake_minimum_required):" << FilteredItem::ErrorItem << FilteredItem::InvalidItem << UnixFilePathNoSpaces; - QTest::newRow("cmake-error-multiline1") - << "CMake Error: Error in cmake code at" << FilteredItem::InvalidItem << FilteredItem::InvalidItem << UnixFilePathNoSpaces; - for (TestPathType pathType : {UnixFilePathNoSpaces, UnixFilePathWithSpaces}) { + QTest::newRow("cmake-error-line1") + << "CMake Error at CMakeLists.txt:2 (cmake_minimum_required):" << FilteredItem::ErrorItem << FilteredItem::InvalidItem << pathType; + QTest::newRow("cmake-error-multiline1") + << "CMake Error: Error in cmake code at" << FilteredItem::InvalidItem << FilteredItem::InvalidItem << pathType; QTest::newRowForPathType("cmake-error-multiline2", pathType) << buildCmakeConfigureMultiLine(pathType) << FilteredItem::ErrorItem << FilteredItem::InvalidItem << pathType; - } - QTest::newRow("cmake-warning-line") - << "CMake Warning (dev) in CMakeLists.txt:" << FilteredItem::WarningItem << FilteredItem::InvalidItem << UnixFilePathNoSpaces; - QTest::newRow("cmake-automoc-error") - << "AUTOMOC: error: /foo/bar.cpp The file includes the moc file \"moc_bar1.cpp\"" << FilteredItem::ErrorItem << FilteredItem::InvalidItem << UnixFilePathNoSpaces; - QTest::newRow("cmake-automoc4-error") - << "automoc4: The file \"/foo/bar.cpp\" includes the moc file \"bar1.moc\"" << FilteredItem::InformationItem << FilteredItem::InvalidItem << UnixFilePathNoSpaces; - QTest::newRow("cmake-autogen-error") - << "AUTOGEN: error: /foo/bar.cpp The file includes the moc file \"moc_bar1.cpp\"" << FilteredItem::ErrorItem << FilteredItem::InvalidItem << UnixFilePathNoSpaces; - QTest::newRow("linker-action-line") - << "linking testCustombuild (g++)" << FilteredItem::InvalidItem << FilteredItem::ActionItem << UnixFilePathNoSpaces; - for (TestPathType pathType : {UnixFilePathNoSpaces, UnixFilePathWithSpaces}) { + QTest::newRowForPathType("cmake-warning-line", pathType) + << "CMake Warning (dev) in CMakeLists.txt:" << FilteredItem::WarningItem << FilteredItem::InvalidItem << pathType; + QTest::newRowForPathType("cmake-automoc-error", pathType) + << buildAutoMocLine(pathType) << FilteredItem::ErrorItem << FilteredItem::InvalidItem << pathType; + QTest::newRowForPathType("cmake-automoc4-error", pathType) + << buildOldAutoMocLine(pathType) << FilteredItem::InformationItem << FilteredItem::InvalidItem << pathType; + QTest::newRowForPathType("cmake-autogen-error", pathType) + << buildAutoMocLine(pathType, false) << FilteredItem::ErrorItem << FilteredItem::InvalidItem << pathType; + QTest::newRowForPathType("linker-action-line", pathType) + << "linking testCustombuild (g++)" << FilteredItem::InvalidItem << FilteredItem::ActionItem << pathType; QTest::newRowForPathType("linker-error-line", pathType) << buildLinkerErrorLine(pathType) << FilteredItem::ErrorItem << FilteredItem::InvalidItem << pathType; QTest::newRowForPathType("python-error-line", pathType) @@ -191,10 +198,15 @@ void TestFilteringStrategy::testCompilerFilterstrategyMultipleKeywords() { +#ifdef Q_OS_WIN + TestPathType pathTypeToUse = WindowsFilePathNoSpaces; +#else + TestPathType pathTypeToUse = UnixFilePathNoSpaces; +#endif QFETCH(QString, line); QFETCH(FilteredItem::FilteredOutputItemType, expectedError); QFETCH(FilteredItem::FilteredOutputItemType, expectedAction); - QUrl projecturl = QUrl::fromLocalFile( projectPath() ); + QUrl projecturl = QUrl::fromLocalFile( projectPath(pathTypeToUse) ); CompilerFilterStrategy testee(projecturl); FilteredItem item1 = testee.errorInLine(line); QCOMPARE(item1.type, expectedError); diff --git a/kdevplatform/outputview/tests/testlinebuilderfunctions.h b/kdevplatform/outputview/tests/testlinebuilderfunctions.h --- a/kdevplatform/outputview/tests/testlinebuilderfunctions.h +++ b/kdevplatform/outputview/tests/testlinebuilderfunctions.h @@ -153,6 +153,23 @@ return outputline; } +QString buildAutoMocLine(TestPathType pathType = UnixFilePathNoSpaces, bool useAutoMoc = true) +{ + QString outputline; + useAutoMoc ? outputline.append("AUTOMOC: error: ") : outputline.append("AUTOGEN: error: "); + outputline.append(projectPath(pathType)); + outputline.append("bar.cpp The file includes the moc file \"moc_bar1.cpp\""); + return outputline; +} + +QString buildOldAutoMocLine(TestPathType pathType = UnixFilePathNoSpaces) +{ + QString outputline; + outputline.append("automoc4: The file \""); + outputline.append(projectPath(pathType)); + outputline.append("bar.cpp\" includes the moc file \"bar1.moc\""); + return outputline; +} QString buildLinkerErrorLine(TestPathType pathType = UnixFilePathNoSpaces) {