summaryrefslogtreecommitdiff
path: root/src/qmlcompiler/qqmljscompiler.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-12-07 10:26:55 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-12-07 16:01:02 +0100
commit1ddaedbb8e3b3bead7ef062e18a620645248b131 (patch)
tree054f48f25d5d594bf6f59c4c28b4630c4319240b /src/qmlcompiler/qqmljscompiler.cpp
parentc630ee67b7de7c3e25034a5efe6d71fcd37f0dac (diff)
downloadqtdeclarative-1ddaedbb8e3b3bead7ef062e18a620645248b131.tar.gz
QmlCompiler: Suppress bogus warning on MSVC
Fixes: QTBUG-98960 Change-Id: Ic70ff83de56fc2df4579d4efd8367a6ce402a284 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index f35351b357..bfb434aada 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -556,6 +556,14 @@ bool qSaveQmlJSUnitAsCpp(const QString &inputFileName, const QString &outputFile
if (!writeStr("};\n"))
return false;
+ // Suppress the following warning generated by MSVC 2019:
+ // "the usage of 'QJSNumberCoercion::toInteger' requires the compiler to capture 'this'
+ // but the current default capture mode does not allow it"
+ // You clearly don't have to capture 'this' in order to call 'QJSNumberCoercion::toInteger'.
+ // TODO: Remove when we don't have to support MSVC 2019 anymore. Mind the QT_WARNING_POP below.
+ if (!writeStr("QT_WARNING_PUSH\nQT_WARNING_DISABLE_MSVC(4573)\n"))
+ return false;
+
writeStr(aotFunctions[FileScopeCodeIndex].code.toUtf8().constData());
if (aotFunctions.size() <= 1) {
// FileScopeCodeIndex is always there, but it may be the only one.
@@ -595,6 +603,9 @@ bool qSaveQmlJSUnitAsCpp(const QString &inputFileName, const QString &outputFile
writeStr("};\n");
}
+ if (!writeStr("QT_WARNING_POP\n"))
+ return false;
+
if (!writeStr("}\n}\n"))
return false;