From d87242968fc56ba09243f642ce70a85084619de0 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Thu, 11 Feb 2016 10:10:21 -0500 Subject: [PATCH] Move __cpp_constexpr check inside Q_COMPILER_CONSTEXPR check Q_COMPILER_CONSTEXPR can be undefined (or not defined at all) to indicate that constexpr should not be used regardless of the compiler's ability to support it. This is done for QNX because some C library floating point functions used in the Dinkumware C++ library aren't constexpr functions; i.e., the library doesn't have proper constexpr support even though the compiler does. Change-Id: I16918bbceac1e20b67c6ddbda28df3d9758bab83 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 7575fe06b2..4334539445 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1013,16 +1013,18 @@ # define Q_COMPILER_DEFAULT_DELETE_MEMBERS #endif -#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 -# define Q_DECL_CONSTEXPR constexpr -# define Q_DECL_RELAXED_CONSTEXPR constexpr -# define Q_CONSTEXPR constexpr -# define Q_RELAXED_CONSTEXPR constexpr -#elif defined Q_COMPILER_CONSTEXPR -# define Q_DECL_CONSTEXPR constexpr -# define Q_DECL_RELAXED_CONSTEXPR -# define Q_CONSTEXPR constexpr -# define Q_RELAXED_CONSTEXPR const +#if defined Q_COMPILER_CONSTEXPR +# if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR constexpr +# define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR constexpr +# else +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR +# define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR const +# endif #else # define Q_DECL_CONSTEXPR # define Q_DECL_RELAXED_CONSTEXPR