From 387f75c39bfad4439a6bd013089c2cd216cda5ea Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 8 Apr 2014 10:41:55 -0700 Subject: Disable C++11 initializer lists and rvalue refs for old libstdc++ This can happen if you're using a recent compiler other than GCC (that is, Clang or Intel) and using an older version of the GCC headers. The check is not strictly correct: we're disabling for libstdc++ that came with GCC 4.2 and enabling for everything afterwards, even though both of those features were not present in GCC 4.3. However, the __GLIBC_LIBSTD__ macro only exists on Apple's patched version of libstdc++ and they're not going to update it anyway. libstdc++ does not provide a version macro that we can use. Task-number: QTBUG-38193 Change-Id: I34d38a2f2e5b4ac51bce35c30ec0fcf19de9cdf4 Reviewed-by: Marc Mutz Reviewed-by: Fawzi Mohamed --- src/corelib/global/qcompilerdetection.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e93201f102..dd880d8ede 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -842,8 +842,8 @@ #endif /* Q_CC_MSVC */ #ifdef __cplusplus +# include # if defined(Q_OS_QNX) -# include # if defined(_YVALS) || defined(_LIBCPP_VER) // QNX: libcpp (Dinkumware-based) doesn't have the // header, so the feature is useless, even if the compiler supports @@ -854,8 +854,16 @@ # undef Q_COMPILER_RVALUE_REFS # undef Q_COMPILER_REF_QUALIFIERS # endif +# endif // Q_OS_QNX +# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \ + && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) +// Mac OS X: Apple has not updated libstdc++ since 2007, which means it does not have +// or std::move. Let's disable these features +# undef Q_COMPILER_INITIALIZER_LISTS +# undef Q_COMPILER_RVALUE_REFS +# undef Q_COMPILER_REF_QUALIFIERS # endif -#endif // Q_OS_QNX +#endif /* * C++11 keywords and expressions -- cgit v1.2.3