diff options
author | James McDonnell <jmcdonnell@qnx.com> | 2016-02-11 10:10:21 -0500 |
---|---|---|
committer | James McDonnell <jmcdonnell@qnx.com> | 2016-02-20 00:12:58 +0000 |
commit | d87242968fc56ba09243f642ce70a85084619de0 (patch) | |
tree | 8c749bab365c9cf8e6a1d4027b4404c2f8c8a859 | |
parent | 1da975cdc5297ddde584981c4bf301b288ccaca9 (diff) |
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 <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 22 |
1 files 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 |