Skip to content

Commit

Permalink
Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE
Browse files Browse the repository at this point in the history
Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with
move semantics, its name is misleading. Q_RELOCATABLE_TYPE was
introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE
is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE
by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this
patch should have no impact on users.

Pick-to: 6.0
Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
  • Loading branch information
andreasbuhr committed Nov 30, 2020
1 parent 5e84023 commit 0440614
Show file tree
Hide file tree
Showing 138 changed files with 265 additions and 265 deletions.
2 changes: 1 addition & 1 deletion qmake/generators/makefile.h
Expand Up @@ -291,7 +291,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo
QString shellQuote(const QString &str) const;
virtual ProKey fullTargetVariable() const;
};
Q_DECLARE_TYPEINFO(MakefileGenerator::Compiler, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(MakefileGenerator::Compiler, Q_RELOCATABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(MakefileGenerator::FileFixifyTypes)

inline void MakefileGenerator::setNoIO(bool o)
Expand Down
2 changes: 1 addition & 1 deletion qmake/generators/win32/msvc_objectmodel.h
Expand Up @@ -1002,7 +1002,7 @@ class VCProjectSingleConfig
const VCFilter &filterByName(const QString &name) const;
const VCFilter &filterForExtraCompiler(const QString &compilerName) const;
};
Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_RELOCATABLE_TYPE);

