tst_QGlobal: fix -Wmaybe-uninitialized

GCC 14 doesn't understand that neither q_check_ptr() nor
qCompare<int*> dereference the pointer.

Since the missing initialization isn't part of the test (except,
maybe, to provoke this warning if the implementation indeed changed to
dereference the pointer), fix by initializing the int, like we do for
the string a few lines below.

Amends the start of the public history.

Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I6033e026f041b03821b776daa8e65586b8054136
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8e914e07fbac8b40e51d0e6da764fa13a6af8181)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-06-17 06:29:04 +02:00 committed by Qt Cherry-pick Bot
parent 2ec36e7ebe
commit beabc63598

View File

@ -261,7 +261,7 @@ void tst_QGlobal::qtry()
void tst_QGlobal::checkptr() void tst_QGlobal::checkptr()
{ {
int i; int i = 0;
QCOMPARE(q_check_ptr(&i), &i); QCOMPARE(q_check_ptr(&i), &i);
const char *c = "hello"; const char *c = "hello";