From e32853b75d5ea2dfcb4023eec1ccdb921c2ef905 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Feb 2024 11:31:14 -0800 Subject: [PATCH] qHash: provide the long double overload on Darwin systems Commit c0791ac76ec7cfdc3945efa67a6f72ee3623413c didn't explain why it was #ifdef'ed out. It's just an alias for double. Maybe compilers at the time used to complain if you used it, but I can't make Apple's clang produce a warning now. Change-Id: I664b9f014ffc48cbb49bfffd17b02293403e9571 Reviewed-by: Qt CI Bot Reviewed-by: Giuseppe D'Angelo (cherry picked from commit c5f22c54cbff8c31ab9e5111e74faae4e188e99b) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qhash.cpp | 2 -- src/corelib/tools/qhashfunctions.h | 2 -- tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 33f8f2fc7fb..67137135dce 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -1438,7 +1438,6 @@ size_t qHash(double key, size_t seed) noexcept } } -#if !defined(Q_OS_DARWIN) || defined(Q_QDOC) /*! \relates QHash \since 5.3 @@ -1456,7 +1455,6 @@ size_t qHash(long double key, size_t seed) noexcept return murmurhash(&key, sizeof(key), seed); } } -#endif /*! \fn size_t qHash(const QChar key, size_t seed = 0) \relates QHash diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index fbf4fb501ce..3d44c6ac2f9 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -112,9 +112,7 @@ Q_DECL_CONST_FUNCTION inline size_t qHash(float key, size_t seed = 0) noexcept return QHashPrivate::hash(k, seed); } Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(double key, size_t seed = 0) noexcept; -#if !defined(Q_OS_DARWIN) || defined(Q_QDOC) Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(long double key, size_t seed = 0) noexcept; -#endif Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(wchar_t key, size_t seed = 0) noexcept { return QHashPrivate::hash(size_t(key), seed); } Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char16_t key, size_t seed = 0) noexcept diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index 6e3f4a793f0..8b7126fa364 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -256,9 +256,7 @@ void tst_QHashFunctions::qhash_of_zero_floating_points() { QCOMPARE(qHash(-0.0f, seed), qHash(0.0f, seed)); QCOMPARE(qHash(-0.0 , seed), qHash(0.0 , seed)); -#ifndef Q_OS_DARWIN QCOMPARE(qHash(-0.0L, seed), qHash(0.0L, seed)); -#endif } void tst_QHashFunctions::qthash_data()