diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-07-17 22:19:38 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-07-20 15:54:21 +0000 |
commit | baff532de01c2e7df9b43bd21cb463fd9056b446 (patch) | |
tree | 2bdc5f38baf6bcb52849134a0ab4d47594be3376 /src/corelib/arch | |
parent | 28f5207ca08bed5c16474091a205bc8351574584 (diff) |
Fix Q_BASIC_ATOMIC_INITIALIZER for std::atomic
We can't have too many braces: one pair is just enough because we're
actually calling the QBasicAtomicInt's constructor. That is, we're using
the uniform initialization procedure.
Required for Clang 3.7:
qmetatype.h:1772:46: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init]
static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
qatomic_cxx11.h:331:43: note: expanded from macro 'Q_BASIC_ATOMIC_INITIALIZER'
#define Q_BASIC_ATOMIC_INITIALIZER(a) { {a} }
^~~
Change-Id: Ib306f8f647014b399b87ffff13f1f2db1fabe393
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/arch')
-rw-r--r-- | src/corelib/arch/qatomic_cxx11.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h index 09e900f4ea..0e06ca951a 100644 --- a/src/corelib/arch/qatomic_cxx11.h +++ b/src/corelib/arch/qatomic_cxx11.h @@ -328,10 +328,10 @@ template <typename X> struct QAtomicOps } }; -#ifdef ATOMIC_VAR_INIT -# define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) } +#if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) +# define Q_BASIC_ATOMIC_INITIALIZER(a) { a } #else -# define Q_BASIC_ATOMIC_INITIALIZER(a) { {a} } +# define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) } #endif QT_END_NAMESPACE |