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 <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2019-04-09 13:33:15 +02:00
parent 434c866e1b
commit 95f787bfdc
13 changed files with 70 additions and 70 deletions

View File

@ -429,7 +429,7 @@ class ProFunctionDef {
public:
ProFunctionDef(ProFile *pro, int offset) : m_pro(pro), m_offset(offset) { m_pro->ref(); }
ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); }
ProFunctionDef(ProFunctionDef &&other) Q_DECL_NOTHROW
ProFunctionDef(ProFunctionDef &&other) noexcept
: m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; }
~ProFunctionDef() { m_pro->deref(); }
ProFunctionDef &operator=(const ProFunctionDef &o)
@ -442,13 +442,13 @@ public:
}
return *this;
}
ProFunctionDef &operator=(ProFunctionDef &&other) Q_DECL_NOTHROW
ProFunctionDef &operator=(ProFunctionDef &&other) noexcept
{
ProFunctionDef moved(std::move(other));
swap(moved);
return *this;
}
void swap(ProFunctionDef &other) Q_DECL_NOTHROW
void swap(ProFunctionDef &other) noexcept
{
qSwap(m_pro, other.m_pro);
qSwap(m_offset, other.m_offset);

View File

@ -54,7 +54,7 @@ extern "C" {
#endif
QT_FUNCTION_TARGET(F16C)
void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOEXCEPT
{
qsizetype i = 0;
int epilog_i;
@ -70,7 +70,7 @@ void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_N
}
QT_FUNCTION_TARGET(F16C)
void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOEXCEPT
{
qsizetype i = 0;
int epilog_i;

View File

@ -501,7 +501,7 @@ NSTimeZone *QTimeZone::toNSTimeZone() const
\sa QRectF::fromCGRect()
*/
CGRect QRect::toCGRect() const Q_DECL_NOTHROW
CGRect QRect::toCGRect() const noexcept
{
return CGRectMake(x(), y(), width(), height());
}
@ -513,7 +513,7 @@ CGRect QRect::toCGRect() const Q_DECL_NOTHROW
\sa fromCGRect()
*/
CGRect QRectF::toCGRect() const Q_DECL_NOTHROW
CGRect QRectF::toCGRect() const noexcept
{
return CGRectMake(x(), y(), width(), height());
}
@ -525,7 +525,7 @@ CGRect QRectF::toCGRect() const Q_DECL_NOTHROW
\sa toCGRect()
*/
QRectF QRectF::fromCGRect(CGRect rect) Q_DECL_NOTHROW
QRectF QRectF::fromCGRect(CGRect rect) noexcept
{
return QRectF(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
}
@ -539,7 +539,7 @@ QRectF QRectF::fromCGRect(CGRect rect) Q_DECL_NOTHROW
\sa QPointF::fromCGPoint()
*/
CGPoint QPoint::toCGPoint() const Q_DECL_NOTHROW
CGPoint QPoint::toCGPoint() const noexcept
{
return CGPointMake(x(), y());
}
@ -551,7 +551,7 @@ CGPoint QPoint::toCGPoint() const Q_DECL_NOTHROW
\sa fromCGPoint()
*/
CGPoint QPointF::toCGPoint() const Q_DECL_NOTHROW
CGPoint QPointF::toCGPoint() const noexcept
{
return CGPointMake(x(), y());
}
@ -563,7 +563,7 @@ CGPoint QPointF::toCGPoint() const Q_DECL_NOTHROW
\sa toCGPoint()
*/
QPointF QPointF::fromCGPoint(CGPoint point) Q_DECL_NOTHROW
QPointF QPointF::fromCGPoint(CGPoint point) noexcept
{
return QPointF(point.x, point.y);
}
@ -577,7 +577,7 @@ QPointF QPointF::fromCGPoint(CGPoint point) Q_DECL_NOTHROW
\sa QSizeF::fromCGSize()
*/
CGSize QSize::toCGSize() const Q_DECL_NOTHROW
CGSize QSize::toCGSize() const noexcept
{
return CGSizeMake(width(), height());
}
@ -589,7 +589,7 @@ CGSize QSize::toCGSize() const Q_DECL_NOTHROW
\sa fromCGSize()
*/
CGSize QSizeF::toCGSize() const Q_DECL_NOTHROW
CGSize QSizeF::toCGSize() const noexcept
{
return CGSizeMake(width(), height());
}
@ -601,7 +601,7 @@ CGSize QSizeF::toCGSize() const Q_DECL_NOTHROW
\sa toCGSize()
*/
QSizeF QSizeF::fromCGSize(CGSize size) Q_DECL_NOTHROW
QSizeF QSizeF::fromCGSize(CGSize size) noexcept
{
return QSizeF(size.width, size.height);
}

View File

@ -371,7 +371,7 @@ bool operator<(const KeyPair &entry, const Qt::Key &key)
struct qtKey2CocoaKeySortLessThan
{
typedef bool result_type;
Q_DECL_CONSTEXPR result_type operator()(const KeyPair &entry1, const KeyPair &entry2) const Q_DECL_NOTHROW
Q_DECL_CONSTEXPR result_type operator()(const KeyPair &entry1, const KeyPair &entry2) const noexcept
{
return entry1.qtKey < entry2.qtKey;
}

View File

@ -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();
}

View File

@ -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()

View File

@ -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();

View File

@ -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;

View File

@ -773,7 +773,7 @@ public:
quitEventLoop_noexcept();
}
static void quitEventLoop_noexcept() Q_DECL_NOTHROW
static void quitEventLoop_noexcept() noexcept
{
QVERIFY(!_e.isNull());
_e->quit();

View File

@ -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);

View File

@ -256,7 +256,7 @@ void tst_Cmptest::compare_boolfuncs()
namespace {
template <typename T>
T *null() Q_DECL_NOTHROW { return nullptr; }
T *null() noexcept { return nullptr; }
}
void tst_Cmptest::compare_to_nullptr()

View File

@ -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);

View File

@ -818,8 +818,8 @@ static const char *property_string =
" ushort lineBreakClass : 6; /* 6 used */\n"
" ushort script : 8;\n"
"};\n\n"
"Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW;\n"
"Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW;\n"
"Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) noexcept;\n"
"Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) noexcept;\n"
"\n"
"struct LowercaseTraits\n"
"{\n"
@ -855,20 +855,20 @@ static const char *property_string =
"\n";
static const char *methods =
"Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW;\n"
"inline GraphemeBreakClass graphemeBreakClass(QChar ch) Q_DECL_NOTHROW\n"
"Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) noexcept;\n"
"inline GraphemeBreakClass graphemeBreakClass(QChar ch) noexcept\n"
"{ return graphemeBreakClass(ch.unicode()); }\n"
"\n"
"Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW;\n"
"inline WordBreakClass wordBreakClass(QChar ch) Q_DECL_NOTHROW\n"
"Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) noexcept;\n"
"inline WordBreakClass wordBreakClass(QChar ch) noexcept\n"
"{ return wordBreakClass(ch.unicode()); }\n"
"\n"
"Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW;\n"
"inline SentenceBreakClass sentenceBreakClass(QChar ch) Q_DECL_NOTHROW\n"
"Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) noexcept;\n"
"inline SentenceBreakClass sentenceBreakClass(QChar ch) noexcept\n"
"{ return sentenceBreakClass(ch.unicode()); }\n"
"\n"
"Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW;\n"
"inline LineBreakClass lineBreakClass(QChar ch) Q_DECL_NOTHROW\n"
"Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) noexcept;\n"
"inline LineBreakClass lineBreakClass(QChar ch) noexcept\n"
"{ return lineBreakClass(ch.unicode()); }\n"
"\n";
@ -2521,42 +2521,42 @@ static QByteArray createPropertyInfo()
out += "\n};\n\n";
out += "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4) Q_DECL_NOTHROW\n"
out += "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4) noexcept\n"
"{\n"
" return uc_properties + GET_PROP_INDEX(ucs4);\n"
"}\n"
"\n"
"Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) Q_DECL_NOTHROW\n"
"Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) noexcept\n"
"{\n"
" return uc_properties + GET_PROP_INDEX_UCS2(ucs2);\n"
"}\n"
"\n"
"Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW\n"
"Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) noexcept\n"
"{\n"
" return qGetProp(ucs4);\n"
"}\n"
"\n"
"Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW\n"
"Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) noexcept\n"
"{\n"
" return qGetProp(ucs2);\n"
"}\n\n";
out += "Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW\n"
out += "Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) noexcept\n"
"{\n"
" return static_cast<GraphemeBreakClass>(qGetProp(ucs4)->graphemeBreakClass);\n"
"}\n"
"\n"
"Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW\n"
"Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) noexcept\n"
"{\n"
" return static_cast<WordBreakClass>(qGetProp(ucs4)->wordBreakClass);\n"
"}\n"
"\n"
"Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW\n"
"Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) noexcept\n"
"{\n"
" return static_cast<SentenceBreakClass>(qGetProp(ucs4)->sentenceBreakClass);\n"
"}\n"
"\n"
"Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW\n"
"Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) noexcept\n"
"{\n"
" return static_cast<LineBreakClass>(qGetProp(ucs4)->lineBreakClass);\n"
"}\n"