From 38e90ad2b3cff1220c9214290b4c4fed9dd39bd5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 12 Nov 2013 11:17:05 +0100 Subject: qcompilerdetection.h: add Q_COMPILER_UNIFORM_INIT Up to now, the feature classe Uniform Initialization was subsumed by the Q_COMPILER_INITIALIZER_LISTS flag together with support for std::initializer_list. This caused at least two problems: 1. On QNX, the standard libray does not ship , even though the compiler (a GCC 4.6, IIRC) supports it. But since there was only one Q_COMPILER flag for both, support for the compiler-only part of the feature had to be disabled, too. 2. MSVC 2013 supports initializer lists, but has a bug that renders full uniform initialization support, as required for QUuid, useless. By splitting the feature into two, we can separate them better, and do so in QUuid, which is the only class that currently takes advantage of uniform initialization (to provide constexpr constructors). Since Q_COMPILER_INITIALIZER_LISTS worked as a flag for uniform initialization so far, with the two known exceptions above, UNIFORM_INIT is defined whenever INITIALIZER_LIST is, except that I don't revert UNIFORM_INIT on QNX as I do for INITIALIZER_LISTS and that I expect the MSVC 2013 features to set INITIALIZER_LIST, but not UNIFORM_INIT. Task-number: QTBUG-34705 Change-Id: I81916e950a0f3aab3de7977e0326d2de3d31b14c Reviewed-by: Yuchen Deng Reviewed-by: Thiago Macieira --- src/corelib/plugin/quuid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/plugin/quuid.h') diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 31b9890351..a0d2923bed 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -82,7 +82,7 @@ public: Sha1 = 5 // 0 1 0 1 }; -#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC) +#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC) Q_DECL_CONSTEXPR QUuid() : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {} Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, @@ -147,7 +147,7 @@ public: #if defined(Q_OS_WIN) // On Windows we have a type GUID that is used by the platform API, so we // provide convenience operators to cast from and to this type. -#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC) +#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC) Q_DECL_CONSTEXPR QUuid(const GUID &guid) : data1(guid.Data1), data2(guid.Data2), data3(guid.Data3), data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], -- cgit v1.2.3