From 95f787bfdc890c259e8b347bdad9123d534efe0f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 9 Apr 2019 13:33:15 +0200 Subject: Replace Q_DECL_NOTHROW with noexcept the remaining places The first replacement had missed objective-C++ code some places ourside the src dir. In C-files Q_DECL_NOTHROW is replaced with Q_DECL_NOEXCEPT as we still need to turn it off when compiled in C mode, but can get rid of the old NOTHROW moniker. Change-Id: I6370f57066679c5120d0265a69e7e378e09d4759 Reviewed-by: Thiago Macieira --- .../qtconcurrentmap/tst_qtconcurrentmap.cpp | 20 ++++++++++---------- .../qtconcurrentrun/tst_qtconcurrentrun.cpp | 16 ++++++++-------- tests/auto/corelib/global/qglobal/qglobal.c | 2 +- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 22 +++++++++++----------- tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 2 +- .../serialization/qxmlstream/tst_qxmlstream.cpp | 2 +- .../auto/testlib/selftests/cmptest/tst_cmptest.cpp | 2 +- .../widgets/kernel/qformlayout/tst_qformlayout.cpp | 8 ++++---- 8 files changed, 37 insertions(+), 37 deletions(-) (limited to 'tests') diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp index 9b71994b84..b5486307a7 100644 --- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -2021,12 +2021,12 @@ int fn(int &i) return i; } -int fnConstNoExcept(const int &i) Q_DECL_NOTHROW +int fnConstNoExcept(const int &i) noexcept { return i; } -int fnNoExcept(int &i) Q_DECL_NOTHROW +int fnNoExcept(int &i) noexcept { return i; } @@ -2041,12 +2041,12 @@ QString changeType(int &) return QString(); } -QString changeTypeConstNoExcept(const int &) Q_DECL_NOTHROW +QString changeTypeConstNoExcept(const int &) noexcept { return QString(); } -QString changeTypeNoExcept(int &) Q_DECL_NOTHROW +QString changeTypeNoExcept(int &) noexcept { return QString(); } @@ -2061,12 +2061,12 @@ int changeTypeQStringList(QStringList &) return 0; } -int changeTypeQStringListConstNoExcept(const QStringList &) Q_DECL_NOTHROW +int changeTypeQStringListConstNoExcept(const QStringList &) noexcept { return 0; } -int changeTypeQStringListNoExcept(QStringList &) Q_DECL_NOTHROW +int changeTypeQStringListNoExcept(QStringList &) noexcept { return 0; } @@ -2096,22 +2096,22 @@ public: return QString(); } - MemFnTester fnNoExcept() Q_DECL_NOTHROW + MemFnTester fnNoExcept() noexcept { return MemFnTester(); } - MemFnTester fnConstNoExcept() const Q_DECL_NOTHROW + MemFnTester fnConstNoExcept() const noexcept { return MemFnTester(); } - QString changeTypeNoExcept() Q_DECL_NOTHROW + QString changeTypeNoExcept() noexcept { return QString(); } - QString changeTypeConstNoExcept() const Q_DECL_NOTHROW + QString changeTypeConstNoExcept() const noexcept { return QString(); } diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp index 9b5bb85fff..8506d18dae 100644 --- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -122,23 +122,23 @@ public: class ANoExcept { public: - int member0() Q_DECL_NOTHROW { return 10; } - int member1(int in) Q_DECL_NOTHROW { return in; } + int member0() noexcept { return 10; } + int member1(int in) noexcept { return in; } typedef int result_type; - int operator()() Q_DECL_NOTHROW { return 10; } - int operator()(int in) Q_DECL_NOTHROW { return in; } + int operator()() noexcept { return 10; } + int operator()(int in) noexcept { return in; } }; class AConstNoExcept { public: - int member0() const Q_DECL_NOTHROW { return 10; } - int member1(int in) const Q_DECL_NOTHROW { return in; } + int member0() const noexcept { return 10; } + int member1(int in) const noexcept { return in; } typedef int result_type; - int operator()() const Q_DECL_NOTHROW { return 10; } - int operator()(int in) const Q_DECL_NOTHROW { return in; } + int operator()() const noexcept { return 10; } + int operator()(int in) const noexcept { return in; } }; void tst_QtConcurrentRun::returnValue() diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c index 0719c4b921..c7124454d0 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.c +++ b/tests/auto/corelib/global/qglobal/qglobal.c @@ -85,7 +85,7 @@ int tst_QtVersion() return QT_VERSION; } -const char *tst_qVersion() Q_DECL_NOTHROW +const char *tst_qVersion() Q_DECL_NOEXCEPT { #if !defined(QT_NAMESPACE) return qVersion(); diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 4a27b5bffe..e0394a5d25 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -4794,13 +4794,13 @@ class LotsOfSignalsAndSlots: public QObject public slots: void slot_v() {} - void slot_v_noexcept() Q_DECL_NOTHROW {} + void slot_v_noexcept() noexcept {} void slot_vi(int) {} - void slot_vi_noexcept() Q_DECL_NOTHROW {} + void slot_vi_noexcept() noexcept {} void slot_vii(int, int) {} void slot_viii(int, int, int) {} int slot_i() { return 0; } - int slot_i_noexcept() Q_DECL_NOTHROW { return 0; } + int slot_i_noexcept() noexcept { return 0; } int slot_ii(int) { return 0; } int slot_iii(int, int) { return 0; } int slot_iiii(int, int, int) { return 0; } @@ -4814,18 +4814,18 @@ class LotsOfSignalsAndSlots: public QObject void slot_vPFvvE(fptr) {} void const_slot_v() const {}; - void const_slot_v_noexcept() const Q_DECL_NOTHROW {} + void const_slot_v_noexcept() const noexcept {} void const_slot_vi(int) const {}; - void const_slot_vi_noexcept(int) const Q_DECL_NOTHROW {} + void const_slot_vi_noexcept(int) const noexcept {} static void static_slot_v() {} - static void static_slot_v_noexcept() Q_DECL_NOTHROW {} + static void static_slot_v_noexcept() noexcept {} static void static_slot_vi(int) {} - static void static_slot_vi_noexcept(int) Q_DECL_NOTHROW {} + static void static_slot_vi_noexcept(int) noexcept {} static void static_slot_vii(int, int) {} static void static_slot_viii(int, int, int) {} static int static_slot_i() { return 0; } - static int static_slot_i_noexcept() Q_DECL_NOTHROW { return 0; } + static int static_slot_i_noexcept() noexcept { return 0; } static int static_slot_ii(int) { return 0; } static int static_slot_iii(int, int) { return 0; } static int static_slot_iiii(int, int, int) { return 0; } @@ -4988,11 +4988,11 @@ void tst_QObject::connectCxx0xTypeMatching() } -void receiverFunction_noexcept() Q_DECL_NOTHROW {} -struct Functor_noexcept { void operator()() Q_DECL_NOTHROW {} }; +void receiverFunction_noexcept() noexcept {} +struct Functor_noexcept { void operator()() noexcept {} }; void tst_QObject::connectCxx17Noexcept() { - // this is about connecting signals to slots with the Q_DECL_NOTHROW qualifier + // this is about connecting signals to slots with the noexcept qualifier // as semantics changed due to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html typedef LotsOfSignalsAndSlots Foo; Foo obj; diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index d06059bbe5..b7c87418c7 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -773,7 +773,7 @@ public: quitEventLoop_noexcept(); } - static void quitEventLoop_noexcept() Q_DECL_NOTHROW + static void quitEventLoop_noexcept() noexcept { QVERIFY(!_e.isNull()); _e->quit(); diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index 8fdf91b090..e4d50607b7 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -253,7 +253,7 @@ public: qFatal("%s: aId must not be an empty string", Q_FUNC_INFO); } - void swap(MissedBaseline &other) Q_DECL_NOTHROW + void swap(MissedBaseline &other) noexcept { qSwap(id, other.id); qSwap(expected, other.expected); diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 8e2c7694a5..467c53088e 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -256,7 +256,7 @@ void tst_Cmptest::compare_boolfuncs() namespace { template -T *null() Q_DECL_NOTHROW { return nullptr; } +T *null() noexcept { return nullptr; } } void tst_Cmptest::compare_to_nullptr() diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index cff3dad35e..ab32643061 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -52,7 +52,7 @@ using namespace QTestPrivate; Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3); struct QFormLayoutTakeRowResultHolder { - QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) Q_DECL_NOTHROW + QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) noexcept : labelItem(result.labelItem), fieldItem(result.fieldItem) { @@ -66,20 +66,20 @@ struct QFormLayoutTakeRowResultHolder { if (fieldItem) disposer.setItem(0, QFormLayout::FieldRole, fieldItem); } - QFormLayoutTakeRowResultHolder(QFormLayoutTakeRowResultHolder &&other) Q_DECL_NOTHROW + QFormLayoutTakeRowResultHolder(QFormLayoutTakeRowResultHolder &&other) noexcept : labelItem(other.labelItem), fieldItem(other.fieldItem) { other.labelItem = nullptr; other.fieldItem = nullptr; } - QFormLayoutTakeRowResultHolder &operator=(QFormLayoutTakeRowResultHolder &&other) Q_DECL_NOTHROW + QFormLayoutTakeRowResultHolder &operator=(QFormLayoutTakeRowResultHolder &&other) noexcept { swap(other); return *this; } - void swap(QFormLayoutTakeRowResultHolder &other) Q_DECL_NOTHROW + void swap(QFormLayoutTakeRowResultHolder &other) noexcept { qSwap(labelItem, other.labelItem); qSwap(fieldItem, other.fieldItem); -- cgit v1.2.3