QtCore: add some more Q_DECL_NOTHROW

QtCore now builds with no -Wnoexcept warnings
(that doesn't mean there aren't tons of functions
that should be marked noexcept, just that all
conditionally noexcept functions aren't noexcept(false)
just because of a forgotten noexcept elsewhere).

Change-Id: I10dacb6b9c9d41d3595fe2f306356d62d3d91c76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2015-01-19 21:10:49 +01:00
parent 9fab24f877
commit b9365aed6a
5 changed files with 11 additions and 13 deletions

View File

@ -189,7 +189,7 @@ class Q_CORE_EXPORT QVariant
LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type
};
inline QVariant();
QVariant() Q_DECL_NOTHROW : d() {}
~QVariant();
QVariant(Type type);
QVariant(int typeId, const void *copy);
@ -520,8 +520,6 @@ inline void qVariantSetValue<QVariant>(QVariant &v, const QVariant &t)
v = t;
}
inline QVariant::QVariant() {}
inline bool QVariant::isValid() const { return d.type != Invalid; }
template<typename T>

View File

@ -985,7 +985,7 @@ static inline char qToLower(char c)
Assigns \a other to this byte array and returns a reference to
this byte array.
*/
QByteArray &QByteArray::operator=(const QByteArray & other)
QByteArray &QByteArray::operator=(const QByteArray & other) Q_DECL_NOTHROW
{
other.d->ref.ref();
if (!d->ref.deref())

View File

@ -185,14 +185,14 @@ public:
};
Q_DECLARE_FLAGS(Base64Options, Base64Option)
inline QByteArray();
inline QByteArray() Q_DECL_NOTHROW;
QByteArray(const char *, int size = -1);
QByteArray(int size, char c);
QByteArray(int size, Qt::Initialization);
inline QByteArray(const QByteArray &);
inline QByteArray(const QByteArray &) Q_DECL_NOTHROW;
inline ~QByteArray();
QByteArray &operator=(const QByteArray &);
QByteArray &operator=(const QByteArray &) Q_DECL_NOTHROW;
QByteArray &operator=(const char *str);
#ifdef Q_COMPILER_RVALUE_REFS
inline QByteArray(QByteArray && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); }
@ -466,7 +466,7 @@ public:
Q_DECLARE_OPERATORS_FOR_FLAGS(QByteArray::Base64Options)
inline QByteArray::QByteArray(): d(Data::sharedNull()) { }
inline QByteArray::QByteArray() Q_DECL_NOTHROW : d(Data::sharedNull()) { }
inline QByteArray::~QByteArray() { if (!d->ref.deref()) Data::deallocate(d); }
inline int QByteArray::size() const
{ return d->size; }
@ -496,7 +496,7 @@ inline void QByteArray::detach()
{ if (d->ref.isShared() || (d->offset != sizeof(QByteArrayData))) reallocData(uint(d->size) + 1u, d->detachFlags()); }
inline bool QByteArray::isDetached() const
{ return !d->ref.isShared(); }
inline QByteArray::QByteArray(const QByteArray &a) : d(a.d)
inline QByteArray::QByteArray(const QByteArray &a) Q_DECL_NOTHROW : d(a.d)
{ d->ref.ref(); }
inline int QByteArray::capacity() const

View File

@ -1734,7 +1734,7 @@ void QString::expand(int i)
string.
*/
QString &QString::operator=(const QString &other)
QString &QString::operator=(const QString &other) Q_DECL_NOTHROW
{
other.d->ref.ref();
if (!d->ref.deref())

View File

@ -215,10 +215,10 @@ public:
QString(QChar c);
QString(int size, QChar c);
inline QString(QLatin1String latin1);
inline QString(const QString &);
inline QString(const QString &) Q_DECL_NOTHROW;
inline ~QString();
QString &operator=(QChar c);
QString &operator=(const QString &);
QString &operator=(const QString &) Q_DECL_NOTHROW;
inline QString &operator=(QLatin1String latin1);
#ifdef Q_COMPILER_RVALUE_REFS
inline QString(QString && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); }
@ -865,7 +865,7 @@ inline QString &QString::operator=(QLatin1String s)
}
inline void QString::clear()
{ if (!isNull()) *this = QString(); }
inline QString::QString(const QString &other) : d(other.d)
inline QString::QString(const QString &other) Q_DECL_NOTHROW : d(other.d)
{ Q_ASSERT(&other != this); d->ref.ref(); }
inline int QString::capacity() const
{ return d->alloc ? d->alloc - 1 : 0; }