// Tree & Flat view of files --------------------------------------------------
class VCFilter;
Expand Down
8 changes: 4 additions & 4 deletions qmake/library/proitems.h
Expand Up @@ -190,7 +190,7 @@ class ProString {
friend QString operator+(const ProString &one, const ProString &two);
friend class ProKey;
};
Q_DECLARE_TYPEINFO(ProString, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(ProString, Q_RELOCATABLE_TYPE);


class ProKey : public ProString {
Expand Down Expand Up @@ -222,7 +222,7 @@ class ProKey : public ProString {
private:
ProKey(const ProString &other);
};
Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(ProKey, Q_RELOCATABLE_TYPE);

template <> struct QConcatenable<ProString> : private QAbstractConcatenable
{
Expand Down Expand Up @@ -343,7 +343,7 @@ class ProStringList : public QList<ProString> {
{ return contains(ProString(str), cs); }
bool contains(const char *str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
};
Q_DECLARE_TYPEINFO(ProStringList, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(ProStringList, Q_RELOCATABLE_TYPE);

inline ProStringList operator+(const ProStringList &one, const ProStringList &two)
{ ProStringList ret = one; ret += two; return ret; }
Expand Down Expand Up @@ -496,7 +496,7 @@ class ProFunctionDef {
int m_offset;
};

Q_DECLARE_TYPEINFO(ProFunctionDef, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(ProFunctionDef, Q_RELOCATABLE_TYPE);

struct ProFunctionDefs {
QHash<ProKey, ProFunctionDef> testFunctions;
Expand Down
2 changes: 1 addition & 1 deletion qmake/library/qmakeevaluator_p.h
Expand Up @@ -107,7 +107,7 @@ extern QMakeStatics statics;

}

Q_DECLARE_TYPEINFO(QMakeInternal::QMakeBuiltin, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMakeInternal::QMakeBuiltin, Q_RELOCATABLE_TYPE);

QT_END_NAMESPACE

Expand Down
2 changes: 1 addition & 1 deletion qmake/library/qmakeparser.h
Expand Up @@ -230,7 +230,7 @@ class QMAKE_EXPORT ProFileCache
};

#if !defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
Q_DECLARE_TYPEINFO(QMakeParser::BlockScope, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMakeParser::BlockScope, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QMakeParser::Context, Q_PRIMITIVE_TYPE);
#endif

Expand Down
2 changes: 1 addition & 1 deletion qmake/main.cpp
Expand Up @@ -63,7 +63,7 @@ struct SedSubst {
QRegularExpression from;
QString to;
};
Q_DECLARE_TYPEINFO(SedSubst, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(SedSubst, Q_RELOCATABLE_TYPE);

static int doSed(int argc, char **argv)
{
Expand Down
Expand Up @@ -553,7 +553,7 @@ class Point2D
int *data;
};

Q_DECLARE_TYPEINFO(Point2D, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(Point2D, Q_RELOCATABLE_TYPE);
//! [39]


Expand Down
2 changes: 1 addition & 1 deletion src/corelib/global/qlogging.cpp
Expand Up @@ -1096,7 +1096,7 @@ struct QMessagePattern
static QBasicMutex mutex;
};
#ifdef QLOGGING_HAVE_BACKTRACE
Q_DECLARE_TYPEINFO(QMessagePattern::BacktraceParams, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMessagePattern::BacktraceParams, Q_RELOCATABLE_TYPE);
#endif

QBasicMutex QMessagePattern::mutex;
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/global/qnamespace.h
Expand Up @@ -1919,7 +1919,7 @@ class QKeyCombination
}
};

Q_DECLARE_TYPEINFO(QKeyCombination, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QKeyCombination, Q_RELOCATABLE_TYPE);

constexpr QKeyCombination operator|(Qt::Modifier modifier, Qt::Key key) noexcept
{
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/global/qtypeinfo.h
Expand Up @@ -188,7 +188,7 @@ Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);
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),
_and_ without an explicit Q_DECLARE_TYPEINFO(type, Q_RELOCATABLE_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.
Expand All @@ -199,9 +199,9 @@ Q_DECLARE_TYPEINFO(TYPE, FLAGS); \
inline void swap(TYPE &value1, TYPE &value2) \
noexcept(noexcept(value1.swap(value2))) \
{ value1.swap(value2); }
#define Q_DECLARE_SHARED(TYPE) Q_DECLARE_SHARED_IMPL(TYPE, Q_MOVABLE_TYPE)
#define Q_DECLARE_SHARED(TYPE) Q_DECLARE_SHARED_IMPL(TYPE, Q_RELOCATABLE_TYPE)
#define Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(TYPE) \
Q_DECLARE_SHARED_IMPL(TYPE, Q_MOVABLE_TYPE)
Q_DECLARE_SHARED_IMPL(TYPE, Q_RELOCATABLE_TYPE)

namespace QTypeTraits
{
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/io/qfilesystemwatcher_win_p.h
Expand Up @@ -138,7 +138,7 @@ class QFileSystemWatcherPathKey : public QString
bool operator==(const QFileSystemWatcherPathKey &other) const { return !compare(other, Qt::CaseInsensitive); }
};

Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_RELOCATABLE_TYPE);

inline size_t qHash(const QFileSystemWatcherPathKey &key) { return qHash(key.toCaseFolded()); }

Expand Down
2 changes: 1 addition & 1 deletion src/corelib/io/qloggingregistry_p.h
Expand Up @@ -88,7 +88,7 @@ class Q_AUTOTEST_EXPORT QLoggingRule
};

Q_DECLARE_OPERATORS_FOR_FLAGS(QLoggingRule::PatternFlags)
Q_DECLARE_TYPEINFO(QLoggingRule, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QLoggingRule, Q_RELOCATABLE_TYPE);

class Q_AUTOTEST_EXPORT QLoggingSettingsParser
{
Expand Down
4 changes: 2 additions & 2 deletions src/corelib/io/qprocess_p.h
Expand Up @@ -99,7 +99,7 @@ inline bool operator<(const QProcEnvKey &a, const QProcEnvKey &b)
return a.compare(b, Qt::CaseInsensitive) < 0;
}

Q_DECLARE_TYPEINFO(QProcEnvKey, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QProcEnvKey, Q_RELOCATABLE_TYPE);

typedef QString QProcEnvValue;
#else
Expand Down Expand Up @@ -133,7 +133,7 @@ class QProcEnvValue
mutable QByteArray byteValue;
mutable QString stringValue;
};
Q_DECLARE_TYPEINFO(QProcEnvValue, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QProcEnvValue, Q_RELOCATABLE_TYPE);
#endif

class QProcessEnvironmentPrivate: public QSharedData
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/io/qresource.cpp
Expand Up @@ -194,7 +194,7 @@ static QString cleanPath(const QString &_path)
return path;
}

Q_DECLARE_TYPEINFO(QResourceRoot, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QResourceRoot, Q_RELOCATABLE_TYPE);

typedef QList<QResourceRoot*> ResourceList;
struct QResourceGlobalData
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/io/qsettings.cpp
Expand Up @@ -108,7 +108,7 @@ struct QConfFileCustomFormat
QSettings::WriteFunc writeFunc;
Qt::CaseSensitivity caseSensitivity;
};
Q_DECLARE_TYPEINFO(QConfFileCustomFormat, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QConfFileCustomFormat, Q_RELOCATABLE_TYPE);

typedef QHash<QString, QConfFile *> ConfFileHash;
typedef QCache<QString, QConfFile> ConfFileCache;
Expand Down Expand Up @@ -1715,7 +1715,7 @@ class QSettingsIniKey : public QString

int position;
};
Q_DECLARE_TYPEINFO(QSettingsIniKey, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QSettingsIniKey, Q_RELOCATABLE_TYPE);

static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
{
Expand All @@ -1734,7 +1734,7 @@ struct QSettingsIniSection
inline QSettingsIniSection() : position(-1) {}
};

