From 390b16aea85e64bc33ce91e37898f59ad8a994c7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 8 Jan 2015 15:08:22 +0100 Subject: 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/itemmodels/qabstractitemmodel.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/corelib/itemmodels/qabstractitemmodel.h') diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index a49cf160cc..75c2009fe4 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); } -- cgit v1.2.3