From d4a73d42557fab58fdab87304692062812ad5889 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 12 Aug 2020 15:53:52 +0200 Subject: [PATCH] Another round of using noexcept instead of pre-C++11 defines A few new files were added with old-school defines. Change-Id: Ieb2c71e094e55102f3f39fb9551823f36863f5f4 Reviewed-by: Laszlo Agocs --- src/corelib/thread/qexception.cpp | 14 +---- src/corelib/thread/qexception.h | 16 +----- src/corelib/tools/qhash.cpp | 2 +- src/gui/rhi/qrhi.cpp | 48 ++++++++--------- src/gui/rhi/qrhi_p.h | 52 +++++++++---------- src/gui/rhi/qshader.cpp | 12 ++--- src/gui/rhi/qshader_p.h | 24 ++++----- src/gui/rhi/qshaderdescription.cpp | 12 ++--- src/gui/rhi/qshaderdescription_p.h | 26 +++++----- src/gui/util/qshaderformat.cpp | 4 +- src/gui/util/qshaderformat_p.h | 4 +- .../tst_containerapisymmetry.cpp | 38 +++++++------- 12 files changed, 115 insertions(+), 137 deletions(-) diff --git a/src/corelib/thread/qexception.cpp b/src/corelib/thread/qexception.cpp index 2dc277523a..bc68726e50 100644 --- a/src/corelib/thread/qexception.cpp +++ b/src/corelib/thread/qexception.cpp @@ -112,12 +112,7 @@ QT_BEGIN_NAMESPACE \internal */ -QException::~QException() -#ifdef Q_COMPILER_NOEXCEPT - noexcept -#else - throw() -#endif +QException::~QException() noexcept { // must stay empty until ### Qt 6 } @@ -133,12 +128,7 @@ QException *QException::clone() const return new QException(*this); } -QUnhandledException::~QUnhandledException() -#ifdef Q_COMPILER_NOEXCEPT - noexcept -#else - throw() -#endif +QUnhandledException::~QUnhandledException() noexcept { // must stay empty until ### Qt 6 } diff --git a/src/corelib/thread/qexception.h b/src/corelib/thread/qexception.h index b117d90caf..1a21d17525 100644 --- a/src/corelib/thread/qexception.h +++ b/src/corelib/thread/qexception.h @@ -57,13 +57,7 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QException : public std::exception { public: - ~QException() -#ifdef Q_COMPILER_NOEXCEPT - noexcept -#else - throw() -#endif - ; + ~QException() noexcept; virtual void raise() const; virtual QException *clone() const; }; @@ -71,13 +65,7 @@ public: class Q_CORE_EXPORT QUnhandledException : public QException { public: - ~QUnhandledException() -#ifdef Q_COMPILER_NOEXCEPT - noexcept -#else - throw() -#endif - ; + ~QUnhandledException() noexcept; void raise() const override; QUnhandledException *clone() const override; }; diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 91e5147780..d0c94e6e60 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -393,7 +393,7 @@ static uint siphash(const uint8_t *in, uint inlen, const uint seed) # define AESHASH QT_FUNCTION_TARGET(AES) -static size_t aeshash(const uchar *p, size_t len, size_t seed) Q_DECL_NOTHROW +static size_t aeshash(const uchar *p, size_t len, size_t seed) noexcept { __m128i key; if (sizeof(size_t) == 8) { diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index 6627a459e3..76d6622eda 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -715,7 +715,7 @@ QRhiDepthStencilClearValue::QRhiDepthStencilClearValue(float d, quint32 s) \relates QRhiDepthStencilClearValue */ -bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW +bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept { return a.depthClearValue() == b.depthClearValue() && a.stencilClearValue() == b.stencilClearValue(); @@ -727,7 +727,7 @@ bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClear \relates QRhiDepthStencilClearValue */ -bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW +bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept { return !(a == b); } @@ -737,7 +737,7 @@ bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClear \relates QRhiDepthStencilClearValue */ -size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed) noexcept { return seed * (uint(qFloor(qreal(v.depthClearValue()) * 100)) + v.stencilClearValue()); } @@ -810,7 +810,7 @@ QRhiViewport::QRhiViewport(float x, float y, float w, float h, float minDepth, f \relates QRhiViewport */ -bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW +bool operator==(const QRhiViewport &a, const QRhiViewport &b) noexcept { return a.viewport() == b.viewport() && a.minDepth() == b.minDepth() @@ -823,7 +823,7 @@ bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW \relates QRhiViewport */ -bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW +bool operator!=(const QRhiViewport &a, const QRhiViewport &b) noexcept { return !(a == b); } @@ -833,7 +833,7 @@ bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW \relates QRhiViewport */ -size_t qHash(const QRhiViewport &v, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiViewport &v, size_t seed) noexcept { const std::array r = v.viewport(); return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3]) @@ -903,7 +903,7 @@ QRhiScissor::QRhiScissor(int x, int y, int w, int h) \relates QRhiScissor */ -bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW +bool operator==(const QRhiScissor &a, const QRhiScissor &b) noexcept { return a.scissor() == b.scissor(); } @@ -914,7 +914,7 @@ bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW \relates QRhiScissor */ -bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW +bool operator!=(const QRhiScissor &a, const QRhiScissor &b) noexcept { return !(a == b); } @@ -924,7 +924,7 @@ bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW \relates QRhiScissor */ -size_t qHash(const QRhiScissor &v, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiScissor &v, size_t seed) noexcept { const std::array r = v.scissor(); return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3]); @@ -1035,7 +1035,7 @@ QRhiVertexInputBinding::QRhiVertexInputBinding(quint32 stride, Classification cl \relates QRhiVertexInputBinding */ -bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW +bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept { return a.stride() == b.stride() && a.classification() == b.classification() @@ -1048,7 +1048,7 @@ bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b \relates QRhiVertexInputBinding */ -bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW +bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept { return !(a == b); } @@ -1058,7 +1058,7 @@ bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b \relates QRhiVertexInputBinding */ -size_t qHash(const QRhiVertexInputBinding &v, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiVertexInputBinding &v, size_t seed) noexcept { return seed + v.stride() + v.classification(); } @@ -1187,7 +1187,7 @@ QRhiVertexInputAttribute::QRhiVertexInputAttribute(int binding, int location, Fo \relates QRhiVertexInputAttribute */ -bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW +bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept { return a.binding() == b.binding() && a.location() == b.location() @@ -1201,7 +1201,7 @@ bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribut \relates QRhiVertexInputAttribute */ -bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW +bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept { return !(a == b); } @@ -1211,7 +1211,7 @@ bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribut \relates QRhiVertexInputAttribute */ -size_t qHash(const QRhiVertexInputAttribute &v, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiVertexInputAttribute &v, size_t seed) noexcept { return seed + uint(v.binding()) + uint(v.location()) + uint(v.format()) + v.offset(); } @@ -1251,7 +1251,7 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputAttribute &a) \relates QRhiVertexInputLayout */ -bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW +bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept { return a.m_bindings == b.m_bindings && a.m_attributes == b.m_attributes; } @@ -1262,7 +1262,7 @@ bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) \relates QRhiVertexInputLayout */ -bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW +bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept { return !(a == b); } @@ -1272,7 +1272,7 @@ bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) \relates QRhiVertexInputLayout */ -size_t qHash(const QRhiVertexInputLayout &v, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiVertexInputLayout &v, size_t seed) noexcept { return qHash(v.m_bindings, seed) + qHash(v.m_attributes, seed); } @@ -1339,7 +1339,7 @@ QRhiShaderStage::QRhiShaderStage(Type type, const QShader &shader, QShader::Vari \relates QRhiShaderStage */ -bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW +bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept { return a.type() == b.type() && a.shader() == b.shader() @@ -1352,7 +1352,7 @@ bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHR \relates QRhiShaderStage */ -bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW +bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept { return !(a == b); } @@ -1362,7 +1362,7 @@ bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHR \relates QRhiShaderStage */ -size_t qHash(const QRhiShaderStage &v, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiShaderStage &v, size_t seed) noexcept { return v.type() + qHash(v.shader(), seed) + v.shaderVariant(); } @@ -3243,7 +3243,7 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore( \relates QRhiShaderResourceBinding */ -bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW +bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept { const QRhiShaderResourceBinding::Data *da = a.data(); const QRhiShaderResourceBinding::Data *db = b.data(); @@ -3316,7 +3316,7 @@ bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind \relates QRhiShaderResourceBinding */ -bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW +bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept { return !(a == b); } @@ -3326,7 +3326,7 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind \relates QRhiShaderResourceBinding */ -size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept { const QRhiShaderResourceBinding::Data *d = b.data(); return seed + uint(d->binding) + 10 * uint(d->stage) + 100 * uint(d->type) diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index cfd770d41b..dd8ab862e4 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -92,9 +92,9 @@ private: Q_DECLARE_TYPEINFO(QRhiDepthStencilClearValue, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDepthStencilClearValue &); #endif @@ -124,9 +124,9 @@ private: Q_DECLARE_TYPEINFO(QRhiViewport, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiViewport &v, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiViewport &a, const QRhiViewport &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiViewport &a, const QRhiViewport &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiViewport &v, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiViewport &); #endif @@ -148,9 +148,9 @@ private: Q_DECLARE_TYPEINFO(QRhiScissor, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiScissor &v, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiScissor &a, const QRhiScissor &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiScissor &a, const QRhiScissor &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiScissor &v, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiScissor &); #endif @@ -183,9 +183,9 @@ private: Q_DECLARE_TYPEINFO(QRhiVertexInputBinding, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiVertexInputBinding &v, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiVertexInputBinding &v, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputBinding &); #endif @@ -231,9 +231,9 @@ private: Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiVertexInputAttribute &v, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiVertexInputAttribute &v, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputAttribute &); #endif @@ -268,16 +268,16 @@ private: QVarLengthArray m_bindings; QVarLengthArray m_attributes; - friend Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW; - friend Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed) Q_DECL_NOTHROW; + friend Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept; + friend Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed) noexcept; friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &); }; Q_DECLARE_TYPEINFO(QRhiVertexInputLayout, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &); #endif @@ -312,9 +312,9 @@ private: Q_DECLARE_TYPEINFO(QRhiShaderStage, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiShaderStage &s, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiShaderStage &s, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderStage &); #endif @@ -413,9 +413,9 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBinding::StageFlags) Q_DECLARE_TYPEINFO(QRhiShaderResourceBinding, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QRhiShaderResourceBinding &b, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept; +Q_GUI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept; +Q_GUI_EXPORT size_t qHash(const QRhiShaderResourceBinding &b, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBinding &); #endif diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index f3814515cd..685fc84301 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -512,7 +512,7 @@ QShaderKey::QShaderKey(QShader::Source s, \relates QShader */ -bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW +bool operator==(const QShader &lhs, const QShader &rhs) noexcept { return lhs.d->stage == rhs.d->stage && lhs.d->shaders == rhs.d->shaders; @@ -533,7 +533,7 @@ bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW \relates QShader */ -size_t qHash(const QShader &s, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QShader &s, size_t seed) noexcept { QtPrivate::QHashCombine hash; seed = hash(seed, s.stage()); @@ -549,7 +549,7 @@ size_t qHash(const QShader &s, size_t seed) Q_DECL_NOTHROW \relates QShaderVersion */ -bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept { return lhs.version() == rhs.version() && lhs.flags() == rhs.flags(); } @@ -568,7 +568,7 @@ bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOT \relates QShaderKey */ -bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept { return lhs.source() == rhs.source() && lhs.sourceVersion() == rhs.sourceVersion() && lhs.sourceVariant() == rhs.sourceVariant(); @@ -588,7 +588,7 @@ bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW \relates QShaderKey */ -size_t qHash(const QShaderKey &k, size_t seed) Q_DECL_NOTHROW +size_t qHash(const QShaderKey &k, size_t seed) noexcept { return qHashMulti(seed, k.source(), @@ -602,7 +602,7 @@ size_t qHash(const QShaderKey &k, size_t seed) Q_DECL_NOTHROW \relates QShaderCode */ -bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept { return lhs.shader() == rhs.shader() && lhs.entryPoint() == rhs.entryPoint(); } diff --git a/src/gui/rhi/qshader_p.h b/src/gui/rhi/qshader_p.h index 7243042a96..689d92b91d 100644 --- a/src/gui/rhi/qshader_p.h +++ b/src/gui/rhi/qshader_p.h @@ -162,8 +162,8 @@ public: private: QShaderPrivate *d; friend struct QShaderPrivate; - friend Q_GUI_EXPORT bool operator==(const QShader &, const QShader &) Q_DECL_NOTHROW; - friend Q_GUI_EXPORT size_t qHash(const QShader &, size_t) Q_DECL_NOTHROW; + friend Q_GUI_EXPORT bool operator==(const QShader &, const QShader &) noexcept; + friend Q_GUI_EXPORT size_t qHash(const QShader &, size_t) noexcept; #ifndef QT_NO_DEBUG_STREAM friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &); #endif @@ -194,34 +194,34 @@ private: Q_DECLARE_TYPEINFO(QShaderKey, Q_MOVABLE_TYPE); -Q_GUI_EXPORT bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT size_t qHash(const QShader &s, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QShader &lhs, const QShader &rhs) noexcept; +Q_GUI_EXPORT size_t qHash(const QShader &s, size_t seed = 0) noexcept; -inline bool operator!=(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShader &lhs, const QShader &rhs) noexcept { return !(lhs == rhs); } -Q_GUI_EXPORT bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept; +Q_GUI_EXPORT bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept; +Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept; -inline bool operator!=(const QShaderVersion &lhs, const QShaderVersion &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept { return !(lhs == rhs); } -inline bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs) noexcept { return !(lhs == rhs); } -inline bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs) noexcept { return !(lhs == rhs); } -Q_GUI_EXPORT size_t qHash(const QShaderKey &k, size_t seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT size_t qHash(const QShaderKey &k, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &); diff --git a/src/gui/rhi/qshaderdescription.cpp b/src/gui/rhi/qshaderdescription.cpp index 2a999ebf4e..b20ed8b178 100644 --- a/src/gui/rhi/qshaderdescription.cpp +++ b/src/gui/rhi/qshaderdescription.cpp @@ -1223,7 +1223,7 @@ void QShaderDescriptionPrivate::loadFromStream(QDataStream *stream, int version) \relates QShaderDescription */ -bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept { if (lhs.d == rhs.d) return true; @@ -1244,7 +1244,7 @@ bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_ \relates QShaderDescription::InOutVariable */ -bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) noexcept { return lhs.name == rhs.name && lhs.type == rhs.type @@ -1262,7 +1262,7 @@ bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescr \relates QShaderDescription::BlockVariable */ -bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) noexcept { return lhs.name == rhs.name && lhs.type == rhs.type @@ -1281,7 +1281,7 @@ bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescr \relates QShaderDescription::UniformBlock */ -bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) noexcept { return lhs.blockName == rhs.blockName && lhs.structName == rhs.structName @@ -1297,7 +1297,7 @@ bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescri \relates QShaderDescription::PushConstantBlock */ -bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) noexcept { return lhs.name == rhs.name && lhs.size == rhs.size @@ -1310,7 +1310,7 @@ bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderD \relates QShaderDescription::StorageBlock */ -bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW +bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) noexcept { return lhs.blockName == rhs.blockName && lhs.instanceName == rhs.instanceName diff --git a/src/gui/rhi/qshaderdescription_p.h b/src/gui/rhi/qshaderdescription_p.h index a4fef06a9c..238efc2455 100644 --- a/src/gui/rhi/qshaderdescription_p.h +++ b/src/gui/rhi/qshaderdescription_p.h @@ -265,7 +265,7 @@ private: #ifndef QT_NO_DEBUG_STREAM friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &); #endif - friend Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW; + friend Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::ImageFlags) @@ -279,39 +279,39 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::PushConstantBlo Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription::StorageBlock &); #endif -Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW; -Q_GUI_EXPORT bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW; +Q_GUI_EXPORT bool operator==(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept; +Q_GUI_EXPORT bool operator==(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) noexcept; +Q_GUI_EXPORT bool operator==(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) noexcept; +Q_GUI_EXPORT bool operator==(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) noexcept; +Q_GUI_EXPORT bool operator==(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) noexcept; +Q_GUI_EXPORT bool operator==(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) noexcept; -inline bool operator!=(const QShaderDescription &lhs, const QShaderDescription &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderDescription &lhs, const QShaderDescription &rhs) noexcept { return !(lhs == rhs); } -inline bool operator!=(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderDescription::InOutVariable &lhs, const QShaderDescription::InOutVariable &rhs) noexcept { return !(lhs == rhs); } -inline bool operator!=(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderDescription::BlockVariable &lhs, const QShaderDescription::BlockVariable &rhs) noexcept { return !(lhs == rhs); } -inline bool operator!=(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderDescription::UniformBlock &lhs, const QShaderDescription::UniformBlock &rhs) noexcept { return !(lhs == rhs); } -inline bool operator!=(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderDescription::PushConstantBlock &lhs, const QShaderDescription::PushConstantBlock &rhs) noexcept { return !(lhs == rhs); } -inline bool operator!=(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QShaderDescription::StorageBlock &lhs, const QShaderDescription::StorageBlock &rhs) noexcept { return !(lhs == rhs); } diff --git a/src/gui/util/qshaderformat.cpp b/src/gui/util/qshaderformat.cpp index ea86dd6ca5..d56dfc413e 100644 --- a/src/gui/util/qshaderformat.cpp +++ b/src/gui/util/qshaderformat.cpp @@ -123,12 +123,12 @@ bool QShaderFormat::supports(const QShaderFormat &other) const noexcept return true; } -QShaderFormat::ShaderType QShaderFormat::shaderType() const Q_DECL_NOTHROW +QShaderFormat::ShaderType QShaderFormat::shaderType() const noexcept { return m_shaderType; } -void QShaderFormat::setShaderType(QShaderFormat::ShaderType shaderType) Q_DECL_NOTHROW +void QShaderFormat::setShaderType(QShaderFormat::ShaderType shaderType) noexcept { m_shaderType = shaderType; } diff --git a/src/gui/util/qshaderformat_p.h b/src/gui/util/qshaderformat_p.h index d9d0378f63..3559c67414 100644 --- a/src/gui/util/qshaderformat_p.h +++ b/src/gui/util/qshaderformat_p.h @@ -96,8 +96,8 @@ public: Q_GUI_EXPORT bool isValid() const noexcept; Q_GUI_EXPORT bool supports(const QShaderFormat &other) const noexcept; - Q_GUI_EXPORT ShaderType shaderType() const Q_DECL_NOTHROW; - Q_GUI_EXPORT void setShaderType(ShaderType shaderType) Q_DECL_NOTHROW; + Q_GUI_EXPORT ShaderType shaderType() const noexcept; + Q_GUI_EXPORT void setShaderType(ShaderType shaderType) noexcept; private: Api m_api; diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp index a7fa5094c5..733d8432bb 100644 --- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp +++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp @@ -64,7 +64,7 @@ struct Movable { - explicit Movable(int i = 0) Q_DECL_NOTHROW + explicit Movable(int i = 0) noexcept : i(i) { ++instanceCount; @@ -86,11 +86,11 @@ struct Movable }; int Movable::instanceCount = 0; -bool operator==(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i == rhs.i; } -bool operator!=(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i != rhs.i; } -bool operator<(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i < rhs.i; } +bool operator==(Movable lhs, Movable rhs) noexcept { return lhs.i == rhs.i; } +bool operator!=(Movable lhs, Movable rhs) noexcept { return lhs.i != rhs.i; } +bool operator<(Movable lhs, Movable rhs) noexcept { return lhs.i < rhs.i; } -size_t qHash(Movable m, size_t seed = 0) Q_DECL_NOTHROW { return qHash(m.i, seed); } +size_t qHash(Movable m, size_t seed = 0) noexcept { return qHash(m.i, seed); } QDebug &operator<<(QDebug &d, Movable m) { const QDebugStateSaver saver(d); @@ -103,7 +103,7 @@ QT_END_NAMESPACE struct Complex { - explicit Complex(int i = 0) Q_DECL_NOTHROW + explicit Complex(int i = 0) noexcept : i(i) { ++instanceCount; @@ -125,11 +125,11 @@ struct Complex }; int Complex::instanceCount = 0; -bool operator==(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i == rhs.i; } -bool operator!=(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i != rhs.i; } -bool operator<(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i < rhs.i; } +bool operator==(Complex lhs, Complex rhs) noexcept { return lhs.i == rhs.i; } +bool operator!=(Complex lhs, Complex rhs) noexcept { return lhs.i != rhs.i; } +bool operator<(Complex lhs, Complex rhs) noexcept { return lhs.i < rhs.i; } -size_t qHash(Complex c, size_t seed = 0) Q_DECL_NOTHROW { return qHash(c.i, seed); } +size_t qHash(Complex c, size_t seed = 0) noexcept { return qHash(c.i, seed); } QDebug &operator<<(QDebug &d, Complex c) { const QDebugStateSaver saver(d); @@ -139,7 +139,7 @@ QDebug &operator<<(QDebug &d, Complex c) struct DuplicateStrategyTestType { - explicit DuplicateStrategyTestType(int i = 0) Q_DECL_NOTHROW + explicit DuplicateStrategyTestType(int i = 0) noexcept : i(i), j(++counter) { @@ -155,27 +155,27 @@ int DuplicateStrategyTestType::counter = 0; // only look at the i member, not j. j allows us to identify which instance // gets inserted in containers that don't allow for duplicates -bool operator==(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +bool operator==(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) noexcept { return lhs.i == rhs.i; } -bool operator!=(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +bool operator!=(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) noexcept { return lhs.i != rhs.i; } -bool operator<(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +bool operator<(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) noexcept { return lhs.i < rhs.i; } -size_t qHash(DuplicateStrategyTestType c, size_t seed = 0) Q_DECL_NOTHROW +size_t qHash(DuplicateStrategyTestType c, size_t seed = 0) noexcept { return qHash(c.i, seed); } -bool reallyEqual(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_DECL_NOTHROW +bool reallyEqual(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) noexcept { return lhs.i == rhs.i && lhs.j == rhs.j; } @@ -191,7 +191,7 @@ namespace std { template<> struct hash { - std::size_t operator()(Movable m) const Q_DECL_NOTHROW + std::size_t operator()(Movable m) const noexcept { return hash()(m.i); } @@ -200,7 +200,7 @@ struct hash template<> struct hash { - std::size_t operator()(Complex m) const Q_DECL_NOTHROW + std::size_t operator()(Complex m) const noexcept { return hash()(m.i); } @@ -209,7 +209,7 @@ struct hash template<> struct hash { - std::size_t operator()(DuplicateStrategyTestType m) const Q_DECL_NOTHROW + std::size_t operator()(DuplicateStrategyTestType m) const noexcept { return hash()(m.i); }