diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-05-14 09:22:40 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-15 04:57:05 +0200 |
commit | e1cee9222df8e078587a8539e40ce9a8ef914093 (patch) | |
tree | 5024bda26e7f820696de73c8be1992768aa4a845 /src/corelib/global/qcompilerdetection.h | |
parent | 3976339ca9b12c7eddbc69ed3a31f85ce845ba63 (diff) |
Split Q_COMPILER_DEFAULT_DELETE_MEMBERS
Based on reviewer comments on
https://codereview.qt-project.org/#change,25992, split
Q_COMPILER_DEFAULT_DELETE_MEMBERS into
Q_COMPILER_DEFAULT_MEMBERS and Q_COMPILER_DELETE_MEMBERS. Clang provides
2 separate feature checks for these, all other compilers always define
both.
Keep the Q_COMPILER_DEFAULT_DELETE_MEMBERS define, though, for any
existing code that may be using it.
Change-Id: I8969e10989c776a822da153152cfecb99dda8cb9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index c55da5c144..b4ea022227 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -451,7 +451,8 @@ * N2437 Q_COMPILER_CLASS_ENUM * N2235 Q_COMPILER_CONSTEXPR * N2343 N3276 Q_COMPILER_DECLTYPE - * N2346 Q_COMPILER_DEFAULT_DELETE_MEMBERS + * N2346 Q_COMPILER_DEFAULT_MEMBERS + * N2346 Q_COMPILER_DELETE_MEMBERS * N1986 Q_COMPILER_DELEGATING_CONSTRUCTORS * N3206 N3272 Q_COMPILER_EXPLICIT_OVERRIDES (v0.9 and above only) * N1987 Q_COMPILER_EXTERN_TEMPLATES @@ -484,7 +485,8 @@ # define Q_COMPILER_AUTO_TYPE # define Q_COMPILER_CLASS_ENUM # define Q_COMPILER_DECLTYPE -# define Q_COMPILER_DEFAULT_DELETE_MEMBERS +# define Q_COMPILER_DEFAULT_MEMBERS +# define Q_COMPILER_DELETE_MEMBERS # define Q_COMPILER_EXTERN_TEMPLATES # define Q_COMPILER_LAMBDA # define Q_COMPILER_RVALUE_REFS @@ -540,8 +542,11 @@ # if __has_feature(cxx_decltype) /* && __has_feature(cxx_decltype_incomplete_return_types) */ # define Q_COMPILER_DECLTYPE # endif -# if __has_feature(cxx_defaulted_functions) && __has_feature(cxx_deleted_functions) /* defaulted members in 3.0, deleted members in 2.9 */ -# define Q_COMPILER_DEFAULT_DELETE_MEMBERS +# if __has_feature(cxx_defaulted_functions) +# define Q_COMPILER_DEFAULT_MEMBERS +# endif +# if __has_feature(cxx_deleted_functions) +# define Q_COMPILER_DELETE_MEMBERS # endif # if __has_feature(cxx_delegating_constructors) # define Q_COMPILER_DELEGATING_CONSTRUCTORS @@ -620,7 +625,8 @@ # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_AUTO_TYPE # define Q_COMPILER_CLASS_ENUM -# define Q_COMPILER_DEFAULT_DELETE_MEMBERS +# define Q_COMPILER_DEFAULT_MEMBERS +# define Q_COMPILER_DELETE_MEMBERS # define Q_COMPILER_EXTERN_TEMPLATES # define Q_COMPILER_INITIALIZER_LISTS # define Q_COMPILER_UNICODE_STRINGS @@ -668,12 +674,23 @@ # define Q_NULLPTR 0 #endif -#ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS +#ifdef Q_COMPILER_DEFAULT_MEMBERS +# define Q_DECL_EQ_DEFAULT = default +#else +# define Q_DECL_EQ_DEFAULT +#endif + +#ifdef Q_COMPILER_DELETE_MEMBERS # define Q_DECL_EQ_DELETE = delete #else # define Q_DECL_EQ_DELETE #endif +// Don't break code that is already using Q_COMPILER_DEFAULT_DELETE_MEMBERS +#if defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) +# define Q_COMPILER_DEFAULT_DELETE_MEMBERS +#endif + #ifdef Q_COMPILER_CONSTEXPR # define Q_DECL_CONSTEXPR constexpr #else |