From 4b60cea6020c99dabb3b2777e30f0a3924dcd8a7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 21 May 2021 16:41:34 +0200 Subject: [PATCH] Farewell Q_DISABLE_MOVE In hindsight, this macro is an API mistake, as it should NEVER be used alone, but always in combination with Q_DISABLE_COPY. But in that case, there's a better macro: Q_DISABLE_COPY_MOVE; hence this API is either bad, or completely redundant. A GitHub search reveals that luckily there's a handful of usages in the wild (of which 0 in Qt/dev and KDE). Hence, I'm going for the kill, and removing it entirely. [ChangeLog][Source-Incompatible Changes][QtGlobal] The Q_DISABLE_MOVE macro has been removed. Code that was using it can be ported to Q_DISABLE_COPY_MOVE instead. Change-Id: I7e346f7e2288f3f5a45315f4f6bfaeb2661f1de5 Reviewed-by: Edward Welbourne Reviewed-by: Andrei Golubev Reviewed-by: Lars Knoll --- src/corelib/global/qglobal.cpp | 17 +++-------------- src/corelib/global/qglobal.h | 7 ++----- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b320faa72f..56246783ed 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -651,18 +651,7 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined"); application would probably crash when you called a member function of \c{w}. - \sa Q_DISABLE_COPY_MOVE, Q_DISABLE_MOVE -*/ - -/*! - \macro Q_DISABLE_MOVE(Class) - \relates QObject - - Disables the use of move constructors and move assignment operators - for the given \a Class. - - \sa Q_DISABLE_COPY, Q_DISABLE_COPY_MOVE - \since 5.13 + \sa Q_DISABLE_COPY_MOVE */ /*! @@ -671,9 +660,9 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined"); A convenience macro that disables the use of copy constructors, assignment operators, move constructors and move assignment operators for the given - \a Class, combining Q_DISABLE_COPY and Q_DISABLE_MOVE. + \a Class. - \sa Q_DISABLE_COPY, Q_DISABLE_MOVE + \sa Q_DISABLE_COPY \since 5.13 */ diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 16bcb14e7d..8bf0e8c6bc 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -491,13 +491,10 @@ constexpr inline Deprecated_t Deprecated = {}; Class(const Class &) = delete;\ Class &operator=(const Class &) = delete; -#define Q_DISABLE_MOVE(Class) \ - Class(Class &&) = delete; \ - Class &operator=(Class &&) = delete; - #define Q_DISABLE_COPY_MOVE(Class) \ Q_DISABLE_COPY(Class) \ - Q_DISABLE_MOVE(Class) + Class(Class &&) = delete; \ + Class &operator=(Class &&) = delete; /* Implementing a move assignment operator using an established