From 94742faeceb44fd2d8131b12480e59b699b0ac6f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 12 Apr 2014 10:01:50 -0700 Subject: Remove the #ifdef check just before #undef No warning is printed anyway. This code is only for one compiler (GCC on QNX, a.k.a. QCC). Change-Id: I28d085c72ab5a957146efab0a36c72f213d9d2c3 Reviewed-by: Marc Mutz --- src/corelib/global/qcompilerdetection.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 950647004a..1f82425459 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -848,12 +848,8 @@ // QNX: libcpp (Dinkumware-based) doesn't have the // header, so the feature is useless, even if the compiler supports // it. Disable. -# ifdef Q_COMPILER_INITIALIZER_LISTS -# undef Q_COMPILER_INITIALIZER_LISTS -# endif -# ifdef Q_COMPILER_RVALUE_REFS -# undef Q_COMPILER_RVALUE_REFS -# endif +# undef Q_COMPILER_INITIALIZER_LISTS +# undef Q_COMPILER_RVALUE_REFS # endif # endif #endif // Q_OS_QNX -- cgit v1.2.3 From 070e1637ebe3ee899d44b92c948e2e148c237e03 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 11 Apr 2014 13:26:48 -0700 Subject: Disable all C++11 rvalue refs with Dinkumware C++ library too Our code assumes that Q_COMPILER_REF_QUALIFIERS implies Q_COMPILER_RVALUE_REFS. Technically, it should check both macros, but the only point of ref qualifiers is to have both lvalue- and rvalue- reference member functions. We might then use std::move without a check to see if the standard library does provide it. Change-Id: Ia3eedd298c2218f100aee2e41bdea6e2c5c07a15 Reviewed-by: Marc Mutz Reviewed-by: Fawzi Mohamed Reviewed-by: Rafael Roquetto --- src/corelib/global/qcompilerdetection.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 1f82425459..e93201f102 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -849,7 +849,10 @@ // header, so the feature is useless, even if the compiler supports // it. Disable. # undef Q_COMPILER_INITIALIZER_LISTS +// That libcpp doesn't have std::move either, so disable everything +// related to rvalue refs. # undef Q_COMPILER_RVALUE_REFS +# undef Q_COMPILER_REF_QUALIFIERS # endif # endif #endif // Q_OS_QNX -- cgit v1.2.3 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(-) (limited to 'src/corelib/global') 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