From b32b61f17eb6f816d854d6177e70df9c9e8fb895 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 30 Apr 2019 17:16:17 +0200 Subject: Remove handling of missing Q_COMPILER_RVALUE_REFS Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.h | 2 -- src/corelib/tools/qeasingcurve.h | 2 -- src/corelib/tools/qhash.h | 4 ---- src/corelib/tools/qlinkedlist.h | 2 -- src/corelib/tools/qlist.h | 2 -- src/corelib/tools/qlocale.h | 2 -- src/corelib/tools/qmap.h | 4 ---- src/corelib/tools/qpair.h | 2 -- src/corelib/tools/qregexp.h | 2 -- src/corelib/tools/qregularexpression.h | 8 -------- src/corelib/tools/qshareddata.h | 4 ---- src/corelib/tools/qsharedpointer_impl.h | 5 ----- src/corelib/tools/qstring.h | 4 ---- src/corelib/tools/qstringlist.h | 4 ---- src/corelib/tools/qtimezone.h | 2 -- src/corelib/tools/qvector.h | 8 -------- src/corelib/tools/qversionnumber.h | 4 ---- 17 files changed, 61 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 8873651f17..79fd25d762 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -278,9 +278,7 @@ public: QDateTime(QDateTime &&other) noexcept; ~QDateTime(); -#ifdef Q_COMPILER_RVALUE_REFS QDateTime &operator=(QDateTime &&other) noexcept { swap(other); return *this; } -#endif QDateTime &operator=(const QDateTime &other) noexcept; void swap(QDateTime &other) noexcept { qSwap(d.d, other.d.d); } diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index 1791f19199..725ddd5dcc 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -80,11 +80,9 @@ public: QEasingCurve &operator=(const QEasingCurve &other) { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; } -#ifdef Q_COMPILER_RVALUE_REFS QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } QEasingCurve &operator=(QEasingCurve &&other) noexcept { qSwap(d_ptr, other.d_ptr); return *this; } -#endif void swap(QEasingCurve &other) noexcept { qSwap(d_ptr, other.d_ptr); } diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index a757e85386..0078bbbee9 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -255,11 +255,9 @@ public: ~QHash() { if (!d->ref.deref()) freeData(d); } QHash &operator=(const QHash &other); -#ifdef Q_COMPILER_RVALUE_REFS QHash(QHash &&other) noexcept : d(other.d) { other.d = const_cast(&QHashData::shared_null); } QHash &operator=(QHash &&other) noexcept { QHash moved(std::move(other)); swap(moved); return *this; } -#endif #ifdef Q_QDOC template QHash(InputIterator f, InputIterator l); @@ -1076,9 +1074,7 @@ public: // compiler-generated destructor is fine! QMultiHash(const QHash &other) : QHash(other) {} -#ifdef Q_COMPILER_RVALUE_REFS QMultiHash(QHash &&other) noexcept : QHash(std::move(other)) {} -#endif void swap(QMultiHash &other) noexcept { QHash::swap(other); } // prevent QMultiHash<->QHash swaps inline typename QHash::iterator replace(const Key &key, const T &value) diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 83f70deceb..0c8a99e258 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -95,12 +95,10 @@ public: } ~QLinkedList(); QLinkedList &operator=(const QLinkedList &); -#ifdef Q_COMPILER_RVALUE_REFS QLinkedList(QLinkedList &&other) noexcept : d(other.d) { other.d = const_cast(&QLinkedListData::shared_null); } QLinkedList &operator=(QLinkedList &&other) noexcept { QLinkedList moved(std::move(other)); swap(moved); return *this; } -#endif inline void swap(QLinkedList &other) noexcept { qSwap(d, other.d); } bool operator==(const QLinkedList &l) const; inline bool operator!=(const QLinkedList &l) const { return !(*this == l); } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 48a71b0ecf..59578b1e61 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -161,12 +161,10 @@ public: QList(const QList &l); ~QList(); QList &operator=(const QList &l); -#ifdef Q_COMPILER_RVALUE_REFS inline QList(QList &&other) noexcept : d(other.d) { other.d = const_cast(&QListData::shared_null); } inline QList &operator=(QList &&other) noexcept { QList moved(std::move(other)); swap(moved); return *this; } -#endif inline void swap(QList &other) noexcept { qSwap(d, other.d); } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QList(std::initializer_list args) diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 3dc5ee0a01..977c4c6c9c 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -939,9 +939,7 @@ public: QLocale(Language language, Country country = AnyCountry); QLocale(Language language, Script script, Country country); QLocale(const QLocale &other); -#ifdef Q_COMPILER_RVALUE_REFS QLocale &operator=(QLocale &&other) noexcept { swap(other); return *this; } -#endif QLocale &operator=(const QLocale &other); ~QLocale(); diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 103124f4ad..3b8aad9a33 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -339,7 +339,6 @@ public: inline ~QMap() { if (!d->ref.deref()) d->destroy(); } QMap &operator=(const QMap &other); -#ifdef Q_COMPILER_RVALUE_REFS inline QMap(QMap &&other) noexcept : d(other.d) { @@ -349,7 +348,6 @@ public: inline QMap &operator=(QMap &&other) noexcept { QMap moved(std::move(other)); swap(moved); return *this; } -#endif inline void swap(QMap &other) noexcept { qSwap(d, other.d); } explicit QMap(const typename std::map &other); std::map toStdMap() const; @@ -1196,9 +1194,7 @@ public: } #endif QMultiMap(const QMap &other) : QMap(other) {} -#ifdef Q_COMPILER_RVALUE_REFS QMultiMap(QMap &&other) noexcept : QMap(std::move(other)) {} -#endif void swap(QMultiMap &other) noexcept { QMap::swap(other); } inline typename QMap::iterator replace(const Key &key, const T &value) diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h index 6d1e67efb7..9ebf88bc8f 100644 --- a/src/corelib/tools/qpair.h +++ b/src/corelib/tools/qpair.h @@ -71,7 +71,6 @@ struct QPair noexcept((std::is_nothrow_assignable::value && std::is_nothrow_assignable::value)) { first = p.first; second = p.second; return *this; } -#ifdef Q_COMPILER_RVALUE_REFS template Q_DECL_CONSTEXPR QPair(QPair &&p) noexcept((std::is_nothrow_constructible::value && @@ -83,7 +82,6 @@ struct QPair noexcept((std::is_nothrow_assignable::value && std::is_nothrow_assignable::value)) { first = std::move(p.first); second = std::move(p.second); return *this; } -#endif Q_DECL_RELAXED_CONSTEXPR void swap(QPair &other) noexcept(noexcept(qSwap(other.first, other.first)) && noexcept(qSwap(other.second, other.second))) diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h index c043a06496..8f6de24c74 100644 --- a/src/corelib/tools/qregexp.h +++ b/src/corelib/tools/qregexp.h @@ -73,9 +73,7 @@ public: QRegExp(const QRegExp &rx); ~QRegExp(); QRegExp &operator=(const QRegExp &rx); -#ifdef Q_COMPILER_RVALUE_REFS QRegExp &operator=(QRegExp &&other) noexcept { swap(other); return *this; } -#endif void swap(QRegExp &other) noexcept { qSwap(priv, other.priv); } bool operator==(const QRegExp &rx) const; diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h index f16b7e91be..f799a38ae4 100644 --- a/src/corelib/tools/qregularexpression.h +++ b/src/corelib/tools/qregularexpression.h @@ -86,11 +86,8 @@ public: QRegularExpression(const QRegularExpression &re); ~QRegularExpression(); QRegularExpression &operator=(const QRegularExpression &re); - -#ifdef Q_COMPILER_RVALUE_REFS QRegularExpression &operator=(QRegularExpression &&re) noexcept { d.swap(re.d); return *this; } -#endif void swap(QRegularExpression &other) noexcept { d.swap(other.d); } @@ -186,11 +183,8 @@ public: ~QRegularExpressionMatch(); QRegularExpressionMatch(const QRegularExpressionMatch &match); QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match); - -#ifdef Q_COMPILER_RVALUE_REFS QRegularExpressionMatch &operator=(QRegularExpressionMatch &&match) noexcept { d.swap(match.d); return *this; } -#endif void swap(QRegularExpressionMatch &other) noexcept { d.swap(other.d); } QRegularExpression regularExpression() const; @@ -257,10 +251,8 @@ public: ~QRegularExpressionMatchIterator(); QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator); QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator); -#ifdef Q_COMPILER_RVALUE_REFS QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator) noexcept { d.swap(iterator.d); return *this; } -#endif void swap(QRegularExpressionMatchIterator &other) noexcept { d.swap(other.d); } bool isValid() const; diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index cbaa1aa3c4..04051472d6 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -112,7 +112,6 @@ public: } return *this; } -#ifdef Q_COMPILER_RVALUE_REFS QSharedDataPointer(QSharedDataPointer &&o) noexcept : d(o.d) { o.d = nullptr; } inline QSharedDataPointer &operator=(QSharedDataPointer &&other) noexcept { @@ -120,7 +119,6 @@ public: swap(moved); return *this; } -#endif inline bool operator!() const { return !d; } @@ -218,7 +216,6 @@ public: } return *this; } -#ifdef Q_COMPILER_RVALUE_REFS inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) noexcept : d(o.d) { o.d = nullptr; } inline QExplicitlySharedDataPointer &operator=(QExplicitlySharedDataPointer &&other) noexcept { @@ -226,7 +223,6 @@ public: swap(moved); return *this; } -#endif inline bool operator!() const { return !d; } diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 0851121ff2..9fb452da6b 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -337,7 +337,6 @@ public: swap(copy); return *this; } -#ifdef Q_COMPILER_RVALUE_REFS QSharedPointer(QSharedPointer &&other) noexcept : value(other.value), d(other.d) { @@ -367,8 +366,6 @@ public: return *this; } -#endif - template QSharedPointer(const QSharedPointer &other) noexcept : value(other.value), d(other.d) { if (d) ref(); } @@ -590,7 +587,6 @@ public: QWeakPointer(const QWeakPointer &other) noexcept : d(other.d), value(other.value) { if (d) d->weakref.ref(); } -#ifdef Q_COMPILER_RVALUE_REFS QWeakPointer(QWeakPointer &&other) noexcept : d(other.d), value(other.value) { @@ -599,7 +595,6 @@ public: } QWeakPointer &operator=(QWeakPointer &&other) noexcept { QWeakPointer moved(std::move(other)); swap(moved); return *this; } -#endif QWeakPointer &operator=(const QWeakPointer &other) noexcept { QWeakPointer copy(other); diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index a526a6537a..e4798eb51b 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -230,11 +230,9 @@ public: QString &operator=(QChar c); QString &operator=(const QString &) noexcept; QString &operator=(QLatin1String latin1); -#ifdef Q_COMPILER_RVALUE_REFS inline QString(QString && other) noexcept : d(other.d) { other.d = Data::sharedNull(); } inline QString &operator=(QString &&other) noexcept { qSwap(d, other.d); return *this; } -#endif inline void swap(QString &other) noexcept { qSwap(d, other.d); } inline int size() const { return d->size; } inline int count() const { return d->size; } @@ -1437,10 +1435,8 @@ public: QStringRef(const QStringRef &other) noexcept :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {} -#ifdef Q_COMPILER_RVALUE_REFS QStringRef(QStringRef &&other) noexcept : m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {} QStringRef &operator=(QStringRef &&other) noexcept { return *this = other; } -#endif QStringRef &operator=(const QStringRef &other) noexcept { m_string = other.m_string; m_position = other.m_position; diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index 5ad01a0658..73ac737643 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -104,9 +104,7 @@ public: inline QStringList() noexcept { } inline explicit QStringList(const QString &i) { append(i); } inline QStringList(const QList &l) : QList(l) { } -#ifdef Q_COMPILER_RVALUE_REFS inline QStringList(QList &&l) noexcept : QList(std::move(l)) { } -#endif #ifdef Q_COMPILER_INITIALIZER_LISTS inline QStringList(std::initializer_list args) : QList(args) { } #endif @@ -116,10 +114,8 @@ public: QStringList &operator=(const QList &other) { QList::operator=(other); return *this; } -#ifdef Q_COMPILER_RVALUE_REFS QStringList &operator=(QList &&other) noexcept { QList::operator=(std::move(other)); return *this; } -#endif #if QT_STRINGVIEW_LEVEL < 2 inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index ca98986ec1..62ecee49bb 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -99,9 +99,7 @@ public: ~QTimeZone(); QTimeZone &operator=(const QTimeZone &other); - #ifdef Q_COMPILER_RVALUE_REFS QTimeZone &operator=(QTimeZone &&other) noexcept { swap(other); return *this; } -#endif void swap(QTimeZone &other) noexcept { d.swap(other.d); } diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 6cbf794c6c..7e14a0c9b2 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -72,11 +72,9 @@ public: inline QVector(const QVector &v); inline ~QVector() { if (!d->ref.deref()) freeData(d); } QVector &operator=(const QVector &v); -#if defined(Q_COMPILER_RVALUE_REFS) || defined(Q_CLANG_QDOC) QVector(QVector &&other) noexcept : d(other.d) { other.d = Data::sharedNull(); } QVector &operator=(QVector &&other) noexcept { QVector moved(std::move(other)); swap(moved); return *this; } -#endif void swap(QVector &other) noexcept { qSwap(d, other.d); } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QVector(std::initializer_list args); @@ -143,9 +141,7 @@ public: T &operator[](int i); const T &operator[](int i) const; void append(const T &t); -#if defined(Q_COMPILER_RVALUE_REFS) || defined(Q_CLANG_QDOC) void append(T &&t); -#endif inline void append(const QVector &l) { *this += l; } void prepend(T &&t); void prepend(const T &t); @@ -268,10 +264,8 @@ public: typedef const_iterator ConstIterator; typedef int size_type; inline void push_back(const T &t) { append(t); } -#if defined(Q_COMPILER_RVALUE_REFS) || defined(Q_CLANG_QDOC) void push_back(T &&t) { append(std::move(t)); } void push_front(T &&t) { prepend(std::move(t)); } -#endif inline void push_front(const T &t) { prepend(t); } void pop_back() { removeLast(); } void pop_front() { removeFirst(); } @@ -799,7 +793,6 @@ void QVector::append(const T &t) ++d->size; } -#ifdef Q_COMPILER_RVALUE_REFS template void QVector::append(T &&t) { @@ -813,7 +806,6 @@ void QVector::append(T &&t) ++d->size; } -#endif template void QVector::removeLast() diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index d51947c091..1488014d38 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -119,7 +119,6 @@ class QVersionNumber return *this; } -#ifdef Q_COMPILER_RVALUE_REFS SegmentStorage(SegmentStorage &&other) noexcept : dummy(other.dummy) { @@ -139,7 +138,6 @@ class QVersionNumber else pointer_segments = new QVector(std::move(seg)); } -#endif #ifdef Q_COMPILER_INITIALIZER_LISTS SegmentStorage(std::initializer_list args) { @@ -227,11 +225,9 @@ public: // compiler-generated copy/move ctor/assignment operators and the destructor are ok -#ifdef Q_COMPILER_RVALUE_REFS explicit QVersionNumber(QVector &&seg) : m_segments(std::move(seg)) {} -#endif #ifdef Q_COMPILER_INITIALIZER_LISTS inline QVersionNumber(std::initializer_list args) -- cgit v1.2.3