From dbf7706413bb8d624ac17b24398eaf4ef542ed6b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 2 Apr 2019 10:59:52 +0200 Subject: Replace Q_DECL_NOEXCEPT with noexcept in QtGui Change-Id: I43803b88fea8083782d73ce157c466b022208740 Reviewed-by: Thiago Macieira --- src/gui/text/qfont.cpp | 2 +- src/gui/text/qfont.h | 4 ++-- src/gui/text/qfont_p.h | 2 +- src/gui/text/qfontdatabase.cpp | 6 +++--- src/gui/text/qfontengine_p.h | 18 +++++++++--------- src/gui/text/qfontmetrics.h | 4 ++-- src/gui/text/qglyphrun.h | 4 ++-- src/gui/text/qrawfont.cpp | 2 +- src/gui/text/qrawfont.h | 6 +++--- src/gui/text/qstatictext.h | 4 ++-- src/gui/text/qtextcursor.h | 4 ++-- src/gui/text/qtextengine_p.h | 4 ++-- src/gui/text/qtextobject.cpp | 4 ++-- src/gui/text/qtextobject.h | 8 ++++---- src/gui/text/qzipreader_p.h | 4 ++-- 15 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index d54fa22990..164a2f60ab 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2083,7 +2083,7 @@ QString QFont::toString() const \relates QFont \since 5.3 */ -uint qHash(const QFont &font, uint seed) Q_DECL_NOTHROW +uint qHash(const QFont &font, uint seed) noexcept { return qHash(QFontPrivate::get(font)->request, seed); } diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 35ef798275..16685ed9e8 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -262,7 +262,7 @@ public: operator QVariant() const; bool isCopyOf(const QFont &) const; #ifdef Q_COMPILER_RVALUE_REFS - inline QFont &operator=(QFont &&other) Q_DECL_NOEXCEPT + inline QFont &operator=(QFont &&other) noexcept { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; } #endif @@ -347,7 +347,7 @@ private: Q_DECLARE_SHARED(QFont) -Q_GUI_EXPORT uint qHash(const QFont &font, uint seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT uint qHash(const QFont &font, uint seed = 0) noexcept; inline bool QFont::bold() const { return weight() > Medium; } diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 6156faa788..db74ab0b65 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -136,7 +136,7 @@ struct QFontDef } }; -inline uint qHash(const QFontDef &fd, uint seed = 0) Q_DECL_NOTHROW +inline uint qHash(const QFontDef &fd, uint seed = 0) noexcept { return qHash(qRound64(fd.pixelSize*10000)) // use only 4 fractional digits ^ qHash(fd.weight) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index a307539800..ee37a84f5f 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -434,7 +434,7 @@ struct FallbacksCacheKey { QChar::Script script; }; -inline bool operator==(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) Q_DECL_NOTHROW +inline bool operator==(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) noexcept { return lhs.script == rhs.script && lhs.styleHint == rhs.styleHint && @@ -442,12 +442,12 @@ inline bool operator==(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rh lhs.family == rhs.family; } -inline bool operator!=(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) Q_DECL_NOTHROW +inline bool operator!=(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) noexcept { return !operator==(lhs, rhs); } -inline uint qHash(const FallbacksCacheKey &key, uint seed = 0) Q_DECL_NOTHROW +inline uint qHash(const FallbacksCacheKey &key, uint seed = 0) noexcept { QtPrivate::QHashCombine hash; seed = hash(seed, key.family); diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 05c6746185..b922d50b4c 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -292,33 +292,33 @@ public: Holder() : ptr(nullptr), destroy_func(nullptr) {} explicit Holder(void *p, qt_destroy_func_t d) : ptr(p), destroy_func(d) {} ~Holder() { if (ptr && destroy_func) destroy_func(ptr); } - Holder(Holder &&other) Q_DECL_NOTHROW + Holder(Holder &&other) noexcept : ptr(other.ptr), destroy_func(other.destroy_func) { other.ptr = nullptr; other.destroy_func = nullptr; } - Holder &operator=(Holder &&other) Q_DECL_NOTHROW + Holder &operator=(Holder &&other) noexcept { swap(other); return *this; } - void swap(Holder &other) Q_DECL_NOTHROW + void swap(Holder &other) noexcept { qSwap(ptr, other.ptr); qSwap(destroy_func, other.destroy_func); } - void *get() const Q_DECL_NOTHROW { return ptr; } - void *release() Q_DECL_NOTHROW { + void *get() const noexcept { return ptr; } + void *release() noexcept { void *result = ptr; ptr = nullptr; destroy_func = nullptr; return result; } - void reset() Q_DECL_NOTHROW { Holder().swap(*this); } - qt_destroy_func_t get_deleter() const Q_DECL_NOTHROW { return destroy_func; } + void reset() noexcept { Holder().swap(*this); } + qt_destroy_func_t get_deleter() const noexcept { return destroy_func; } - bool operator!() const Q_DECL_NOTHROW { return !ptr; } + bool operator!() const noexcept { return !ptr; } }; mutable Holder font_; // \ NOTE: Declared before m_glyphCaches, so font_, face_ @@ -390,7 +390,7 @@ inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId } inline uint qHash(const QFontEngine::FaceId &f, uint seed = 0) - Q_DECL_NOEXCEPT_EXPR(noexcept(qHash(f.filename))) + noexcept(noexcept(qHash(f.filename))) { QtPrivate::QHashCombine hash; seed = hash(seed, f.filename); diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index 61931fa9bc..761cadde47 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -77,11 +77,11 @@ public: QFontMetrics &operator=(const QFontMetrics &); #ifdef Q_COMPILER_RVALUE_REFS - inline QFontMetrics &operator=(QFontMetrics &&other) Q_DECL_NOEXCEPT + inline QFontMetrics &operator=(QFontMetrics &&other) noexcept { qSwap(d, other.d); return *this; } #endif - void swap(QFontMetrics &other) Q_DECL_NOEXCEPT + void swap(QFontMetrics &other) noexcept { qSwap(d, other.d); } int ascent() const; diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index 6182c4f749..9bb1d3c820 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -67,12 +67,12 @@ public: QGlyphRun(); QGlyphRun(const QGlyphRun &other); #ifdef Q_COMPILER_RVALUE_REFS - QGlyphRun &operator=(QGlyphRun &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QGlyphRun &operator=(QGlyphRun &&other) noexcept { swap(other); return *this; } #endif QGlyphRun &operator=(const QGlyphRun &other); ~QGlyphRun(); - void swap(QGlyphRun &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QGlyphRun &other) noexcept { qSwap(d, other.d); } QRawFont rawFont() const; void setRawFont(const QRawFont &rawFont); diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index b2d8bf01af..a060448924 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -322,7 +322,7 @@ bool QRawFont::operator==(const QRawFont &other) const \relates QRawFont \since 5.8 */ -uint qHash(const QRawFont &font, uint seed) Q_DECL_NOTHROW +uint qHash(const QRawFont &font, uint seed) noexcept { return qHash(QRawFontPrivate::get(font)->fontEngine, seed); } diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index 470f2694e4..3b84f642d3 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -80,12 +80,12 @@ public: QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); QRawFont(const QRawFont &other); #ifdef Q_COMPILER_RVALUE_REFS - QRawFont &operator=(QRawFont &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QRawFont &operator=(QRawFont &&other) noexcept { swap(other); return *this; } #endif QRawFont &operator=(const QRawFont &other); ~QRawFont(); - void swap(QRawFont &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QRawFont &other) noexcept { qSwap(d, other.d); } bool isValid() const; @@ -158,7 +158,7 @@ Q_DECLARE_SHARED(QRawFont) Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags) -Q_GUI_EXPORT uint qHash(const QRawFont &font, uint seed = 0) Q_DECL_NOTHROW; +Q_GUI_EXPORT uint qHash(const QRawFont &font, uint seed = 0) noexcept; inline QVector QRawFont::advancesForGlyphIndexes(const QVector &glyphIndexes, QRawFont::LayoutFlags layoutFlags) const { diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h index ada0456b8f..c6a0d158c1 100644 --- a/src/gui/text/qstatictext.h +++ b/src/gui/text/qstatictext.h @@ -65,12 +65,12 @@ public: explicit QStaticText(const QString &text); QStaticText(const QStaticText &other); #ifdef Q_COMPILER_RVALUE_REFS - QStaticText &operator=(QStaticText &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QStaticText &operator=(QStaticText &&other) noexcept { swap(other); return *this; } #endif QStaticText &operator=(const QStaticText &); ~QStaticText(); - void swap(QStaticText &other) Q_DECL_NOTHROW { qSwap(data, other.data); } + void swap(QStaticText &other) noexcept { qSwap(data, other.data); } void setText(const QString &text); QString text() const; diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h index 1a00b753ad..4a9c614887 100644 --- a/src/gui/text/qtextcursor.h +++ b/src/gui/text/qtextcursor.h @@ -74,12 +74,12 @@ public: explicit QTextCursor(const QTextBlock &block); QTextCursor(const QTextCursor &cursor); #ifdef Q_COMPILER_RVALUE_REFS - QTextCursor &operator=(QTextCursor &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QTextCursor &operator=(QTextCursor &&other) noexcept { swap(other); return *this; } #endif QTextCursor &operator=(const QTextCursor &other); ~QTextCursor(); - void swap(QTextCursor &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QTextCursor &other) noexcept { qSwap(d, other.d); } bool isNull() const; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index fb2e812183..fddda7f2f8 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -335,7 +335,7 @@ public: struct QScriptItem { - Q_DECL_CONSTEXPR QScriptItem(int p, QScriptAnalysis a) Q_DECL_NOTHROW + Q_DECL_CONSTEXPR QScriptItem(int p, QScriptAnalysis a) noexcept : position(p), analysis(a), num_glyphs(0), descent(-1), ascent(-1), leading(-1), width(-1), glyph_data_offset(0) {} @@ -348,7 +348,7 @@ struct QScriptItem QFixed leading; QFixed width; int glyph_data_offset; - Q_DECL_CONSTEXPR QFixed height() const Q_DECL_NOTHROW { return ascent + descent; } + Q_DECL_CONSTEXPR QFixed height() const noexcept { return ascent + descent; } private: friend class QVector; QScriptItem() {}; // for QVector, don't use diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 18c5a4f3dd..9156ee6af4 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -678,7 +678,7 @@ QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end) /*! Copy constructor. Constructs a copy of the \a other iterator. */ -QTextFrame::iterator::iterator(const iterator &other) Q_DECL_NOTHROW +QTextFrame::iterator::iterator(const iterator &other) noexcept { f = other.f; b = other.b; @@ -691,7 +691,7 @@ QTextFrame::iterator::iterator(const iterator &other) Q_DECL_NOTHROW Assigns \a other to this iterator and returns a reference to this iterator. */ -QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) Q_DECL_NOTHROW +QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) noexcept { f = other.f; b = other.b; diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 067f8473ea..586a593dd2 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -151,11 +151,11 @@ public: public: iterator(); // ### Qt 6: inline #if QT_VERSION < QT_VERSION_CHECK(6,0,0) - iterator(const iterator &o) Q_DECL_NOTHROW; // = default - iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default - iterator(iterator &&other) Q_DECL_NOTHROW // = default + iterator(const iterator &o) noexcept; // = default + iterator &operator=(const iterator &o) noexcept; // = default + iterator(iterator &&other) noexcept // = default { memcpy(static_cast(this), static_cast(&other), sizeof(iterator)); } - iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default + iterator &operator=(iterator &&other) noexcept // = default { memcpy(static_cast(this), static_cast(&other), sizeof(iterator)); return *this; } #endif diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h index 378072b366..6fec8d7719 100644 --- a/src/gui/text/qzipreader_p.h +++ b/src/gui/text/qzipreader_p.h @@ -79,11 +79,11 @@ public: struct FileInfo { - FileInfo() Q_DECL_NOTHROW + FileInfo() noexcept : isDir(false), isFile(false), isSymLink(false), crc(0), size(0) {} - bool isValid() const Q_DECL_NOTHROW { return isDir || isFile || isSymLink; } + bool isValid() const noexcept { return isDir || isFile || isSymLink; } QString filePath; uint isDir : 1; -- cgit v1.2.3