diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-07-09 15:12:46 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-07-18 06:20:34 +0000 |
commit | 075769ca833331da2800027b5965fd9dee1ffb72 (patch) | |
tree | aab66094560e4de1a9c77112236c156eebe84334 /src/corelib/global/qtypeinfo.h | |
parent | cdd2f8eb344bded7918994d5d23151564587abcc (diff) |
Introduce Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6
... with classical semantics, meaning movable-come-Qt6,
and complex-until-then.
Whether or not we want a new flag for movable-except-
in-QList is an orthogonal question, and should not hold
back the slew of commits that introduce use of this
macro.
Change-Id: I3a6be08c314fcd7f3315af138625c38196debda5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qtypeinfo.h')
-rw-r--r-- | src/corelib/global/qtypeinfo.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 90ac8c6a0c..7fee613f89 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -201,13 +201,22 @@ Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE); where 'type' is the name of the type to specialize. NOTE: shared types must define a member-swap, and be defined in the same namespace as Qt for this to work. + + If the type was already released without Q_DECLARE_SHARED applied, + _and_ without an explicit Q_DECLARE_TYPEINFO(type, Q_MOVABLE_TYPE), + then use Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(type) to mark the + type shared (incl. swap()), without marking it movable (which + would change the memory layout of QList, a BiC change. */ -#define Q_DECLARE_SHARED(TYPE) \ -Q_DECLARE_TYPEINFO(TYPE, Q_MOVABLE_TYPE); \ +#define Q_DECLARE_SHARED_IMPL(TYPE, FLAGS) \ +Q_DECLARE_TYPEINFO(TYPE, FLAGS); \ inline void swap(TYPE &value1, TYPE &value2) \ Q_DECL_NOEXCEPT_EXPR(noexcept(value1.swap(value2))) \ { value1.swap(value2); } +#define Q_DECLARE_SHARED(TYPE) Q_DECLARE_SHARED_IMPL(TYPE, Q_MOVABLE_TYPE) +#define Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(TYPE) \ + Q_DECLARE_SHARED_IMPL(TYPE, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_COMPLEX_TYPE) /* QTypeInfo primitive specializations |