From 51aae3bb1ffc45e0fa39fc2a80018a83aff8d1ba Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 1 Jun 2022 16:22:45 +0200 Subject: [PATCH] GccParser: Check for "note: here" output Much like "requested from here", it usually indicates the interesting location. Change-Id: I7db2c8f0a8e5d0ebafedbaaf5cbd04f07055dfe9 Reviewed-by: Qt CI Bot Reviewed-by: hjk Reviewed-by: --- src/plugins/projectexplorer/gccparser.cpp | 37 +++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp index 4ec61aeef6b..36076e8e764 100644 --- a/src/plugins/projectexplorer/gccparser.cpp +++ b/src/plugins/projectexplorer/gccparser.cpp @@ -126,8 +126,8 @@ void GccParser::createOrAmendTask( // If a "required from here" line is present, it is almost always the cause of the problem, // so that's where we should go when the issue is double-clicked. - if ((originalLine.endsWith("required from here") || originalLine.endsWith("requested here")) - && !file.isEmpty() && line > 0) { + if ((originalLine.endsWith("required from here") || originalLine.endsWith("requested here") + || originalLine.endsWith("note: here")) && !file.isEmpty() && line > 0) { m_requiredFromHereFound = true; m_currentTask.setFile(file); m_currentTask.line = line; @@ -1398,6 +1398,39 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() FilePath::fromUserInput("tst_addresscache.cpp"), 79, 13, {})} << QString(); + QTest::newRow(R"("note: here")") + << QString( + "In file included from qmlprofilerstatisticsmodel.h:31,\n" + " from qmlprofilerstatisticsmodel.cpp:26:\n" + "qmlprofilerstatisticsmodel.cpp: In member function ‘virtual QVariant QmlProfiler::QmlProfilerStatisticsModel::data(const QModelIndex&, int) const’:\n" + "qtcassert.h:43:34: warning: this statement may fall through [-Wimplicit-fallthrough=]\n" + " 43 | #define QTC_ASSERT(cond, action) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)\n" + " | ^~\n" + "qtcassert.h:43:34: note: in definition of macro ‘QTC_ASSERT’\n" + " 43 | #define QTC_ASSERT(cond, action) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)\n" + " | ^~\n" + "qmlprofilerstatisticsmodel.cpp:365:5: note: here\n" + " 365 | default:\n" + " | ^~~~~~~") + << OutputParserTester::STDERR + << QString() << QString() + << Tasks{compileTask(Task::Warning, + "this statement may fall through [-Wimplicit-fallthrough=]\n" + "In file included from qmlprofilerstatisticsmodel.h:31,\n" + " from qmlprofilerstatisticsmodel.cpp:26:\n" + "qmlprofilerstatisticsmodel.cpp: In member function ‘virtual QVariant QmlProfiler::QmlProfilerStatisticsModel::data(const QModelIndex&, int) const’:\n" + "qtcassert.h:43:34: warning: this statement may fall through [-Wimplicit-fallthrough=]\n" + " 43 | #define QTC_ASSERT(cond, action) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)\n" + " | ^~\n" + "qtcassert.h:43:34: note: in definition of macro ‘QTC_ASSERT’\n" + " 43 | #define QTC_ASSERT(cond, action) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)\n" + " | ^~\n" + "qmlprofilerstatisticsmodel.cpp:365:5: note: here\n" + " 365 | default:\n" + " | ^~~~~~~", + FilePath::fromUserInput("qmlprofilerstatisticsmodel.cpp"), 365, 5, {})} + << QString(); + QTest::newRow("cc1plus") << QString( "cc1plus: error: one or more PCH files were found, but they were invalid\n"