From c250c59f7ccb9536969d62cb847475cabb2c1398 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 6 Aug 2024 09:20:27 +0200 Subject: [PATCH] Fix QT_SUPPORTS_INT128 checks The macro is defined or not, not defined to 1 or 0. Amends 1d7950c9467ba4db75ac065bd54ffe08e4a29710 (qhashfunctions.h), 0d85d0a72fd0136bd89e201d0cc1bf7fac2c24c8 (tst_qfloat16.cpp), 104a0a9ecdb18d65e4d9075d87e8860c6c9d8335 (tst_qglobal.cpp), 7a829eaf51853e0852db28b8b8223e1a62a3db0c (tst_qtendian.cpp). Pick-to: 6.7 Change-Id: I190e208f3c96f27100dae3eef512739afa8fadd9 Reviewed-by: Alexey Edelev (cherry picked from commit c78994a887f56f1bc77a5fa0db3b98196851db5e) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qhashfunctions.h | 2 +- tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp | 4 ++-- tests/auto/corelib/global/qglobal/qglobal.c | 2 +- tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 2 +- tests/auto/corelib/global/qtendian/tst_qtendian.cpp | 2 +- .../auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index f34c26d4985..273a211a990 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -139,7 +139,7 @@ Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(qint64 key, size_t seed = 0) } return qHash(quint64(key), seed); } -#if QT_SUPPORTS_INT128 +#ifdef QT_SUPPORTS_INT128 constexpr size_t qHash(quint128 key, size_t seed = 0) noexcept { return qHash(quint64(key + (key >> 64)), seed); diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp index 5f1ff673169..07507ae6ae4 100644 --- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp +++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp @@ -214,7 +214,7 @@ void tst_qfloat16::ordering() CHECK_INT(qint16); CHECK_INT(qint32); CHECK_INT(qint64); -#if QT_SUPPORTS_INT128 +#ifdef QT_SUPPORTS_INT128 CHECK_INT(qint128); #endif if (right >= 0) { @@ -224,7 +224,7 @@ void tst_qfloat16::ordering() CHECK_INT(quint16); CHECK_INT(quint32); CHECK_INT(quint64); - #if QT_SUPPORTS_INT128 + #ifdef QT_SUPPORTS_INT128 CHECK_INT(quint128); #endif } diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c index 2cfbd5e3be0..c133ad97fc3 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.c +++ b/tests/auto/corelib/global/qglobal/qglobal.c @@ -59,7 +59,7 @@ void tst_GlobalTypes() #endif /* QT_SUPPORTS_INT128 */ } -#if QT_SUPPORTS_INT128 +#ifdef QT_SUPPORTS_INT128 qint128 tst_qint128_min() { return Q_INT128_MIN + 0; } qint128 tst_qint128_max() { return 0 + Q_INT128_MAX; } quint128 tst_quint128_max() { return Q_UINT128_MAX - 1 + 1; } diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 7dd027160ed..954eab6a43a 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -103,7 +103,7 @@ extern "C" { // functions in qglobal.c void tst_GlobalTypes(); int tst_QtVersion(); const char *tst_qVersion(); -#if QT_SUPPORTS_INT128 +#ifdef QT_SUPPORTS_INT128 qint128 tst_qint128_min(); qint128 tst_qint128_max(); quint128 tst_quint128_max(); diff --git a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp index 8e50b2bd088..6574c80ddf6 100644 --- a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp +++ b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp @@ -7,7 +7,7 @@ #include #include -#if QT_SUPPORTS_INT128 +#ifdef QT_SUPPORTS_INT128 #define ONLY_INT128(...) __VA_ARGS__ #else #define ONLY_INT128(...) diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index beb3eb36c49..34ccd56e1d7 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -169,7 +169,7 @@ static void unsignedIntegerConsistency(quint64 value, size_t seed) if (v32 == value) QCOMPARE(hu64, hu32); -#if QT_SUPPORTS_INT128 +#ifdef QT_SUPPORTS_INT128 const auto hu128 = qHash(quint128(value), seed); QCOMPARE(hu128, hu64); #endif @@ -216,7 +216,7 @@ void tst_QHashFunctions::signedIntegerConsistency() QCOMPARE(hs64, hs32); } -#if QT_SUPPORTS_INT128 +#ifdef QT_SUPPORTS_INT128 const auto hs128 = qHash(qint128(value), seed); QCOMPARE(hs128, hs64); #endif