From 3be9f52980c11ee89dfe3cd9c8fdcdbe01180188 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 1 Sep 2021 17:04:16 +0200 Subject: [PATCH] Fix some warnings Unused functions & variables, initialization order, signedness, non- virtual destructor. Change-Id: I405d768fe0e02a36a16c2cead9e1bc2f6a23fb75 Reviewed-by: Christian Stenger --- .../instances/qt5nodeinstanceserver.cpp | 2 ++ src/libs/utils/launcherinterface.cpp | 1 - src/libs/utils/launchersocket.cpp | 6 ----- src/libs/utils/launchersocket.h | 2 +- src/libs/utils/qtcprocess.cpp | 2 +- .../cppeditor/compileroptionsbuilder.cpp | 2 ++ .../cppeditor/compileroptionsbuilder.h | 1 + .../annotationeditor/annotationlist.cpp | 8 +++--- src/plugins/vcsbase/vcsoutputwindow.cpp | 26 ------------------- 9 files changed, 11 insertions(+), 39 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp index fe3e1edabd7..89e8c5d2db5 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp @@ -355,6 +355,7 @@ QQuickItem *Qt5NodeInstanceServer::parentEffectItem(QQuickItem *item) return nullptr; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) static bool isEffectItem(QQuickItem *item, QQuickShaderEffectSource *sourceItem) { QQuickItemPrivate *pItem = QQuickItemPrivate::get(sourceItem); @@ -375,6 +376,7 @@ static bool isLayerEnabled(QQuickItemPrivate *item) { return item && item->layer() && item->layer()->enabled(); } +#endif // QT_VERSION check QImage Qt5NodeInstanceServer::grabItem(QQuickItem *item) { diff --git a/src/libs/utils/launcherinterface.cpp b/src/libs/utils/launcherinterface.cpp index 82975ae8d15..0a6939f693b 100644 --- a/src/libs/utils/launcherinterface.cpp +++ b/src/libs/utils/launcherinterface.cpp @@ -102,7 +102,6 @@ private: Internal::LauncherSocket *const m_socket; Internal::LauncherProcess *m_process = nullptr; QString m_pathToLauncher; - int m_startRequests = 0; }; LauncherInterfacePrivate::LauncherInterfacePrivate() diff --git a/src/libs/utils/launchersocket.cpp b/src/libs/utils/launchersocket.cpp index 1a1a4a92ef1..68c3f58d690 100644 --- a/src/libs/utils/launchersocket.cpp +++ b/src/libs/utils/launchersocket.cpp @@ -484,12 +484,6 @@ void CallerHandle::setUnixTerminalDisabled() m_unixTerminalDisabled = true; } -static void warnAboutWrongSignal(QProcess::ProcessState state, CallerHandle::SignalType newSignal) -{ - qWarning() << "LauncherHandle::doWaitForSignal: Can't wait for" << newSignal << - "while being in" << state << "state."; -} - bool CallerHandle::waitForSignal(int msecs, CallerHandle::SignalType newSignal) { QTC_ASSERT(isCalledFromCallersThread(), return false); diff --git a/src/libs/utils/launchersocket.h b/src/libs/utils/launchersocket.h index 2d2f662fc10..c962a51874e 100644 --- a/src/libs/utils/launchersocket.h +++ b/src/libs/utils/launchersocket.h @@ -193,7 +193,7 @@ class LauncherHandle : public QObject Q_OBJECT public: // Called from caller's thread, moved to launcher's thread afterwards. - LauncherHandle(quintptr token, ProcessMode mode) : m_token(token) {} + LauncherHandle(quintptr token, ProcessMode) : m_token(token) {} // Called from caller's thread exclusively. bool waitForSignal(int msecs, CallerHandle::SignalType newSignal); CallerHandle *callerHandle() const { return m_callerHandle; } diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index 4898ae31bc3..35bdeaf8775 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -160,8 +160,8 @@ private: return int((nsesc + halfMillion) / million); } + const char * const m_functionName; const bool m_measureProcess; - const char *m_functionName; std::atomic_int m_hitThisAll = 0; std::atomic_int m_hitThisMain = 0; std::atomic_int64_t m_totalThisAll = 0; diff --git a/src/plugins/cppeditor/compileroptionsbuilder.cpp b/src/plugins/cppeditor/compileroptionsbuilder.cpp index 94112a1d5b7..1c130f805a8 100644 --- a/src/plugins/cppeditor/compileroptionsbuilder.cpp +++ b/src/plugins/cppeditor/compileroptionsbuilder.cpp @@ -118,6 +118,8 @@ CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart, { } +CompilerOptionsBuilder::~CompilerOptionsBuilder() = default; + QStringList CompilerOptionsBuilder::build(ProjectFile::Kind fileKind, UsePrecompiledHeaders usePrecompiledHeaders) { diff --git a/src/plugins/cppeditor/compileroptionsbuilder.h b/src/plugins/cppeditor/compileroptionsbuilder.h index 66e4282f75b..0211d58a188 100644 --- a/src/plugins/cppeditor/compileroptionsbuilder.h +++ b/src/plugins/cppeditor/compileroptionsbuilder.h @@ -52,6 +52,7 @@ public: UseBuildSystemWarnings useBuildSystemWarnings = UseBuildSystemWarnings::No, const QString &clangVersion = {}, const Utils::FilePath &clangIncludeDirectory = {}); + virtual ~CompilerOptionsBuilder(); QStringList build(ProjectFile::Kind fileKind, UsePrecompiledHeaders usePrecompiledHeaders); QStringList options() const { return m_options; } diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationlist.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationlist.cpp index 898ddae331b..1bc3d7fbd94 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationlist.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationlist.cpp @@ -81,14 +81,14 @@ void AnnotationListModel::resetModel() ModelNode AnnotationListModel::getModelNode(int id) const { - if (id >= 0 && id < m_annoList.size()) + if (id >= 0 && id < int(m_annoList.size())) return m_annoList.at(id).node; return {}; } AnnotationListEntry AnnotationListModel::getStoredAnnotation(int id) const { - if (id >= 0 && id < m_annoList.size()) + if (id >= 0 && id < int(m_annoList.size())) return m_annoList.at(id); return {}; @@ -134,7 +134,7 @@ int AnnotationListModel::columnCount(const QModelIndex &parent) const QVariant AnnotationListModel::data(const QModelIndex &index, int role) const { - if (!index.isValid() || index.row() < 0 || index.row() >= m_annoList.size()) + if (!index.isValid() || index.row() < 0 || index.row() >= int(m_annoList.size())) return {}; const auto &item = m_annoList.at(index.row()); @@ -153,7 +153,7 @@ QVariant AnnotationListModel::data(const QModelIndex &index, int role) const Qt::ItemFlags AnnotationListModel::flags(const QModelIndex &index) const { - if (!index.isValid() || index.row() < 0 || index.row() >= m_annoList.size()) + if (!index.isValid() || index.row() < 0 || index.row() >= int(m_annoList.size())) return Qt::NoItemFlags; return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } diff --git a/src/plugins/vcsbase/vcsoutputwindow.cpp b/src/plugins/vcsbase/vcsoutputwindow.cpp index b4f00bb4ed6..ebec3840dc5 100644 --- a/src/plugins/vcsbase/vcsoutputwindow.cpp +++ b/src/plugins/vcsbase/vcsoutputwindow.cpp @@ -434,32 +434,6 @@ void VcsOutputWindow::appendWarning(const QString &text) append(text, Warning, false); } -// Helper to format arguments for log windows hiding common password options. -static inline QString formatArguments(const QStringList &args) -{ - const char passwordOptionC[] = "--password"; - - QString rc; - QTextStream str(&rc); - const int size = args.size(); - // Skip authentication options - for (int i = 0; i < size; i++) { - const QString arg = filterPasswordFromUrls(args.at(i)); - if (i) - str << ' '; - if (arg.startsWith(QString::fromLatin1(passwordOptionC) + '=')) { - str << ProcessArgs::quoteArg("--password=********"); - continue; - } - str << ProcessArgs::quoteArg(arg); - if (arg == passwordOptionC) { - str << ' ' << ProcessArgs::quoteArg("********"); - i++; - } - } - return rc; -} - QString VcsOutputWindow::msgExecutionLogEntry(const FilePath &workingDir, const CommandLine &command) { if (workingDir.isEmpty())