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 <marc.mutz@kdab.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Thiago Macieira 2014-04-08 10:41:55 -07:00 committed by The Qt Project
parent 070e1637eb
commit 387f75c39b

View File

@ -842,8 +842,8 @@
#endif /* Q_CC_MSVC */
#ifdef __cplusplus
# include <utility>
# if defined(Q_OS_QNX)
# include <utility>
# if defined(_YVALS) || defined(_LIBCPP_VER)
// QNX: libcpp (Dinkumware-based) doesn't have the <initializer_list>
// 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
// <initializer_list> 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