From 390b16aea85e64bc33ce91e37898f59ad8a994c7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 8 Jan 2015 15:08:22 +0100 Subject: [PATCH] QtCore: mark some operations nothrow This shotgun-surgery approach is motivated by trying to get a clean(er) build for -Wnoexcept on GCC, so it is expected that for any class touched here, there will be more operations that can be marked nothrow. But they don't show up in conditional noexcept clauses, yet, so they are deferred to some later commit. Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233 Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.h | 2 +- src/corelib/io/qprocess_p.h | 2 +- src/corelib/io/qurl.h | 8 +++---- src/corelib/itemmodels/qabstractitemmodel.h | 13 ++++++----- src/corelib/kernel/qcoreapplication.cpp | 2 +- src/corelib/kernel/qvariant.h | 12 +++++----- src/corelib/tools/qarraydata.h | 4 ++-- src/corelib/tools/qbitarray.h | 6 ++--- src/corelib/tools/qbytearray.h | 7 +++--- src/corelib/tools/qcache.h | 4 ++-- src/corelib/tools/qcollator.h | 10 ++++---- src/corelib/tools/qhash.h | 8 +++---- src/corelib/tools/qlist.h | 2 +- src/corelib/tools/qregularexpression.h | 12 +++++----- src/corelib/tools/qshareddata.h | 26 +++++++++++---------- src/corelib/tools/qstring.h | 10 ++++---- src/corelib/tools/qstringlist.h | 6 ++--- src/corelib/tools/qtimezone.h | 4 ++-- src/corelib/tools/qvector.h | 2 +- 19 files changed, 72 insertions(+), 68 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 4295800f1ac..99c2909aa05 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -85,7 +85,7 @@ public: inline QDebug(const QDebug &o):stream(o.stream) { ++stream->ref; } inline QDebug &operator=(const QDebug &other); ~QDebug(); - inline void swap(QDebug &other) { qSwap(stream, other.stream); } + inline void swap(QDebug &other) Q_DECL_NOTHROW { qSwap(stream, other.stream); } QDebug &resetFormat(); diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 35626ddc389..8c5987aa05f 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -98,7 +98,7 @@ public: QByteArray key; uint hash; }; -inline uint qHash(const QProcEnvKey &key) { return key.hash; } +inline uint qHash(const QProcEnvKey &key) Q_DECL_NOTHROW { return key.hash; } class QProcEnvValue { diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index abf96f5fcdc..a1f62925e22 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -173,14 +173,14 @@ public: QUrl &operator=(const QString &url); #endif #ifdef Q_COMPILER_RVALUE_REFS - QUrl(QUrl &&other) : d(0) - { qSwap(d, other.d); } - inline QUrl &operator=(QUrl &&other) + QUrl(QUrl &&other) Q_DECL_NOTHROW : d(other.d) + { other.d = Q_NULLPTR; } + inline QUrl &operator=(QUrl &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif ~QUrl(); - inline void swap(QUrl &other) { qSwap(d, other.d); } + inline void swap(QUrl &other) Q_DECL_NOTHROW { qSwap(d, other.d); } void setUrl(const QString &url, ParsingMode mode = TolerantMode); QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const; diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index a49cf160ccd..75c2009fe49 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -91,7 +91,7 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &); class QPersistentModelIndexData; // qHash is a friend, but we can't use default arguments for friends (ยง8.3.6.4) -uint qHash(const QPersistentModelIndex &index, uint seed = 0); +uint qHash(const QPersistentModelIndex &index, uint seed = 0) Q_DECL_NOTHROW; class Q_CORE_EXPORT QPersistentModelIndex { @@ -106,11 +106,12 @@ public: { return !operator==(other); } QPersistentModelIndex &operator=(const QPersistentModelIndex &other); #ifdef Q_COMPILER_RVALUE_REFS - inline QPersistentModelIndex(QPersistentModelIndex &&other) : d(other.d) { other.d = 0; } - inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) + inline QPersistentModelIndex(QPersistentModelIndex &&other) Q_DECL_NOTHROW + : d(other.d) { other.d = Q_NULLPTR; } + inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif - inline void swap(QPersistentModelIndex &other) { qSwap(d, other.d); } + inline void swap(QPersistentModelIndex &other) Q_DECL_NOTHROW { qSwap(d, other.d); } bool operator==(const QModelIndex &other) const; bool operator!=(const QModelIndex &other) const; QPersistentModelIndex &operator=(const QModelIndex &other); @@ -128,14 +129,14 @@ public: bool isValid() const; private: QPersistentModelIndexData *d; - friend uint qHash(const QPersistentModelIndex &, uint seed); + friend uint qHash(const QPersistentModelIndex &, uint seed) Q_DECL_NOTHROW; #ifndef QT_NO_DEBUG_STREAM friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &); #endif }; Q_DECLARE_SHARED(QPersistentModelIndex) -inline uint qHash(const QPersistentModelIndex &index, uint seed) +inline uint qHash(const QPersistentModelIndex &index, uint seed) Q_DECL_NOTHROW { return qHash(index.d, seed); } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index ca3d92bad11..555b5e02639 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -318,7 +318,7 @@ QCoreApplication *QCoreApplication::self = 0; uint QCoreApplicationPrivate::attribs = (1 << Qt::AA_SynthesizeMouseForUnhandledTouchEvents); struct QCoreApplicationData { - QCoreApplicationData() { + QCoreApplicationData() Q_DECL_NOTHROW { #ifndef QT_NO_LIBRARY app_libpaths = 0; #endif diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 7dce813bb50..7bee756fa54 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -253,13 +253,13 @@ class Q_CORE_EXPORT QVariant QVariant& operator=(const QVariant &other); #ifdef Q_COMPILER_RVALUE_REFS - inline QVariant(QVariant &&other) : d(other.d) + inline QVariant(QVariant &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Private(); } - inline QVariant &operator=(QVariant &&other) + inline QVariant &operator=(QVariant &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif - inline void swap(QVariant &other) { qSwap(d, other.d); } + inline void swap(QVariant &other) Q_DECL_NOTHROW { qSwap(d, other.d); } Type type() const; int userType() const; @@ -360,15 +360,15 @@ class Q_CORE_EXPORT QVariant }; struct Private { - inline Private(): type(Invalid), is_shared(false), is_null(true) + inline Private() Q_DECL_NOTHROW : type(Invalid), is_shared(false), is_null(true) { data.ptr = 0; } // Internal constructor for initialized variants. - explicit inline Private(uint variantType) + explicit inline Private(uint variantType) Q_DECL_NOTHROW : type(variantType), is_shared(false), is_null(false) {} - inline Private(const Private &other) + inline Private(const Private &other) Q_DECL_NOTHROW : data(other.data), type(other.type), is_shared(other.is_shared), is_null(other.is_null) {} diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index 2119b3d4ac3..df44503a8e3 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -113,7 +113,7 @@ struct Q_CORE_EXPORT QArrayData size_t alignment) Q_DECL_NOTHROW; static const QArrayData shared_null[2]; - static QArrayData *sharedNull() { return const_cast(shared_null); } + static QArrayData *sharedNull() Q_DECL_NOTHROW { return const_cast(shared_null); } }; Q_DECLARE_OPERATORS_FOR_FLAGS(QArrayData::AllocationOptions) @@ -237,7 +237,7 @@ struct QTypedArrayData return result; } - static QTypedArrayData *sharedNull() + static QTypedArrayData *sharedNull() Q_DECL_NOTHROW { Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); return static_cast(QArrayData::sharedNull()); diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h index 768dfa912dd..8d550554ff1 100644 --- a/src/corelib/tools/qbitarray.h +++ b/src/corelib/tools/qbitarray.h @@ -53,12 +53,12 @@ public: QBitArray(const QBitArray &other) : d(other.d) {} inline QBitArray &operator=(const QBitArray &other) { d = other.d; return *this; } #ifdef Q_COMPILER_RVALUE_REFS - inline QBitArray(QBitArray &&other) : d(std::move(other.d)) {} - inline QBitArray &operator=(QBitArray &&other) + inline QBitArray(QBitArray &&other) Q_DECL_NOTHROW : d(std::move(other.d)) {} + inline QBitArray &operator=(QBitArray &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif - inline void swap(QBitArray &other) { qSwap(d, other.d); } + inline void swap(QBitArray &other) Q_DECL_NOTHROW { qSwap(d, other.d); } inline int size() const { return (d.size() << 3) - *d.constData(); } inline int count() const { return (d.size() << 3) - *d.constData(); } diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 62866249616..a5495854000 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -195,12 +195,13 @@ public: QByteArray &operator=(const QByteArray &); QByteArray &operator=(const char *str); #ifdef Q_COMPILER_RVALUE_REFS - inline QByteArray(QByteArray && other) : d(other.d) { other.d = Data::sharedNull(); } - inline QByteArray &operator=(QByteArray &&other) + inline QByteArray(QByteArray && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); } + inline QByteArray &operator=(QByteArray &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif - inline void swap(QByteArray &other) { qSwap(d, other.d); } + inline void swap(QByteArray &other) Q_DECL_NOTHROW + { qSwap(d, other.d); } inline int size() const; bool isEmpty() const; diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 960e0422a1d..80fdb8c9cd5 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -83,7 +83,7 @@ class QCache Q_DISABLE_COPY(QCache) public: - inline explicit QCache(int maxCost = 100); + inline explicit QCache(int maxCost = 100) Q_DECL_NOTHROW; inline ~QCache() { clear(); } inline int maxCost() const { return mx; } @@ -110,7 +110,7 @@ private: }; template -inline QCache::QCache(int amaxCost) +inline QCache::QCache(int amaxCost) Q_DECL_NOTHROW : f(0), l(0), mx(amaxCost), total(0) {} template diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index f9ae44cf6ba..98f06bcc1f9 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -52,10 +52,10 @@ public: ~QCollatorSortKey(); QCollatorSortKey &operator=(const QCollatorSortKey &other); #ifdef Q_COMPILER_RVALUE_REFS - inline QCollatorSortKey &operator=(QCollatorSortKey &&other) + inline QCollatorSortKey &operator=(QCollatorSortKey &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif - void swap(QCollatorSortKey &other) + void swap(QCollatorSortKey &other) Q_DECL_NOTHROW { d.swap(other.d); } int compare(const QCollatorSortKey &key) const; @@ -82,13 +82,13 @@ public: ~QCollator(); QCollator &operator=(const QCollator &); #ifdef Q_COMPILER_RVALUE_REFS - QCollator(QCollator &&other) + QCollator(QCollator &&other) Q_DECL_NOTHROW : d(other.d) { other.d = 0; } - QCollator &operator=(QCollator &&other) + QCollator &operator=(QCollator &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif - void swap(QCollator &other) + void swap(QCollator &other) Q_DECL_NOTHROW { qSwap(d, other.d); } void setLocale(const QLocale &locale); diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 2a2c840c236..13006095e6e 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -328,7 +328,7 @@ class QHash static inline int alignOfNode() { return qMax(sizeof(void*), Q_ALIGNOF(Node)); } public: - inline QHash() : d(const_cast(&QHashData::shared_null)) { } + inline QHash() Q_DECL_NOTHROW : d(const_cast(&QHashData::shared_null)) { } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QHash(std::initializer_list > list) : d(const_cast(&QHashData::shared_null)) @@ -343,11 +343,11 @@ public: QHash &operator=(const QHash &other); #ifdef Q_COMPILER_RVALUE_REFS - inline QHash(QHash &&other) : d(other.d) { other.d = const_cast(&QHashData::shared_null); } - inline QHash &operator=(QHash &&other) + inline QHash(QHash &&other) Q_DECL_NOTHROW : d(other.d) { other.d = const_cast(&QHashData::shared_null); } + inline QHash &operator=(QHash &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif - inline void swap(QHash &other) { qSwap(d, other.d); } + inline void swap(QHash &other) Q_DECL_NOTHROW { qSwap(d, other.d); } bool operator==(const QHash &other) const; inline bool operator!=(const QHash &other) const { return !(*this == other); } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 321c3e67652..2031c320691 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -112,7 +112,7 @@ class QList : public QListSpecialMethods union { QListData p; QListData::Data *d; }; public: - inline QList() : d(const_cast(&QListData::shared_null)) { } + inline QList() Q_DECL_NOTHROW : d(const_cast(&QListData::shared_null)) { } QList(const QList &l); ~QList(); QList &operator=(const QList &l); diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h index f3322270941..8e19a531424 100644 --- a/src/corelib/tools/qregularexpression.h +++ b/src/corelib/tools/qregularexpression.h @@ -77,11 +77,11 @@ public: QRegularExpression &operator=(const QRegularExpression &re); #ifdef Q_COMPILER_RVALUE_REFS - inline QRegularExpression &operator=(QRegularExpression &&re) + QRegularExpression &operator=(QRegularExpression &&re) Q_DECL_NOTHROW { d.swap(re.d); return *this; } #endif - inline void swap(QRegularExpression &re) { d.swap(re.d); } + void swap(QRegularExpression &other) Q_DECL_NOTHROW { d.swap(other.d); } QString pattern() const; void setPattern(const QString &pattern); @@ -169,10 +169,10 @@ public: QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match); #ifdef Q_COMPILER_RVALUE_REFS - inline QRegularExpressionMatch &operator=(QRegularExpressionMatch &&match) + QRegularExpressionMatch &operator=(QRegularExpressionMatch &&match) Q_DECL_NOTHROW { d.swap(match.d); return *this; } #endif - inline void swap(QRegularExpressionMatch &match) { d.swap(match.d); } + void swap(QRegularExpressionMatch &other) Q_DECL_NOTHROW { d.swap(other.d); } QRegularExpression regularExpression() const; QRegularExpression::MatchType matchType() const; @@ -226,10 +226,10 @@ public: QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator); QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator); #ifdef Q_COMPILER_RVALUE_REFS - inline QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator) + QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator) Q_DECL_NOTHROW { d.swap(iterator.d); return *this; } #endif - void swap(QRegularExpressionMatchIterator &iterator) { d.swap(iterator.d); } + void swap(QRegularExpressionMatchIterator &other) Q_DECL_NOTHROW { d.swap(other.d); } bool isValid() const; diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 53f51b7f2e1..183b9ff2385 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -79,7 +79,7 @@ public: inline QSharedDataPointer() { d = 0; } inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } - explicit QSharedDataPointer(T *data); + explicit QSharedDataPointer(T *data) Q_DECL_NOTHROW; inline QSharedDataPointer(const QSharedDataPointer &o) : d(o.d) { if (d) d->ref.ref(); } inline QSharedDataPointer & operator=(const QSharedDataPointer &o) { if (o.d != d) { @@ -104,14 +104,14 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QSharedDataPointer(QSharedDataPointer &&o) : d(o.d) { o.d = 0; } - inline QSharedDataPointer &operator=(QSharedDataPointer &&other) + QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; } + inline QSharedDataPointer &operator=(QSharedDataPointer &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif inline bool operator!() const { return !d; } - inline void swap(QSharedDataPointer &other) + inline void swap(QSharedDataPointer &other) Q_DECL_NOTHROW { qSwap(d, other.d); } protected: @@ -155,7 +155,7 @@ public: inline QExplicitlySharedDataPointer() { d = 0; } inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; } - explicit QExplicitlySharedDataPointer(T *data); + explicit QExplicitlySharedDataPointer(T *data) Q_DECL_NOTHROW; inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer &o) : d(o.d) { if (d) d->ref.ref(); } template @@ -193,14 +193,14 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) : d(o.d) { o.d = 0; } - inline QExplicitlySharedDataPointer &operator=(QExplicitlySharedDataPointer &&other) + inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; } + inline QExplicitlySharedDataPointer &operator=(QExplicitlySharedDataPointer &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif inline bool operator!() const { return !d; } - inline void swap(QExplicitlySharedDataPointer &other) + inline void swap(QExplicitlySharedDataPointer &other) Q_DECL_NOTHROW { qSwap(d, other.d); } protected: @@ -213,7 +213,8 @@ private: }; template -Q_INLINE_TEMPLATE QSharedDataPointer::QSharedDataPointer(T *adata) : d(adata) +Q_INLINE_TEMPLATE QSharedDataPointer::QSharedDataPointer(T *adata) Q_DECL_NOTHROW + : d(adata) { if (d) d->ref.ref(); } template @@ -249,7 +250,8 @@ Q_OUTOFLINE_TEMPLATE void QExplicitlySharedDataPointer::detach_helper() } template -Q_INLINE_TEMPLATE QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(T *adata) : d(adata) +Q_INLINE_TEMPLATE QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(T *adata) Q_DECL_NOTHROW + : d(adata) { if (d) d->ref.ref(); } template @@ -273,12 +275,12 @@ namespace std { QT_BEGIN_NAMESPACE template -Q_INLINE_TEMPLATE uint qHash(const QSharedDataPointer &ptr, uint seed = 0) +Q_INLINE_TEMPLATE uint qHash(const QSharedDataPointer &ptr, uint seed = 0) Q_DECL_NOTHROW { return qHash(ptr.data(), seed); } template -Q_INLINE_TEMPLATE uint qHash(const QExplicitlySharedDataPointer &ptr, uint seed = 0) +Q_INLINE_TEMPLATE uint qHash(const QExplicitlySharedDataPointer &ptr, uint seed = 0) Q_DECL_NOTHROW { return qHash(ptr.data(), seed); } diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 4d51521b120..71d10f06632 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -210,7 +210,7 @@ class Q_CORE_EXPORT QString public: typedef QStringData Data; - inline QString(); + inline QString() Q_DECL_NOTHROW; explicit QString(const QChar *unicode, int size = -1); QString(QChar c); QString(int size, QChar c); @@ -221,11 +221,11 @@ public: QString &operator=(const QString &); inline QString &operator=(QLatin1String latin1); #ifdef Q_COMPILER_RVALUE_REFS - inline QString(QString && other) : d(other.d) { other.d = Data::sharedNull(); } - inline QString &operator=(QString &&other) + inline QString(QString && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); } + inline QString &operator=(QString &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif - inline void swap(QString &other) { qSwap(d, other.d); } + inline void swap(QString &other) Q_DECL_NOTHROW { qSwap(d, other.d); } inline int size() const { return d->size; } inline int count() const { return d->size; } inline int length() const; @@ -1040,7 +1040,7 @@ inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); } inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); } -inline QString::QString() : d(Data::sharedNull()) {} +inline QString::QString() Q_DECL_NOTHROW : d(Data::sharedNull()) {} inline QString::~QString() { if (!d->ref.deref()) Data::deallocate(d); } inline void QString::reserve(int asize) diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index 542ab781c59..f82981b9dc6 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -90,11 +90,11 @@ class QStringList : public QList { #endif public: - inline QStringList() { } + inline QStringList() Q_DECL_NOTHROW { } inline explicit QStringList(const QString &i) { append(i); } inline QStringList(const QList &l) : QList(l) { } #ifdef Q_COMPILER_RVALUE_REFS - inline QStringList(QList &&l) : QList(std::move(l)) { } + inline QStringList(QList &&l) Q_DECL_NOTHROW : QList(std::move(l)) { } #endif #ifdef Q_COMPILER_INITIALIZER_LISTS inline QStringList(std::initializer_list args) : QList(args) { } @@ -103,7 +103,7 @@ public: QStringList &operator=(const QList &other) { QList::operator=(other); return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QStringList &operator=(QList &&other) + QStringList &operator=(QList &&other) Q_DECL_NOTHROW { QList::operator=(std::move(other)); return *this; } #endif diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index ffc2316b5fa..ef0bdc57cd5 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -79,10 +79,10 @@ public: QTimeZone &operator=(const QTimeZone &other); #ifdef Q_COMPILER_RVALUE_REFS - QTimeZone &operator=(QTimeZone &&other) { swap(other); return *this; } + QTimeZone &operator=(QTimeZone &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif - void swap(QTimeZone &other) + void swap(QTimeZone &other) Q_DECL_NOTHROW { d.swap(other.d); } bool operator==(const QTimeZone &other) const; diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index c00bd07a72e..c3d65b7d51c 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -61,7 +61,7 @@ class QVector Data *d; public: - inline QVector() : d(Data::sharedNull()) { } + inline QVector() Q_DECL_NOTHROW : d(Data::sharedNull()) { } explicit QVector(int size); QVector(int size, const T &t); inline QVector(const QVector &v);