From 90beb456f7c4a58e88b38bf4b2c41864215f70e1 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Wed, 12 Jul 2023 11:38:30 +0200 Subject: [PATCH] Revert "QUuid: use NSDMI to initialize the members" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c3c5d2cab07ffed1ddfb7978870c05917d89fa39. Reason for the revert - it breaks the purpose of the Qt::Uninitialized ctor The commit also updates the QUuid(quint128, QSysInfo::Endian) ctor to avoid the compiler errors: error: member ‘QUuid::data*’ must be initialized by mem-initializer in ‘constexpr’ constructor Change-Id: I0057fab3d7203adaddad3e890129668923a9eef6 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira (cherry picked from commit f1ffc11e613ebe3132d94937eb60d59c2095e7ce) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/plugin/quuid.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 31420626651..0cead3a8b7d 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -70,7 +70,7 @@ public: } }; - constexpr QUuid() noexcept {} + constexpr QUuid() noexcept : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {} constexpr QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept @@ -183,10 +183,10 @@ public: NSUUID *toNSUUID() const Q_DECL_NS_RETURNS_AUTORELEASED; #endif - uint data1 = 0; - ushort data2 = 0; - ushort data3 = 0; - uchar data4[8] = {}; + uint data1; + ushort data2; + ushort data3; + uchar data4[8]; private: static constexpr Id128Bytes bswap(Id128Bytes b) @@ -244,6 +244,7 @@ inline QUuid QUuid::fromBytes(const void *bytes, QSysInfo::Endian order) noexcep #ifdef __SIZEOF_INT128__ constexpr inline QUuid::QUuid(quint128 uuid, QSysInfo::Endian order) noexcept + : QUuid() { if (order == QSysInfo::LittleEndian) uuid = qbswap(uuid);