diff options
author | Eike Ziller <eike.ziller@qt.io> | 2023-04-28 11:29:08 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2023-05-02 09:05:16 +0000 |
commit | 66c0c36bc1cb2417295f5b5c7d7e556f5329f309 (patch) | |
tree | 0fa8f792b2250f05c74fe810f483d6ea03846398 | |
parent | 3e953f4896849d375e81f37ad3ed718746e7527c (diff) |
Fix compiler warnings
Change-Id: I9b0b4a60d1152142f62bf3f76885cf8019714623
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sivert Krøvel <sivert.krovel@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
15 files changed, 29 insertions, 26 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp index 41551e96da5..4754da22c61 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/syntaxhighlighter.cpp @@ -179,7 +179,7 @@ void SyntaxHighlighter::applyFolding(int offset, int length, FoldingRegion regio { Q_UNUSED(offset); Q_UNUSED(length); - Q_D(SyntaxHighlighter); + [[maybe_unused]] Q_D(SyntaxHighlighter); if (region.type() == FoldingRegion::Begin) { d->foldingRegions.push_back(region); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index bbf321cd70b..da5cf42e041 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -764,7 +764,7 @@ void CMakeBuildStep::updateDeploymentData() const auto appFileNames = transform<QSet<QString>>(buildSystem()->applicationTargets(), [](const BuildTargetInfo &appTarget) { return appTarget.targetFilePath.fileName(); }); - auto handleFile = [this, &appFileNames, startPos, &deploymentData](const FilePath &filePath) { + auto handleFile = [&appFileNames, startPos, &deploymentData](const FilePath &filePath) { const DeployableFile::Type type = appFileNames.contains(filePath.fileName()) ? DeployableFile::TypeExecutable : DeployableFile::TypeNormal; diff --git a/src/plugins/cpaster/stickynotespasteprotocol.h b/src/plugins/cpaster/stickynotespasteprotocol.h index e17508e084f..f212c883ef2 100644 --- a/src/plugins/cpaster/stickynotespasteprotocol.h +++ b/src/plugins/cpaster/stickynotespasteprotocol.h @@ -38,7 +38,6 @@ private: QNetworkReply *m_listReply = nullptr; QString m_fetchId; - int m_postId = -1; bool m_hostChecked = false; }; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 66f03aa974f..6ac72e8946d 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -60,7 +60,7 @@ const char GIT_DIRECTORY[] = ".git"; const char HEAD[] = "HEAD"; const char CHERRY_PICK_HEAD[] = "CHERRY_PICK_HEAD"; -const char BRANCHES_PREFIX[] = "Branches: "; +[[maybe_unused]] const char BRANCHES_PREFIX[] = "Branches: "; const char stashNamePrefix[] = "stash@{"; const char noColorOption[] = "--no-color"; const char colorOption[] = "--color=always"; @@ -92,7 +92,7 @@ static QString branchesDisplay(const QString &prefix, QStringList *branches, boo if (*first) *first = false; else - output += QString(sizeof(BRANCHES_PREFIX) - 1, ' '); // Align + output += QString(sizeof(BRANCHES_PREFIX) - 1 /* the \0 */, ' '); // Align output += prefix + ": "; // If there are more than 'limit' branches, list limit/2 (first limit/4 and last limit/4) if (count > limit) { diff --git a/src/plugins/mcusupport/test/unittest.cpp b/src/plugins/mcusupport/test/unittest.cpp index b9fc108ef76..a8a8f091399 100644 --- a/src/plugins/mcusupport/test/unittest.cpp +++ b/src/plugins/mcusupport/test/unittest.cpp @@ -152,11 +152,7 @@ const QString renesasProgrammerEnvVar{"RenesasFlashProgrammer_PATH"}; const char renesasProgrammerLabel[]{"Renesas Flash Programmer"}; const QString renesasProgrammerDetectionPath{HostOsInfo::withExecutableSuffix("rfp-cli")}; -const char renesasE2StudioCmakeVar[]{"EK_RA6M3G_E2_PROJECT_PATH"}; -const char renesasE2StudioDefaultPath[]{"%{Env:HOME}/e2_studio/workspace"}; const QString renesasE2StudioPath{(FileUtils::homePath() / "/e2_studio/workspace").toUserOutput()}; -const char renesasE2StudioLabel[]{"Path to project for Renesas e2 Studio"}; -const char renesasE2StudioSetting[]{"RenesasE2StudioPath"}; const char cypressProgrammerSetting[]{"CypressAutoFlashUtil"}; const char cypressProgrammerCmakeVar[]{"INFINEON_AUTO_FLASH_UTILITY_DIR"}; @@ -1760,9 +1756,9 @@ void McuSupportTest::test_nonemptyVersionDetector() // pkgDesc.versionDetection.xmlAttribute left empty pkgDesc.shouldAddToSystemPath = false; const auto package = targetFactory.createPackage(pkgDesc); - QVERIFY(package->getVersionDetector() != nullptr); - QCOMPARE(typeid(*package->getVersionDetector()).name(), - typeid(McuPackageExecutableVersionDetector).name()); + const McuPackageVersionDetector *detector = package->getVersionDetector(); + QVERIFY(detector != nullptr); + QCOMPARE(typeid(*detector).name(), typeid(McuPackageExecutableVersionDetector).name()); } void McuSupportTest::test_emptyVersionDetector() diff --git a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h index c4e0c55a9e3..1eea5063c99 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h @@ -29,6 +29,7 @@ public: QmlObjectNode(const ModelNode &modelNode) : QmlModelNodeFacade(modelNode) {} + virtual ~QmlObjectNode() = default; static bool isValidQmlObjectNode(const ModelNode &modelNode); bool isValid() const override; diff --git a/src/plugins/qmldesigner/designercore/projectstorage/qmltypesparser.h b/src/plugins/qmldesigner/designercore/projectstorage/qmltypesparser.h index 902d3c5a44f..09513bb74e3 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/qmltypesparser.h +++ b/src/plugins/qmldesigner/designercore/projectstorage/qmltypesparser.h @@ -42,7 +42,7 @@ public: private: // m_pathCache and m_storage are only used when compiled for QDS #ifdef QDS_HAS_QMLDOM - PathCache &m_pathCache; + [[maybe_unused]] PathCache &m_pathCache; ProjectStorage &m_storage; #endif }; diff --git a/src/plugins/qmldesigner/utils/multifiledownloader.cpp b/src/plugins/qmldesigner/utils/multifiledownloader.cpp index 346c1675f6e..c36476f05d6 100644 --- a/src/plugins/qmldesigner/utils/multifiledownloader.cpp +++ b/src/plugins/qmldesigner/utils/multifiledownloader.cpp @@ -41,6 +41,11 @@ void MultiFileDownloader::setDownloader(FileDownloader *downloader) }); } +FileDownloader *MultiFileDownloader::downloader() +{ + return m_downloader; +} + void MultiFileDownloader::start() { emit downloadStarting(); diff --git a/src/plugins/qmldesigner/utils/multifiledownloader.h b/src/plugins/qmldesigner/utils/multifiledownloader.h index 548896dbc8d..794f85538cb 100644 --- a/src/plugins/qmldesigner/utils/multifiledownloader.h +++ b/src/plugins/qmldesigner/utils/multifiledownloader.h @@ -13,7 +13,7 @@ class MultiFileDownloader : public QObject { Q_OBJECT - Q_PROPERTY(FileDownloader *downloader WRITE setDownloader) + Q_PROPERTY(FileDownloader *downloader READ downloader WRITE setDownloader) Q_PROPERTY(bool finished READ finished NOTIFY finishedChanged) Q_PROPERTY(int progress READ progress NOTIFY progressChanged) Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged) @@ -34,6 +34,7 @@ public: void setTargetDirPath(const QString &path); QString targetDirPath() const; void setDownloader(FileDownloader *downloader); + FileDownloader *downloader(); bool finished() const; int progress() const; diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index 3aa935db74e..6b886389e6f 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -88,11 +88,14 @@ QmlPreviewRunner::QmlPreviewRunner(RunControl *runControl, const QmlPreviewRunne if (!runControl->isRunning()) return; - this->connect(runControl, &RunControl::stopped, [this, runControl] { - auto rc = new RunControl(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); - rc->copyDataFromRunControl(runControl); - ProjectExplorerPlugin::startRunControl(rc); - }); + this->connect(runControl, + &RunControl::stopped, + ProjectExplorerPlugin::instance(), + [runControl] { + auto rc = new RunControl(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); + rc->copyDataFromRunControl(runControl); + ProjectExplorerPlugin::startRunControl(rc); + }); runControl->initiateStop(); }); @@ -124,7 +127,7 @@ QUrl QmlPreviewRunner::serverUrl() const QmlPreviewRunWorkerFactory::QmlPreviewRunWorkerFactory(QmlPreviewPlugin *plugin, const QmlPreviewRunnerSetting *runnerSettings) { - setProducer([this, plugin, runnerSettings](RunControl *runControl) { + setProducer([plugin, runnerSettings](RunControl *runControl) { auto runner = new QmlPreviewRunner(runControl, *runnerSettings); QObject::connect(plugin, &QmlPreviewPlugin::updatePreviews, runner, &QmlPreviewRunner::loadFile); diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp index cc13e51273d..1be0624490f 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp @@ -40,7 +40,7 @@ public: connect(target, &Target::kitChanged, [aspect] { aspect->setRemoteEnvironment({}); }); - connect(fetchButton, &QPushButton::clicked, this, [this, aspect, target] { + connect(fetchButton, &QPushButton::clicked, this, [aspect, target] { if (IDevice::ConstPtr device = DeviceKitAspect::device(target->kit())) { DeviceFileAccess *access = device->fileAccess(); QTC_ASSERT(access, return); diff --git a/src/plugins/squish/squishnavigationwidget.cpp b/src/plugins/squish/squishnavigationwidget.cpp index ce965013987..829b2312cc7 100644 --- a/src/plugins/squish/squishnavigationwidget.cpp +++ b/src/plugins/squish/squishnavigationwidget.cpp @@ -185,7 +185,7 @@ void SquishNavigationWidget::contextMenuEvent(QContextMenuEvent *event) QAction *closeAllSuites = new QAction(Tr::tr("Close All Test Suites"), &menu); menu.addAction(closeAllSuites); - connect(closeAllSuites, &QAction::triggered, this, [this] { + connect(closeAllSuites, &QAction::triggered, this, [] { if (SquishMessages::simpleQuestion(Tr::tr("Close All Test Suites"), Tr::tr("Close all test suites?" /*"\nThis will close all related files as well."*/)) diff --git a/tests/auto/qml/qmldesigner/wizard/userpresets-test.cpp b/tests/auto/qml/qmldesigner/wizard/userpresets-test.cpp index 7dffbef4160..0605791315a 100644 --- a/tests/auto/qml/qmldesigner/wizard/userpresets-test.cpp +++ b/tests/auto/qml/qmldesigner/wizard/userpresets-test.cpp @@ -44,8 +44,6 @@ void PrintTo(const std::vector<UserPresetData> &presets, std::ostream *os) using namespace StudioWelcome; -constexpr char ARRAY_NAME[] = "UserPresets"; - class FakeStoreIo : public StoreIo { public: diff --git a/tests/unit/unittest/sqlitedatabasemock.h b/tests/unit/unittest/sqlitedatabasemock.h index 62a1d6585b7..658a0ec88b4 100644 --- a/tests/unit/unittest/sqlitedatabasemock.h +++ b/tests/unit/unittest/sqlitedatabasemock.h @@ -28,7 +28,7 @@ public: MOCK_METHOD(void, prepare, (Utils::SmallStringView sqlStatement), ()); - MOCK_METHOD(void, execute, (Utils::SmallStringView sqlStatement), ()); + MOCK_METHOD(void, execute, (Utils::SmallStringView sqlStatement), (override)); MOCK_METHOD(int64_t, lastInsertedRowId, (), (const)); diff --git a/tests/unit/unittest/sqlitereadwritestatementmock.h b/tests/unit/unittest/sqlitereadwritestatementmock.h index 3dab28d9946..aaf59530741 100644 --- a/tests/unit/unittest/sqlitereadwritestatementmock.h +++ b/tests/unit/unittest/sqlitereadwritestatementmock.h @@ -43,7 +43,7 @@ public: ()); template<typename ResultType, typename... QueryTypes> - auto optionalValue(const QueryTypes &...queryValues) + auto optionalValue([[maybe_unused]] const QueryTypes &...queryValues) { static_assert(!std::is_same_v<ResultType, ResultType>, "SqliteReadStatementMock::value does not handle result type!"); |