aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2019-09-11 08:22:53 +0300
committerOrgad Shaneh <orgads@gmail.com>2019-09-11 15:20:34 +0000
commit2aca0c1b28fc0160fb1ed54c90bc5ffc96bd6c1b (patch)
treedd555773a722fa076fc3d092d730d62a6c058159
parent75a0340a5338a2f31af96b49ef1a85a475494ac0 (diff)
Fix MSVC warnings
* Missing `this` captures * Implicit size_t -> int conversion * Unused argument * Suppress warnings in clang headers Change-Id: I7083ce6ab22ee22ecc1258539e77c790acc78df1 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/libs/clangsupport/projectpartartefact.cpp6
-rw-r--r--src/plugins/clangformat/clangformatconfigwidget.cpp5
-rw-r--r--src/plugins/clangformat/clangformatplugin.cpp1
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp2
-rw-r--r--src/plugins/languageclient/languageclientmanager.cpp2
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp6
-rw-r--r--src/plugins/qmldesigner/components/curveeditor/treeitem.cpp4
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp9
-rw-r--r--src/plugins/qmlpreview/qmlpreviewruncontrol.cpp2
-rw-r--r--src/plugins/qtsupport/qtoutputformatter.cpp2
-rw-r--r--src/shared/clang/clang_installation.pri1
11 files changed, 22 insertions, 18 deletions
diff --git a/src/libs/clangsupport/projectpartartefact.cpp b/src/libs/clangsupport/projectpartartefact.cpp
index 56551693e1..2c6b095ab2 100644
--- a/src/libs/clangsupport/projectpartartefact.cpp
+++ b/src/libs/clangsupport/projectpartartefact.cpp
@@ -90,9 +90,9 @@ QJsonDocument ProjectPartArtefact::createJsonDocument(Utils::SmallStringView jso
const char *whatError)
{
QJsonParseError error;
- QJsonDocument document = QJsonDocument::fromJson(QByteArray::fromRawData(jsonText.data(),
- jsonText.size()),
- &error);
+ QJsonDocument document = QJsonDocument::fromJson(
+ QByteArray::fromRawData(jsonText.data(), int(jsonText.size())),
+ &error);
checkError(whatError, error);
return document;
diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp
index f419780a3e..311a524315 100644
--- a/src/plugins/clangformat/clangformatconfigwidget.cpp
+++ b/src/plugins/clangformat/clangformatconfigwidget.cpp
@@ -137,9 +137,8 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *proje
tr("Override Clang Format configuration file with the fallback configuration."));
}
- connect(m_ui->overrideDefault, &QCheckBox::toggled, this, [this](bool checked) {
- showOrHideWidgets();
- });
+ connect(m_ui->overrideDefault, &QCheckBox::toggled,
+ this, &ClangFormatConfigWidget::showOrHideWidgets);
showOrHideWidgets();
fillTable();
diff --git a/src/plugins/clangformat/clangformatplugin.cpp b/src/plugins/clangformat/clangformatplugin.cpp
index 49f4fe049f..81f95ccba7 100644
--- a/src/plugins/clangformat/clangformatplugin.cpp
+++ b/src/plugins/clangformat/clangformatplugin.cpp
@@ -79,6 +79,7 @@ public:
TextEditor::CodeStyleEditorWidget *createCodeStyleEditor(
TextEditor::ICodeStylePreferences *preferences, QWidget *parent = nullptr) override
{
+ Q_UNUSED(preferences);
if (!parent)
return new ClangFormatConfigWidget;
return new ClangFormatConfigWidget(SessionManager::startupProject());
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index d874432af4..3f4599c49b 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -436,7 +436,7 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
const auto it = m_debugIdToIname.find(objectDebugId);
if (it != m_debugIdToIname.end()) {
const QString iname = *it;
- const int firstIndex = strlen("inspect");
+ const int firstIndex = int(strlen("inspect"));
const int secondIndex = iname.indexOf('.', firstIndex + 1);
if (secondIndex != -1)
engineId = iname.midRef(firstIndex + 1, secondIndex - firstIndex - 1).toInt();
diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp
index ee553bae6b..7313a5bd3f 100644
--- a/src/plugins/languageclient/languageclientmanager.cpp
+++ b/src/plugins/languageclient/languageclientmanager.cpp
@@ -495,7 +495,7 @@ void LanguageClientManager::findUsages(const Utils::FilePath &filePath, const QT
ReferenceParams params(TextDocumentPositionParams(document, pos));
params.setContext(ReferenceParams::ReferenceContext(true));
FindReferencesRequest request(params);
- auto callback = [wordUnderCursor = termCursor.selectedText()]
+ auto callback = [this, wordUnderCursor = termCursor.selectedText()]
(const QString &clientName, const FindReferencesRequest::Response &response){
if (auto result = response.result()) {
Core::SearchResult *search = Core::SearchResultWindow::instance()->startNewSearch(
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index dd24b8755d..b45d65c8b0 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -610,7 +610,8 @@ ToolChain::BuiltInHeaderPathsRunner GccToolChain::createBuiltInHeaderPathsRunner
addToEnvironment(env);
// This runner must be thread-safe!
- return [env,
+ return [this,
+ env,
compilerCommand = m_compilerCommand,
platformCodeGenFlags = m_platformCodeGenFlags,
reinterpretOptions = m_optionsReinterpreter,
@@ -1382,7 +1383,8 @@ ToolChain::BuiltInHeaderPathsRunner ClangToolChain::createBuiltInHeaderPathsRunn
addToEnvironment(env);
// This runner must be thread-safe!
- return [env,
+ return [this,
+ env,
compilerCommand = m_compilerCommand,
platformCodeGenFlags = m_platformCodeGenFlags,
reinterpretOptions = m_optionsReinterpreter,
diff --git a/src/plugins/qmldesigner/components/curveeditor/treeitem.cpp b/src/plugins/qmldesigner/components/curveeditor/treeitem.cpp
index 2413daf16c..b4bfc027d5 100644
--- a/src/plugins/qmldesigner/components/curveeditor/treeitem.cpp
+++ b/src/plugins/qmldesigner/components/curveeditor/treeitem.cpp
@@ -123,7 +123,7 @@ bool TreeItem::compare(const std::vector<QString> &path) const
int TreeItem::row() const
{
if (m_parent) {
- for (size_t i = 0; i < m_parent->m_children.size(); ++i) {
+ for (int i = 0, total = int(m_parent->m_children.size()); i < total; ++i) {
if (m_parent->m_children[i] == this)
return i;
}
@@ -139,7 +139,7 @@ int TreeItem::column() const
int TreeItem::rowCount() const
{
- return m_children.size();
+ return int(m_children.size());
}
int TreeItem::columnCount() const
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
index 5f2ccabbb5..5676cc2ca4 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
@@ -184,10 +184,11 @@ void StatesEditorModel::renameState(int internalNodeId, const QString &newName)
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
QTimer::singleShot(0, [newName]{
- auto w = Core::AsynchronousMessageBox::warning(tr("Invalid state name"),
- newName.isEmpty() ?
- tr("The empty string as a name is reserved for the base state.") :
- tr("Name already used in another state"));
+ Core::AsynchronousMessageBox::warning(
+ tr("Invalid state name"),
+ newName.isEmpty() ?
+ tr("The empty string as a name is reserved for the base state.") :
+ tr("Name already used in another state"));
});
reset();
} else {
diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp
index 0a8ac9fb1a..7f4178932d 100644
--- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp
+++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp
@@ -73,7 +73,7 @@ QmlPreviewRunner::QmlPreviewRunner(ProjectExplorer::RunControl *runControl,
});
connect(&m_connectionManager, &Internal::QmlPreviewConnectionManager::restart,
- runControl, [runControl]() {
+ runControl, [this, runControl]() {
if (!runControl->isRunning())
return;
diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp
index dc90c8fda3..4c9090c2d8 100644
--- a/src/plugins/qtsupport/qtoutputformatter.cpp
+++ b/src/plugins/qtsupport/qtoutputformatter.cpp
@@ -243,7 +243,7 @@ void QtOutputFormatter::handleLink(const QString &href)
const QString filePath = qmlLineMatch.captured(1);
QUrl fileUrl = QUrl(filePath);
if (!fileUrl.isValid() && filePath.startsWith(scheme))
- fileUrl = QUrl::fromLocalFile(filePath.mid(strlen(scheme)));
+ fileUrl = QUrl::fromLocalFile(filePath.mid(int(strlen(scheme))));
const int line = qmlLineMatch.captured(2).toInt();
openEditor(getFileToOpen(fileUrl), line);
return;
diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri
index df3ce19db2..08838838bc 100644
--- a/src/shared/clang/clang_installation.pri
+++ b/src/shared/clang/clang_installation.pri
@@ -179,6 +179,7 @@ isEmpty(LLVM_VERSION) {
# clang/Format/Format.h has intentional multiline comments
QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-comment
}
+ msvc:QMAKE_CXXFLAGS_WARN_ON += -wd4100 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291
LLVM_LIBDIR = $$quote($$system($$llvm_config --libdir, lines))
LLVM_BINDIR = $$quote($$system($$llvm_config --bindir, lines))