From ef21aacf1fb1c45180f9b62817c4c3e8f9a997a3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 6 May 2021 16:29:42 +0200 Subject: [PATCH] ProjectExplorer: Remove some Qt-specific parser tests Warnings from uic and moc should be caught by the QtParser, not by the LdParser, as they currently are. We move the uic test case to QtSupport, and we remove the three identical moc test cases, as the exact same output is already checked in QtSupport. Task-number: QTCREATORBUG-25677 Change-Id: Iec0203c2be60a80bd6ef0a090a9828f59ae6b482 Reviewed-by: hjk --- src/plugins/projectexplorer/clangparser.cpp | 10 ------- src/plugins/projectexplorer/gccparser.cpp | 20 ------------- .../projectexplorer/linuxiccparser.cpp | 10 ------- src/plugins/qtsupport/qtparser.cpp | 30 +++++++++++++++++++ src/plugins/qtsupport/qtparser.h | 1 + 5 files changed, 31 insertions(+), 40 deletions(-) diff --git a/src/plugins/projectexplorer/clangparser.cpp b/src/plugins/projectexplorer/clangparser.cpp index 8409d788322..029b6fc8583 100644 --- a/src/plugins/projectexplorer/clangparser.cpp +++ b/src/plugins/projectexplorer/clangparser.cpp @@ -281,16 +281,6 @@ void ProjectExplorerPlugin::testClangOutputParser_data() << CompileTask(Task::Error, "code signing is required for product type 'Application' in SDK 'iOS 7.0'")) << QString(); - - QTest::newRow("moc note") - << QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.") - << OutputParserTester::STDERR - << QString() << QString() - << (Tasks() - << CompileTask(Task::Unknown, - "Note: No relevant classes found. No output generated.", - FilePath::fromUserInput("/home/qtwebkithelpviewer.h"))) - << QString(); } void ProjectExplorerPlugin::testClangOutputParser() diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp index 33f820a34f1..6e732a0b921 100644 --- a/src/plugins/projectexplorer/gccparser.cpp +++ b/src/plugins/projectexplorer/gccparser.cpp @@ -883,16 +883,6 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() FilePath::fromUserInput("cns5k_ins_parser_tests.cpp"))) << QString(); - QTest::newRow("uic warning") - << QString::fromLatin1("mainwindow.ui: Warning: The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.") - << OutputParserTester::STDERR - << QString() << QString() - << (Tasks() - << CompileTask(Task::Warning, - "The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.", - FilePath::fromUserInput("mainwindow.ui"))) - << QString(); - QTest::newRow("libimf warning") << QString::fromLatin1("libimf.so: warning: warning: feupdateenv is not implemented and will always fail") << OutputParserTester::STDERR @@ -1169,16 +1159,6 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() "file: lib/libtest.a(Test0.cpp.o) has no symbols")) << QString(); - QTest::newRow("moc note") - << QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.") - << OutputParserTester::STDERR - << QString() << QString() - << (Tasks() - << CompileTask(Task::Unknown, - "Note: No relevant classes found. No output generated.", - FilePath::fromUserInput("/home/qtwebkithelpviewer.h"))) - << QString(); - QTest::newRow("GCC 9 output") << QString("In file included from /usr/include/qt/QtCore/qlocale.h:43,\n" " from /usr/include/qt/QtCore/qtextstream.h:46,\n" diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp index 41d46a35221..dd1b295e345 100644 --- a/src/plugins/projectexplorer/linuxiccparser.cpp +++ b/src/plugins/projectexplorer/linuxiccparser.cpp @@ -217,16 +217,6 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data() "use of \"=\" where \"==\" may have been intended\nwhile (a = true)", FilePath::fromUserInput("main.cpp"), 41)) << QString(); - - QTest::newRow("moc note") - << QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.") - << OutputParserTester::STDERR - << QString() << QString() - << (Tasks() - << CompileTask(Task::Unknown, - "Note: No relevant classes found. No output generated.", - FilePath::fromUserInput("/home/qtwebkithelpviewer.h"), -1)) - << QString(); } void ProjectExplorerPlugin::testLinuxIccOutputParsers() diff --git a/src/plugins/qtsupport/qtparser.cpp b/src/plugins/qtsupport/qtparser.cpp index 7265f45c64d..5fb0d4d73cb 100644 --- a/src/plugins/qtsupport/qtparser.cpp +++ b/src/plugins/qtsupport/qtparser.cpp @@ -45,6 +45,7 @@ namespace QtSupport { QtParser::QtParser() : m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+?)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+?)$")), + m_uicRegExp(QLatin1String(FILE_PATTERN": Warning:\\s(?.+?)$")), m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*?) in '(.*?)'$")) { setObjectName(QLatin1String("QtParser")); @@ -76,6 +77,26 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils: scheduleTask(task, 1); return {Status::Done, linkSpecs}; } + match = m_uicRegExp.match(lne); + if (match.hasMatch()) { + const QString fileName = match.captured(1); + QString message = match.captured("msg").trimmed(); + Utils::FilePath filePath; + LinkSpecs linkSpecs; + bool isUicMessage = true; + if (fileName == "uic" || fileName == "stdin") { + message.prepend(": ").prepend(fileName); + } else if (fileName.endsWith(".ui")) { + filePath = absoluteFilePath(Utils::FilePath::fromUserInput(fileName)); + addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, -1, match, 1); + } else { + isUicMessage = false; + } + if (isUicMessage) { + scheduleTask(CompileTask(Task::Warning, message, filePath), 1); + return {Status::Done, linkSpecs}; + } + } match = m_translationRegExp.match(line); if (match.hasMatch()) { Task::TaskType type = Task::Warning; @@ -172,6 +193,15 @@ void QtSupportPlugin::testQtOutputParser_data() QLatin1String("Undefined interface"), Utils::FilePath::fromUserInput(QLatin1String("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h")), 54)) << QString(); + QTest::newRow("uic warning") + << QString::fromLatin1("mainwindow.ui: Warning: The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.") + << OutputParserTester::STDERR + << QString() << QString() + << (Tasks() + << CompileTask(Task::Warning, + "The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.", + Utils::FilePath::fromUserInput("mainwindow.ui"))) + << QString(); QTest::newRow("translation") << QString::fromLatin1("Warning: dropping duplicate messages in '/some/place/qtcreator_fr.qm'") << OutputParserTester::STDERR diff --git a/src/plugins/qtsupport/qtparser.h b/src/plugins/qtsupport/qtparser.h index ad6c9d5d357..8e47b6b66ec 100644 --- a/src/plugins/qtsupport/qtparser.h +++ b/src/plugins/qtsupport/qtparser.h @@ -45,6 +45,7 @@ private: Result handleLine(const QString &line, Utils::OutputFormat type) override; QRegularExpression m_mocRegExp; + QRegularExpression m_uicRegExp; QRegularExpression m_translationRegExp; };