From d7a8b34d4a66a00d5722469625352936d839c94a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 31 Jul 2024 09:02:44 +0200 Subject: [PATCH] QTest::toString(): Fix format specifier for q(u)int64 on Windows Qt 5 had qint64 as __int64 on Windows, so using I64 was correct, then, but MinGW was already using long long, so using I64 for all Q_OS_WIN builds was wrong even then. So exclude Q_CC_GNU from the I64 formatting. In Qt 6, all platforms always use long long, so no Windows-specific handling is needed anymore. Found by adding __attribute__((format(printf))) to qsnprintf(). Pick-to: 6.7 6.5 6.2 5.15 Change-Id: Icfa0afc6f0fe06e5d47684702097ac1d3da6cef1 Reviewed-by: Thiago Macieira Reviewed-by: Volker Hilsheimer (cherry picked from commit ab74c1779ec2499758449d41999356a91bb82cf8) Reviewed-by: Qt Cherry-pick Bot --- src/testlib/qtestcase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 1ffe283ce92..97fa996ed52 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -3005,7 +3005,7 @@ TO_STRING_IMPL(int, %d) TO_STRING_IMPL(uint, %u) TO_STRING_IMPL(long, %ld) TO_STRING_IMPL(ulong, %lu) -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_CC_GNU) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) TO_STRING_IMPL(qint64, %I64d) TO_STRING_IMPL(quint64, %I64u) #else