diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-06-18 15:41:26 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-06-27 00:29:13 +0200 |
commit | ea6352109b6b73e72b578534fe6d1c90767a22a3 (patch) | |
tree | 35eb0c75f5eb43b02ed23b1b2e0645135dfce067 /src/corelib/global/qcompilerdetection.h | |
parent | a58ec950f06c8de366b4b693491eaaafae116041 (diff) |
Add Q_COMPILER_THREADSAFE_STATICS (a.k.a. "Magic Statics")
It had been so far only supported by GNU-style compilers due to the
IA-64 portable C++ ABI. But it's mandated by C++11, so let's add the
macro and use it in Q_GLOBAL_STATIC.
Looks like Visual Studio "14" will support it.
Change-Id: I9710b5146606c7e494c43413f49900419396cfe0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 3cd757c14f..7498c778a8 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -472,6 +472,7 @@ * N1720 Q_COMPILER_STATIC_ASSERT __cpp_static_assert = 200410 * N2258 Q_COMPILER_TEMPLATE_ALIAS * N2659 Q_COMPILER_THREAD_LOCAL + * N2660 Q_COMPILER_THREADSAFE_STATICS * N2765 Q_COMPILER_UDL __cpp_user_defined_literals = 200809 * N2442 Q_COMPILER_UNICODE_STRINGS __cpp_unicode_literals = 200710 * N2640 Q_COMPILER_UNIFORM_INIT @@ -490,6 +491,7 @@ #ifdef Q_CC_INTEL # define Q_COMPILER_RESTRICTED_VLA # define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too +# define Q_COMPILER_THREADSAFE_STATICS # if __INTEL_COMPILER < 1200 # define Q_NO_TEMPLATE_FRIENDS # endif @@ -551,6 +553,7 @@ #if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) /* General C++ features */ # define Q_COMPILER_RESTRICTED_VLA +# define Q_COMPILER_THREADSAFE_STATICS # if !__has_feature(cxx_exceptions) # ifndef QT_NO_EXCEPTIONS # define QT_NO_EXCEPTIONS @@ -705,6 +708,7 @@ #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) # define Q_COMPILER_RESTRICTED_VLA +# define Q_COMPILER_THREADSAFE_STATICS # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 // GCC supports binary literals in C, C++98 and C++11 modes # define Q_COMPILER_BINARY_LITERALS @@ -872,6 +876,13 @@ # undef Q_COMPILER_RVALUE_REFS # undef Q_COMPILER_REF_QUALIFIERS # endif +# if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC) +// Mac OS X: Apple's low-level implementation of the C++ support library +// (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The +// C++11 standard requires the deadlocks to be removed, so this will eventually +// be fixed; for now, let's disable this. +# undef Q_COMPILER_THREADSAFE_STATICS +# endif #endif /* |