Q_DECLARE_TYPEINFO(QSettingsIniSection, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QSettingsIniSection, Q_RELOCATABLE_TYPE);

typedef QMap<QString, QSettingsIniSection> IniMap;

Expand Down
4 changes: 2 additions & 2 deletions src/corelib/io/qsettings_p.h
Expand Up @@ -108,7 +108,7 @@ class QSettingsKey : public QString
};
#endif

Q_DECLARE_TYPEINFO(QSettingsKey, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QSettingsKey, Q_RELOCATABLE_TYPE);

typedef QMap<QSettingsKey, QByteArray> UnparsedSettingsMap;
typedef QMap<QSettingsKey, QVariant> ParsedSettingsMap;
Expand All @@ -134,7 +134,7 @@ class QSettingsGroup
int num;
int maxNum;
};
Q_DECLARE_TYPEINFO(QSettingsGroup, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QSettingsGroup, Q_RELOCATABLE_TYPE);

inline QString QSettingsGroup::toString() const
{
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/itemmodels/qabstractitemmodel.h
Expand Up @@ -71,7 +71,7 @@ class QModelRoleData
void clearData() noexcept { m_data.clear(); }
};

Q_DECLARE_TYPEINFO(QModelRoleData, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QModelRoleData, Q_RELOCATABLE_TYPE);

class QModelRoleDataSpan;

Expand Down Expand Up @@ -151,7 +151,7 @@ class QModelRoleDataSpan
}
};

Q_DECLARE_TYPEINFO(QModelRoleDataSpan, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QModelRoleDataSpan, Q_RELOCATABLE_TYPE);

class QAbstractItemModel;
class QPersistentModelIndex;
Expand Down Expand Up @@ -196,7 +196,7 @@ class QModelIndex
quintptr i;
const QAbstractItemModel *m;
};
Q_DECLARE_TYPEINFO(QModelIndex, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QModelIndex, Q_RELOCATABLE_TYPE);

#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &);
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/itemmodels/qabstractitemmodel_p.h
Expand Up @@ -152,7 +152,7 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate
static bool isVariantLessThan(const QVariant &left, const QVariant &right,
Qt::CaseSensitivity cs = Qt::CaseSensitive, bool isLocaleAware = false);
};
Q_DECLARE_TYPEINFO(QAbstractItemModelPrivate::Change, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QAbstractItemModelPrivate::Change, Q_RELOCATABLE_TYPE);

QT_END_NAMESPACE

Expand Down
2 changes: 1 addition & 1 deletion src/corelib/itemmodels/qitemselectionmodel.h
Expand Up @@ -112,7 +112,7 @@ class Q_CORE_EXPORT QItemSelectionRange
private:
QPersistentModelIndex tl, br;
};
Q_DECLARE_TYPEINFO(QItemSelectionRange, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QItemSelectionRange, Q_RELOCATABLE_TYPE);

class QItemSelection;
class QItemSelectionModelPrivate;
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/kernel/qassociativeiterable.h
Expand Up @@ -198,9 +198,9 @@ inline QVariantRef<QAssociativeIterator> &QVariantRef<QAssociativeIterator>::ope
return *this;
}

Q_DECLARE_TYPEINFO(QAssociativeIterable, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QAssociativeIterable::iterator, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QAssociativeIterable::const_iterator, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QAssociativeIterable, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QAssociativeIterable::iterator, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QAssociativeIterable::const_iterator, Q_RELOCATABLE_TYPE);

QT_END_NAMESPACE

Expand Down
2 changes: 1 addition & 1 deletion src/corelib/kernel/qbasictimer.h
Expand Up @@ -72,7 +72,7 @@ class Q_CORE_EXPORT QBasicTimer
void start(int msec, Qt::TimerType timerType, QObject *obj);
void stop();
};
Q_DECLARE_TYPEINFO(QBasicTimer, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QBasicTimer, Q_RELOCATABLE_TYPE);

inline void swap(QBasicTimer &lhs, QBasicTimer &rhs) noexcept { lhs.swap(rhs); }

Expand Down
6 changes: 3 additions & 3 deletions src/corelib/kernel/qmetaobject.h
Expand Up @@ -213,7 +213,7 @@ class Q_CORE_EXPORT QMetaMethod
friend bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2) noexcept
{ return !(m1 == m2); }
};
Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMetaMethod, Q_RELOCATABLE_TYPE);

class Q_CORE_EXPORT QMetaEnum
{
Expand Down Expand Up @@ -270,7 +270,7 @@ class Q_CORE_EXPORT QMetaEnum
friend struct QMetaObject;
friend struct QMetaObjectPrivate;
};
Q_DECLARE_TYPEINFO(QMetaEnum, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMetaEnum, Q_RELOCATABLE_TYPE);

