aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2025-04-10 15:43:17 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2025-04-14 10:23:23 +0000
commit78c2187b2f558ba73a0fc083c474ff338cba65e7 (patch)
tree7283982760150977078bcfbbe31dfeaabcd995f1
parent9bb0da7b5184210d993c0068fc60e335e9f59a83 (diff)
tst_qmlformat: fix an uninitialized variable usage
GCC rightfully complains that /home/qt/work/qt/qtdeclarative/tests/auto/qml/qmlformat/tst_qmlformat.cpp:263:21: warning: ‘writtenOut’ may be used uninitialized in this function [-Wmaybe-uninitialized] 263 | *didSucceed = writtenOut; | ~~~~~~~~~~~~^~~~~~~~~~~~ because if we don't enter the if, we never initialize writtenOut. Initialize it. Change-Id: I6d3bb8038e524773a11b3333bf65654593f01da9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 7f16c2a305b2adffa2ecea30ea8bc71078903bfc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 8b360441674bd35f90d681f601d99618959c9773)
-rw-r--r--tests/auto/qml/qmlformat/tst_qmlformat.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
index 34de31fd22..562014cf29 100644
--- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp
+++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
@@ -783,7 +783,7 @@ QString TestQmlformat::formatInMemory(const QString &fileToFormat, bool *didSucc
env->loadPendingDependencies();
MutableDomItem myFile = tFile.field(Fields::currentItem);
- bool writtenOut;
+ bool writtenOut = false;
QString resultStr;
if (myFile.field(Fields::isValid).value().toBool()) {
WriteOutChecks checks = extraChecks;