class Q_CORE_EXPORT QMetaProperty
{
Expand Down Expand Up @@ -378,7 +378,7 @@ class Q_CORE_EXPORT QMetaClassInfo
Data data;
friend struct QMetaObject;
};
Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_RELOCATABLE_TYPE);

QT_END_NAMESPACE

Expand Down
2 changes: 1 addition & 1 deletion src/corelib/kernel/qmetaobject_p.h
Expand Up @@ -161,7 +161,7 @@ class QArgumentType
int _type;
QByteArray _name;
};
Q_DECLARE_TYPEINFO(QArgumentType, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QArgumentType, Q_RELOCATABLE_TYPE);

typedef QVarLengthArray<QArgumentType, 10> QArgumentTypeArray;

Expand Down
6 changes: 3 additions & 3 deletions src/corelib/kernel/qmetaobjectbuilder.cpp
Expand Up @@ -146,7 +146,7 @@ class QMetaMethodBuilderPrivate
return signature.left(qMax(signature.indexOf('('), 0));
}
};
Q_DECLARE_TYPEINFO(QMetaMethodBuilderPrivate, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMetaMethodBuilderPrivate, Q_RELOCATABLE_TYPE);

class QMetaPropertyBuilderPrivate
{
Expand Down Expand Up @@ -183,7 +183,7 @@ class QMetaPropertyBuilderPrivate
flags &= ~f;
}
};
Q_DECLARE_TYPEINFO(QMetaPropertyBuilderPrivate, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMetaPropertyBuilderPrivate, Q_RELOCATABLE_TYPE);

class QMetaEnumBuilderPrivate
{
Expand All @@ -200,7 +200,7 @@ class QMetaEnumBuilderPrivate
QList<QByteArray> keys;
QList<int> values;
};
Q_DECLARE_TYPEINFO(QMetaEnumBuilderPrivate, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMetaEnumBuilderPrivate, Q_RELOCATABLE_TYPE);

class QMetaObjectBuilderPrivate
{
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/kernel/qmetatype.h
Expand Up @@ -709,7 +709,7 @@ class QPairVariantInterfaceImpl
inline void first(void *dataPtr) const { _getFirst(&_pair, dataPtr); }
inline void second(void *dataPtr) const { _getSecond(&_pair, dataPtr); }
};
QT_METATYPE_PRIVATE_DECLARE_TYPEINFO(QPairVariantInterfaceImpl, Q_MOVABLE_TYPE)
QT_METATYPE_PRIVATE_DECLARE_TYPEINFO(QPairVariantInterfaceImpl, Q_RELOCATABLE_TYPE)

template<typename From>
struct QPairVariantInterfaceConvertFunctor;
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/kernel/qmimedata.cpp
Expand Up @@ -58,7 +58,7 @@ struct QMimeDataStruct
QString format;
QVariant data;
};
Q_DECLARE_TYPEINFO(QMimeDataStruct, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QMimeDataStruct, Q_RELOCATABLE_TYPE);

class QMimeDataPrivate : public QObjectPrivate
{
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/kernel/qobject_p.h
Expand Up @@ -387,7 +387,7 @@ class Q_CORE_EXPORT QObjectPrivate : public QObjectData
QBindingStorage bindingStorage;
};

Q_DECLARE_TYPEINFO(QObjectPrivate::ConnectionList, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QObjectPrivate::ConnectionList, Q_RELOCATABLE_TYPE);

/*
Catch mixing of incompatible library versions.
Expand Down Expand Up @@ -498,8 +498,8 @@ bool QObjectPrivate::disconnect(const typename QtPrivate::FunctionPointer< Func1
&SignalType::Object::staticMetaObject);
}

Q_DECLARE_TYPEINFO(QObjectPrivate::Connection, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QObjectPrivate::Sender, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(QObjectPrivate::Connection, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QObjectPrivate::Sender, Q_RELOCATABLE_TYPE);

class QSemaphore;
class Q_CORE_EXPORT QAbstractMetaCallEvent : public QEvent
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/kernel/qpointer.h
Expand Up @@ -112,7 +112,7 @@ class QPointer
#undef DECLARE_COMPARE_SET
#undef DECLARE_TEMPLATE_COMPARE_SET
};
template <class T> Q_DECLARE_TYPEINFO_BODY(QPointer<T>, Q_MOVABLE_TYPE);
template <class T> Q_DECLARE_TYPEINFO_BODY(QPointer<T>, Q_RELOCATABLE_TYPE);

template<typename T>
QPointer<T>
Expand Down

0 comments on commit 0440614

Please sign in to comment.