Replace Q_DECL_NOEXCEPT with noexcept in corelib

In preparation of Qt6 move away from pre-C++11 macros.

Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2019-04-02 10:54:54 +02:00
parent 6c761a0db1
commit a1e62e7ba1
153 changed files with 2205 additions and 2205 deletions

View File

@ -1061,7 +1061,7 @@ QString QTextDecoder::toUnicode(const char *chars, int len)
}
// in qstring.cpp:
void qt_from_latin1(ushort *dst, const char *str, size_t size) Q_DECL_NOTHROW;
void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept;
/*! \overload

View File

@ -54,7 +54,7 @@ static const uchar utf8bom[] = { 0xef, 0xbb, 0xbf };
#if (defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSE2)) \
|| (defined(__ARM_NEON__) && defined(Q_PROCESSOR_ARM_64))
static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) Q_DECL_NOTHROW
static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) noexcept
{
uint result = qCountLeadingZeroBits(v);
// Now Invert the result: clz will count *down* from the msb to the lsb, so the msb index is 31
@ -504,7 +504,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len)
This function never throws.
*/
QChar *QUtf8::convertToUnicode(QChar *buffer, const char *chars, int len) Q_DECL_NOTHROW
QChar *QUtf8::convertToUnicode(QChar *buffer, const char *chars, int len) noexcept
{
ushort *dst = reinterpret_cast<ushort *>(buffer);
const uchar *src = reinterpret_cast<const uchar *>(chars);

View File

@ -291,7 +291,7 @@ enum DataEndianness
struct QUtf8
{
static QChar *convertToUnicode(QChar *, const char *, int) Q_DECL_NOTHROW;
static QChar *convertToUnicode(QChar *, const char *, int) noexcept;
static QString convertToUnicode(const char *, int);
static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *);
static QByteArray convertFromUnicode(const QChar *, int);

View File

@ -54,21 +54,21 @@ class QFlag
{
int i;
public:
Q_DECL_CONSTEXPR inline QFlag(int value) Q_DECL_NOTHROW : i(value) {}
Q_DECL_CONSTEXPR inline operator int() const Q_DECL_NOTHROW { return i; }
Q_DECL_CONSTEXPR inline QFlag(int value) noexcept : i(value) {}
Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; }
#if !defined(Q_CC_MSVC)
// Microsoft Visual Studio has buggy behavior when it comes to
// unsigned enums: even if the enum is unsigned, the enum tags are
// always signed
# if !defined(__LP64__) && !defined(Q_CLANG_QDOC)
Q_DECL_CONSTEXPR inline QFlag(long value) Q_DECL_NOTHROW : i(int(value)) {}
Q_DECL_CONSTEXPR inline QFlag(ulong value) Q_DECL_NOTHROW : i(int(long(value))) {}
Q_DECL_CONSTEXPR inline QFlag(long value) noexcept : i(int(value)) {}
Q_DECL_CONSTEXPR inline QFlag(ulong value) noexcept : i(int(long(value))) {}
# endif
Q_DECL_CONSTEXPR inline QFlag(uint value) Q_DECL_NOTHROW : i(int(value)) {}
Q_DECL_CONSTEXPR inline QFlag(short value) Q_DECL_NOTHROW : i(int(value)) {}
Q_DECL_CONSTEXPR inline QFlag(ushort value) Q_DECL_NOTHROW : i(int(uint(value))) {}
Q_DECL_CONSTEXPR inline operator uint() const Q_DECL_NOTHROW { return uint(i); }
Q_DECL_CONSTEXPR inline QFlag(uint value) noexcept : i(int(value)) {}
Q_DECL_CONSTEXPR inline QFlag(short value) noexcept : i(int(value)) {}
Q_DECL_CONSTEXPR inline QFlag(ushort value) noexcept : i(int(uint(value))) {}
Q_DECL_CONSTEXPR inline operator uint() const noexcept { return uint(i); }
#endif
};
Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE);
@ -77,12 +77,12 @@ class QIncompatibleFlag
{
int i;
public:
Q_DECL_CONSTEXPR inline explicit QIncompatibleFlag(int i) Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR inline operator int() const Q_DECL_NOTHROW { return i; }
Q_DECL_CONSTEXPR inline explicit QIncompatibleFlag(int i) noexcept;
Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; }
};
Q_DECLARE_TYPEINFO(QIncompatibleFlag, Q_PRIMITIVE_TYPE);
Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) Q_DECL_NOTHROW : i(value) {}
Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) noexcept : i(value) {}
#ifndef Q_NO_TYPESAFE_FLAGS
@ -117,38 +117,38 @@ public:
Q_DECL_CONSTEXPR inline QFlags(const QFlags &other);
Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other);
#endif
Q_DECL_CONSTEXPR inline QFlags(Enum flags) Q_DECL_NOTHROW : i(Int(flags)) {}
Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) Q_DECL_NOTHROW : i(0) {}
Q_DECL_CONSTEXPR inline QFlags(QFlag flag) Q_DECL_NOTHROW : i(flag) {}
Q_DECL_CONSTEXPR inline QFlags(Enum flags) noexcept : i(Int(flags)) {}
Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) noexcept : i(0) {}
Q_DECL_CONSTEXPR inline QFlags(QFlag flag) noexcept : i(flag) {}
#ifdef Q_COMPILER_INITIALIZER_LISTS
Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) noexcept
: i(initializer_list_helper(flags.begin(), flags.end())) {}
#endif
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) Q_DECL_NOTHROW { i &= mask; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) Q_DECL_NOTHROW { i &= mask; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) Q_DECL_NOTHROW { i &= Int(mask); return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) Q_DECL_NOTHROW { i |= other.i; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) Q_DECL_NOTHROW { i |= Int(other); return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) Q_DECL_NOTHROW { i ^= other.i; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) Q_DECL_NOTHROW { i ^= Int(other); return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) noexcept { i &= mask; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) noexcept { i &= mask; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) noexcept { i &= Int(mask); return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) noexcept { i |= other.i; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) noexcept { i |= Int(other); return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) noexcept { i ^= other.i; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) noexcept { i ^= Int(other); return *this; }
Q_DECL_CONSTEXPR inline operator Int() const Q_DECL_NOTHROW { return i; }
Q_DECL_CONSTEXPR inline operator Int() const noexcept { return i; }
Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | other.i)); }
Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ other.i)); }
Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i & Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator~() const Q_DECL_NOTHROW { return QFlags(QFlag(~i)); }
Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const noexcept { return QFlags(QFlag(i | other.i)); }
Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const noexcept { return QFlags(QFlag(i | Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const noexcept { return QFlags(QFlag(i ^ other.i)); }
Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const noexcept { return QFlags(QFlag(i ^ Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const noexcept { return QFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const noexcept { return QFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const noexcept { return QFlags(QFlag(i & Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator~() const noexcept { return QFlags(QFlag(~i)); }
Q_DECL_CONSTEXPR inline bool operator!() const Q_DECL_NOTHROW { return !i; }
Q_DECL_CONSTEXPR inline bool operator!() const noexcept { return !i; }
Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const Q_DECL_NOTHROW { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) noexcept
{
return on ? (*this |= flag) : (*this &= ~Int(flag));
}
@ -157,7 +157,7 @@ private:
#ifdef Q_COMPILER_INITIALIZER_LISTS
Q_DECL_CONSTEXPR static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it,
typename std::initializer_list<Enum>::const_iterator end)
Q_DECL_NOTHROW
noexcept
{
return (it == end ? Int(0) : (Int(*it) | initializer_list_helper(it + 1, end)));
}
@ -172,13 +172,13 @@ typedef QFlags<Enum> Flags;
#endif
#define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \
Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) Q_DECL_NOTHROW \
Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \
{ return QIncompatibleFlag(int(f1) | f2); }
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) Q_DECL_NOTHROW \
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \
{ return QFlags<Flags::enum_type>(f1) | f2; } \
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) Q_DECL_NOTHROW \
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \
{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)

View File

@ -132,8 +132,8 @@ extern "C" {
# define f16cextern extern
#endif
f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW;
f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW;
f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) noexcept;
f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) noexcept;
#undef f16cextern
}
@ -144,7 +144,7 @@ static inline bool hasFastF16()
return true;
}
static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) noexcept
{
__fp16 *out_f16 = reinterpret_cast<__fp16 *>(out);
qsizetype i = 0;
@ -154,7 +154,7 @@ static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q
out_f16[i] = __fp16(in[i]);
}
static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) noexcept
{
const __fp16 *in_f16 = reinterpret_cast<const __fp16 *>(in);
qsizetype i = 0;
@ -169,12 +169,12 @@ static inline bool hasFastF16()
return false;
}
static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) Q_DECL_NOTHROW
static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) noexcept
{
Q_UNREACHABLE();
}
static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_NOTHROW
static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) noexcept
{
Q_UNREACHABLE();
}
@ -186,7 +186,7 @@ static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_N
Converts \a len floats from \a in to qfloat16 and stores them in \a out.
Both \a in and \a out must have \a len allocated entries.
*/
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) noexcept
{
if (hasFastF16())
return qFloatToFloat16_fast(reinterpret_cast<quint16 *>(out), in, len);
@ -202,7 +202,7 @@ Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len
Converts \a len qfloat16 from \a in to floats and stores them in \a out.
Both \a in and \a out must have \a len allocated entries.
*/
Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) Q_DECL_NOTHROW
Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) noexcept
{
if (hasFastF16())
return qFloatFromFloat16_fast(out, reinterpret_cast<const quint16 *>(in), len);

View File

@ -67,14 +67,14 @@ QT_BEGIN_NAMESPACE
class qfloat16
{
public:
constexpr inline qfloat16() Q_DECL_NOTHROW : b16(0) {}
inline qfloat16(float f) Q_DECL_NOTHROW;
inline operator float() const Q_DECL_NOTHROW;
constexpr inline qfloat16() noexcept : b16(0) {}
inline qfloat16(float f) noexcept;
inline operator float() const noexcept;
// Support for qIs{Inf,NaN,Finite}:
bool isInf() const Q_DECL_NOTHROW { return ((b16 >> 8) & 0x7e) == 0x7c; }
bool isNaN() const Q_DECL_NOTHROW { return ((b16 >> 8) & 0x7e) == 0x7e; }
bool isFinite() const Q_DECL_NOTHROW { return ((b16 >> 8) & 0x7c) != 0x7c; }
bool isInf() const noexcept { return ((b16 >> 8) & 0x7e) == 0x7c; }
bool isNaN() const noexcept { return ((b16 >> 8) & 0x7e) == 0x7e; }
bool isFinite() const noexcept { return ((b16 >> 8) & 0x7c) != 0x7c; }
private:
quint16 b16;
@ -84,29 +84,29 @@ private:
Q_CORE_EXPORT static const quint32 basetable[];
Q_CORE_EXPORT static const quint32 shifttable[];
friend bool qIsNull(qfloat16 f) Q_DECL_NOTHROW;
friend qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW;
friend bool qIsNull(qfloat16 f) noexcept;
friend qfloat16 operator-(qfloat16 a) noexcept;
};
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) Q_DECL_NOTHROW;
Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) Q_DECL_NOTHROW;
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) noexcept;
Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) noexcept;
// Complement qnumeric.h:
Q_REQUIRED_RESULT inline bool qIsInf(qfloat16 f) Q_DECL_NOTHROW { return f.isInf(); }
Q_REQUIRED_RESULT inline bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW { return f.isNaN(); }
Q_REQUIRED_RESULT inline bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW { return f.isFinite(); }
Q_REQUIRED_RESULT inline bool qIsInf(qfloat16 f) noexcept { return f.isInf(); }
Q_REQUIRED_RESULT inline bool qIsNaN(qfloat16 f) noexcept { return f.isNaN(); }
Q_REQUIRED_RESULT inline bool qIsFinite(qfloat16 f) noexcept { return f.isFinite(); }
// Q_REQUIRED_RESULT quint32 qFloatDistance(qfloat16 a, qfloat16 b);
// The remainder of these utility functions complement qglobal.h
Q_REQUIRED_RESULT inline int qRound(qfloat16 d) Q_DECL_NOTHROW
Q_REQUIRED_RESULT inline int qRound(qfloat16 d) noexcept
{ return qRound(static_cast<float>(d)); }
Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) Q_DECL_NOTHROW
Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) noexcept
{ return qRound64(static_cast<float>(d)); }
Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOTHROW
Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
{
float f1 = static_cast<float>(p1);
float f2 = static_cast<float>(p2);
@ -119,19 +119,19 @@ Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOT
return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2)));
}
Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) Q_DECL_NOTHROW
Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) noexcept
{
return (f.b16 & static_cast<quint16>(0x7fff)) == 0;
}
inline int qIntCast(qfloat16 f) Q_DECL_NOTHROW
inline int qIntCast(qfloat16 f) noexcept
{ return int(static_cast<float>(f)); }
#ifndef Q_QDOC
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wc99-extensions")
QT_WARNING_DISABLE_GCC("-Wold-style-cast")
inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
inline qfloat16::qfloat16(float f) noexcept
{
#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
__m128 packsingle = _mm_set_ss(f);
@ -149,7 +149,7 @@ inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
}
QT_WARNING_POP
inline qfloat16::operator float() const Q_DECL_NOTHROW
inline qfloat16::operator float() const noexcept
{
#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
__m128i packhalf = _mm_cvtsi32_si128(b16);
@ -169,23 +169,23 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW
}
#endif
inline qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW
inline qfloat16 operator-(qfloat16 a) noexcept
{
qfloat16 f;
f.b16 = a.b16 ^ quint16(0x8000);
return f;
}
inline qfloat16 operator+(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) + static_cast<float>(b)); }
inline qfloat16 operator-(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) - static_cast<float>(b)); }
inline qfloat16 operator*(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) * static_cast<float>(b)); }
inline qfloat16 operator/(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) / static_cast<float>(b)); }
inline qfloat16 operator+(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) + static_cast<float>(b)); }
inline qfloat16 operator-(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) - static_cast<float>(b)); }
inline qfloat16 operator*(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) * static_cast<float>(b)); }
inline qfloat16 operator/(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) / static_cast<float>(b)); }
#define QF16_MAKE_ARITH_OP_FP(FP, OP) \
inline FP operator OP(qfloat16 lhs, FP rhs) Q_DECL_NOTHROW { return static_cast<FP>(lhs) OP rhs; } \
inline FP operator OP(FP lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<FP>(rhs); }
inline FP operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast<FP>(lhs) OP rhs; } \
inline FP operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<FP>(rhs); }
#define QF16_MAKE_ARITH_OP_EQ_FP(FP, OP_EQ, OP) \
inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) Q_DECL_NOTHROW \
inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) noexcept \
{ lhs = qfloat16(float(static_cast<FP>(lhs) OP rhs)); return lhs; }
#define QF16_MAKE_ARITH_OP(FP) \
QF16_MAKE_ARITH_OP_FP(FP, +) \
@ -203,8 +203,8 @@ QF16_MAKE_ARITH_OP(float)
#undef QF16_MAKE_ARITH_OP_FP
#define QF16_MAKE_ARITH_OP_INT(OP) \
inline double operator OP(qfloat16 lhs, int rhs) Q_DECL_NOTHROW { return static_cast<double>(lhs) OP rhs; } \
inline double operator OP(int lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<double>(rhs); }
inline double operator OP(qfloat16 lhs, int rhs) noexcept { return static_cast<double>(lhs) OP rhs; } \
inline double operator OP(int lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<double>(rhs); }
QF16_MAKE_ARITH_OP_INT(+)
QF16_MAKE_ARITH_OP_INT(-)
QF16_MAKE_ARITH_OP_INT(*)
@ -215,16 +215,16 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
QT_WARNING_DISABLE_GCC("-Wfloat-equal")
inline bool operator>(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) > static_cast<float>(b); }
inline bool operator<(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) < static_cast<float>(b); }
inline bool operator>=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) >= static_cast<float>(b); }
inline bool operator<=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) <= static_cast<float>(b); }
inline bool operator==(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) == static_cast<float>(b); }
inline bool operator!=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) != static_cast<float>(b); }
inline bool operator>(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) > static_cast<float>(b); }
inline bool operator<(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) < static_cast<float>(b); }
inline bool operator>=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) >= static_cast<float>(b); }
inline bool operator<=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) <= static_cast<float>(b); }
inline bool operator==(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) == static_cast<float>(b); }
inline bool operator!=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) != static_cast<float>(b); }
#define QF16_MAKE_BOOL_OP_FP(FP, OP) \
inline bool operator OP(qfloat16 lhs, FP rhs) Q_DECL_NOTHROW { return static_cast<FP>(lhs) OP rhs; } \
inline bool operator OP(FP lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<FP>(rhs); }
inline bool operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast<FP>(lhs) OP rhs; } \
inline bool operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<FP>(rhs); }
#define QF16_MAKE_BOOL_OP(FP) \
QF16_MAKE_BOOL_OP_FP(FP, <) \
QF16_MAKE_BOOL_OP_FP(FP, >) \
@ -239,8 +239,8 @@ QF16_MAKE_BOOL_OP(float)
#undef QF16_MAKE_BOOL_OP_FP
#define QF16_MAKE_BOOL_OP_INT(OP) \
inline bool operator OP(qfloat16 a, int b) Q_DECL_NOTHROW { return static_cast<float>(a) OP b; } \
inline bool operator OP(int a, qfloat16 b) Q_DECL_NOTHROW { return a OP static_cast<float>(b); }
inline bool operator OP(qfloat16 a, int b) noexcept { return static_cast<float>(a) OP b; } \
inline bool operator OP(int a, qfloat16 b) noexcept { return a OP static_cast<float>(b); }
QF16_MAKE_BOOL_OP_INT(>)
QF16_MAKE_BOOL_OP_INT(<)
QF16_MAKE_BOOL_OP_INT(>=)
@ -254,7 +254,7 @@ QT_WARNING_POP
/*!
\internal
*/
Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) Q_DECL_NOTHROW
Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) noexcept
{
return qAbs(static_cast<float>(f)) <= 0.001f;
}

View File

@ -1147,12 +1147,12 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
\sa QT_VERSION_STR, QLibraryInfo::version()
*/
const char *qVersion() Q_DECL_NOTHROW
const char *qVersion() noexcept
{
return QT_VERSION_STR;
}
bool qSharedBuild() Q_DECL_NOTHROW
bool qSharedBuild() noexcept
{
#ifdef QT_SHARED
return true;
@ -3206,7 +3206,7 @@ QByteArray QSysInfo::bootUniqueId()
The Q_CHECK_PTR macro calls this function if an allocation check
fails.
*/
void qt_check_pointer(const char *n, int l) Q_DECL_NOTHROW
void qt_check_pointer(const char *n, int l) noexcept
{
// make separate printing calls so that the first one may flush;
// the second one could want to allocate memory (fputs prints a
@ -3233,7 +3233,7 @@ void qBadAlloc()
Allows you to call std::terminate() without including <exception>.
Called internally from QT_TERMINATE_ON_EXCEPTION
*/
Q_NORETURN void qTerminate() Q_DECL_NOTHROW
Q_NORETURN void qTerminate() noexcept
{
std::terminate();
}
@ -3242,7 +3242,7 @@ Q_NORETURN void qTerminate() Q_DECL_NOTHROW
/*
The Q_ASSERT macro calls this function when the test fails.
*/
void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW
void qt_assert(const char *assertion, const char *file, int line) noexcept
{
QMessageLogger(file, line, nullptr).fatal("ASSERT: \"%s\" in file %s, line %d", assertion, file, line);
}
@ -3250,7 +3250,7 @@ void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW
/*
The Q_ASSERT_X macro calls this function when the test fails.
*/
void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW
void qt_assert_x(const char *where, const char *what, const char *file, int line) noexcept
{
QMessageLogger(file, line, nullptr).fatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line);
}
@ -3457,7 +3457,7 @@ QString qEnvironmentVariable(const char *varName)
\sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsSet()
*/
bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT
bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
{
QMutexLocker locker(&environmentMutex);
#ifdef Q_CC_MSVC
@ -3492,7 +3492,7 @@ bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT
\sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsSet()
*/
int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT
int qEnvironmentVariableIntValue(const char *varName, bool *ok) noexcept
{
static const int NumBinaryDigitsPerOctalDigit = 3;
static const int MaxDigitsForOctalInt =
@ -3561,7 +3561,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT
\sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsEmpty()
*/
bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT
bool qEnvironmentVariableIsSet(const char *varName) noexcept
{
QMutexLocker locker(&environmentMutex);
#ifdef Q_CC_MSVC

View File

@ -411,7 +411,7 @@ typedef double qreal;
#if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC)
extern "C"
#endif
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOTHROW;
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT;
#if defined(__cplusplus)
@ -730,7 +730,7 @@ inline void qt_noop(void) {}
# define QT_CATCH(A) catch (A)
# define QT_THROW(A) throw A
# define QT_RETHROW throw
Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept;
# ifdef Q_COMPILER_NOEXCEPT
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
# else
@ -738,7 +738,7 @@ Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
# endif
#endif
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW;
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() noexcept;
#ifndef Q_OUTOFLINE_TEMPLATE
# define Q_OUTOFLINE_TEMPLATE
@ -781,7 +781,7 @@ Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
Q_NORETURN
#endif
Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW;
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) noexcept;
#if !defined(Q_ASSERT)
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
@ -799,7 +799,7 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line)
Q_NORETURN
#endif
Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW;
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) noexcept;
#if !defined(Q_ASSERT_X)
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
@ -809,7 +809,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *
# endif
#endif
Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) Q_DECL_NOTHROW;
Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) noexcept;
Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT void qBadAlloc();
@ -968,7 +968,7 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
// this adds const to non-const objects (like std::as_const)
template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
// prevent rvalue arguments:
template <typename T>
void qAsConst(const T &&) Q_DECL_EQ_DELETE;
@ -1130,11 +1130,11 @@ template <typename... Args>
struct QNonConstOverload
{
template <typename R, typename T>
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr)
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr)
{ return ptr; }
template <typename R, typename T>
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr)
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr)
{ return ptr; }
};
@ -1142,11 +1142,11 @@ template <typename... Args>
struct QConstOverload
{
template <typename R, typename T>
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const Q_DECL_NOTHROW -> decltype(ptr)
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
{ return ptr; }
template <typename R, typename T>
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) Q_DECL_NOTHROW -> decltype(ptr)
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr)
{ return ptr; }
};
@ -1159,11 +1159,11 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
using QNonConstOverload<Args...>::operator();
template <typename R>
Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr)
Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr)
{ return ptr; }
template <typename R>
static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr)
static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
{ return ptr; }
};
@ -1184,9 +1184,9 @@ Q_CORE_EXPORT QString qEnvironmentVariable(const char *varName, const QString &d
Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value);
Q_CORE_EXPORT bool qunsetenv(const char *varName);
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT;
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT;
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) Q_DECL_NOEXCEPT;
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept;
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept;
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept;
inline int qIntCast(double f) { return int(f); }
inline int qIntCast(float f) { return int(f); }

View File

@ -79,7 +79,7 @@ enum GuardValues {
Q_GLOBAL_STATIC_INTERNAL_DECORATION Type *innerFunction() \
{ \
struct HolderBase { \
~HolderBase() Q_DECL_NOTHROW \
~HolderBase() noexcept \
{ if (guard.load() == QtGlobalStatic::Initialized) \
guard.store(QtGlobalStatic::Destroyed); } \
}; \

View File

@ -350,7 +350,7 @@ QLibraryInfo::buildDate()
\since 5.3
*/
const char *QLibraryInfo::build() Q_DECL_NOTHROW
const char *QLibraryInfo::build() noexcept
{
return QT_BUILD_STR;
}
@ -377,7 +377,7 @@ QLibraryInfo::isDebugBuild()
\sa qVersion()
*/
QVersionNumber QLibraryInfo::version() Q_DECL_NOTHROW
QVersionNumber QLibraryInfo::version() noexcept
{
return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH);
}

View File

@ -62,12 +62,12 @@ public:
#endif // QT_DEPRECATED_SINCE(5, 5)
#endif // datestring
static const char * build() Q_DECL_NOTHROW;
static const char * build() noexcept;
static bool isDebugBuild();
#ifndef QT_BOOTSTRAPPED
static QVersionNumber version() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION;
#endif
enum LibraryLocation

View File

@ -346,7 +346,7 @@ using namespace QtPrivate;
*/
#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)
static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const char *s) Q_DECL_NOEXCEPT
static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const char *s) noexcept
{
size_t len = qstrlen(s);
if (len + 1 > space) {
@ -529,7 +529,7 @@ QDebug QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc) const
\sa QNoDebug, qDebug()
*/
QNoDebug QMessageLogger::noDebug() const Q_DECL_NOTHROW
QNoDebug QMessageLogger::noDebug() const noexcept
{
return QNoDebug();
}
@ -875,7 +875,7 @@ QDebug QMessageLogger::critical(QMessageLogger::CategoryFunction catFunc) const
\sa qFatal()
*/
void QMessageLogger::fatal(const char *msg, ...) const Q_DECL_NOTHROW
void QMessageLogger::fatal(const char *msg, ...) const noexcept
{
QString message;

View File

@ -121,7 +121,7 @@ public:
Q_NORETURN
#endif
Q_DECL_COLD_FUNCTION
void fatal(const char *msg, ...) const Q_DECL_NOTHROW Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
void fatal(const char *msg, ...) const noexcept Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
#ifndef QT_NO_DEBUG_STREAM
QDebug debug() const;
@ -137,7 +137,7 @@ public:
QDebug critical(const QLoggingCategory &cat) const;
QDebug critical(CategoryFunction catFunc) const;
QNoDebug noDebug() const Q_DECL_NOTHROW;
QNoDebug noDebug() const noexcept;
#endif // QT_NO_DEBUG_STREAM
private:

View File

@ -50,10 +50,10 @@ QT_BEGIN_NAMESPACE
#if !defined(Q_QDOC) && !defined(Q_MOC_RUN)
struct QMetaObject;
const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT; // defined in qobject.h (which can't be included here)
const QMetaObject *qt_getQtMetaObject() noexcept; // defined in qobject.h (which can't be included here)
#define QT_Q_ENUM(ENUM) \
inline const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return qt_getQtMetaObject(); } \
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
inline const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return qt_getQtMetaObject(); } \
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
#define QT_Q_FLAG(ENUM) QT_Q_ENUM(ENUM)
#else
#define QT_Q_ENUM Q_ENUM

View File

@ -126,7 +126,7 @@ Q_DECL_CONST_FUNCTION static inline int fpclassify(float f) { return std::fpclas
#endif
}
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() Q_DECL_NOEXCEPT
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() noexcept
{
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_infinity,
"platform has no definition for infinity for type double");
@ -134,7 +134,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() Q_DECL_NOEX
}
// Signaling NaN
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() Q_DECL_NOEXCEPT
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() noexcept
{
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_signaling_NaN,
"platform has no definition for signaling NaN for type double");
@ -142,7 +142,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() Q_DECL_NOE
}
// Quiet NaN
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() Q_DECL_NOEXCEPT
Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() noexcept
{
Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_quiet_NaN,
"platform has no definition for quiet NaN for type double");

View File

@ -91,7 +91,7 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando
QT_BEGIN_NAMESPACE
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW;
static qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept;
# ifdef Q_PROCESSOR_X86_64
# define _rdrandXX_step _rdrand64_step
@ -99,7 +99,7 @@ static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW;
# define _rdrandXX_step _rdrand32_step
# endif
static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW
static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept
{
unsigned *ptr = reinterpret_cast<unsigned *>(buffer);
unsigned *end = ptr + count;
@ -134,7 +134,7 @@ enum {
struct QRandomGenerator::SystemGenerator
{
#if QT_CONFIG(getentropy)
static qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
static qsizetype fillBuffer(void *buffer, qsizetype count) noexcept
{
// getentropy can read at most 256 bytes, so break the reading
qsizetype read = 0;
@ -204,13 +204,13 @@ struct QRandomGenerator::SystemGenerator
}
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
qsizetype fillBuffer(void *buffer, qsizetype count) noexcept
{
auto RtlGenRandom = SystemFunction036;
return RtlGenRandom(buffer, ULONG(count)) ? count: 0;
}
#elif defined(Q_OS_WINRT)
qsizetype fillBuffer(void *, qsizetype) Q_DECL_NOTHROW
qsizetype fillBuffer(void *, qsizetype) noexcept
{
// always use the fallback
return 0;
@ -242,7 +242,7 @@ struct QRandomGenerator::SystemGenerator
#if defined(Q_OS_WIN)
static void fallback_update_seed(unsigned) {}
static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
{
// on Windows, rand_s is a high-quality random number generator
// and it requires no seeding
@ -254,14 +254,14 @@ static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
}
#elif QT_CONFIG(getentropy)
static void fallback_update_seed(unsigned) {}
static void fallback_fill(quint32 *, qsizetype) Q_DECL_NOTHROW
static void fallback_fill(quint32 *, qsizetype) noexcept
{
// no fallback necessary, getentropy cannot fail under normal circumstances
Q_UNREACHABLE();
}
#elif defined(Q_OS_BSD4) && !defined(__GLIBC__)
static void fallback_update_seed(unsigned) {}
static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
{
// BSDs have arc4random(4) and these work even in chroot(2)
arc4random_buf(ptr, left * sizeof(*ptr));
@ -280,7 +280,7 @@ Q_NEVER_INLINE
#ifdef Q_CC_GNU
__attribute__((cold)) // this function is pretty big, so optimize for size
#endif
static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
{
quint32 scratch[12]; // see element count below
quint32 *end = scratch;
@ -1167,7 +1167,7 @@ QRandomGenerator &QRandomGenerator::operator=(const QRandomGenerator &other)
return *this;
}
QRandomGenerator::QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW
QRandomGenerator::QRandomGenerator(std::seed_seq &sseq) noexcept
: type(MersenneTwister)
{
Q_ASSERT(this != system());

View File

@ -68,7 +68,7 @@ public:
QRandomGenerator(const quint32 *seedBuffer, qsizetype len)
: QRandomGenerator(seedBuffer, seedBuffer + len)
{}
Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW;
Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) noexcept;
Q_CORE_EXPORT QRandomGenerator(const quint32 *begin, const quint32 *end);
// copy constructor & assignment operator (move unnecessary)
@ -165,7 +165,7 @@ public:
typedef quint32 result_type;
result_type operator()() { return generate(); }
void seed(quint32 s = 1) { *this = { s }; }
void seed(std::seed_seq &sseq) Q_DECL_NOTHROW { *this = { sseq }; }
void seed(std::seed_seq &sseq) noexcept { *this = { sseq }; }
Q_CORE_EXPORT void discard(unsigned long long z);
static Q_DECL_CONSTEXPR result_type min() { return std::numeric_limits<result_type>::min(); }
static Q_DECL_CONSTEXPR result_type max() { return std::numeric_limits<result_type>::max(); }
@ -228,7 +228,7 @@ public:
QRandomGenerator64(const quint32 *seedBuffer, qsizetype len)
: QRandomGenerator(seedBuffer, len)
{}
QRandomGenerator64(std::seed_seq &sseq) Q_DECL_NOTHROW
QRandomGenerator64(std::seed_seq &sseq) noexcept
: QRandomGenerator(sseq)
{}
QRandomGenerator64(const quint32 *begin, const quint32 *end)

View File

@ -116,7 +116,7 @@ public:
inline QDebug(const QDebug &o):stream(o.stream) { ++stream->ref; }
inline QDebug &operator=(const QDebug &other);
~QDebug();
inline void swap(QDebug &other) Q_DECL_NOTHROW { qSwap(stream, other.stream); }
inline void swap(QDebug &other) noexcept { qSwap(stream, other.stream); }
QDebug &resetFormat();

View File

@ -110,10 +110,10 @@ public:
QDir &operator=(const QString &path);
#endif
#ifdef Q_COMPILER_RVALUE_REFS
QDir &operator=(QDir &&other) Q_DECL_NOTHROW { swap(other); return *this; }
QDir &operator=(QDir &&other) noexcept { swap(other); return *this; }
#endif
void swap(QDir &other) Q_DECL_NOTHROW
void swap(QDir &other) noexcept
{ qSwap(d_ptr, other.d_ptr); }
void setPath(const QString &path);
@ -190,7 +190,7 @@ public:
static QFileInfoList drives();
Q_DECL_CONSTEXPR static inline QChar listSeparator() Q_DECL_NOTHROW
Q_DECL_CONSTEXPR static inline QChar listSeparator() noexcept
{
#if defined(Q_OS_WIN)
return QLatin1Char(';');

View File

@ -68,10 +68,10 @@ public:
QFileInfo &operator=(const QFileInfo &fileinfo);
#ifdef Q_COMPILER_RVALUE_REFS
QFileInfo &operator=(QFileInfo &&other) Q_DECL_NOTHROW { swap(other); return *this; }
QFileInfo &operator=(QFileInfo &&other) noexcept { swap(other); return *this; }
#endif
void swap(QFileInfo &other) Q_DECL_NOTHROW
void swap(QFileInfo &other) noexcept
{ qSwap(d_ptr, other.d_ptr); }
bool operator==(const QFileInfo &fileinfo) const;

View File

@ -73,11 +73,11 @@ public:
QProcessEnvironment(const QProcessEnvironment &other);
~QProcessEnvironment();
#ifdef Q_COMPILER_RVALUE_REFS
QProcessEnvironment &operator=(QProcessEnvironment && other) Q_DECL_NOTHROW { swap(other); return *this; }
QProcessEnvironment &operator=(QProcessEnvironment && other) noexcept { swap(other); return *this; }
#endif
QProcessEnvironment &operator=(const QProcessEnvironment &other);
void swap(QProcessEnvironment &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
void swap(QProcessEnvironment &other) noexcept { qSwap(d, other.d); }
bool operator==(const QProcessEnvironment &other) const;
inline bool operator!=(const QProcessEnvironment &other) const

View File

@ -63,10 +63,10 @@ public:
QStorageInfo &operator=(const QStorageInfo &other);
#ifdef Q_COMPILER_RVALUE_REFS
QStorageInfo &operator=(QStorageInfo &&other) Q_DECL_NOTHROW { swap(other); return *this; }
QStorageInfo &operator=(QStorageInfo &&other) noexcept { swap(other); return *this; }
#endif
inline void swap(QStorageInfo &other) Q_DECL_NOTHROW
inline void swap(QStorageInfo &other) noexcept
{ qSwap(d, other.d); }
void setPath(const QString &path);

View File

@ -4159,7 +4159,7 @@ QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode)
\relates QHash
\since 5.0
*/
uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW
uint qHash(const QUrl &url, uint seed) noexcept
{
if (!url.d)
return qHash(-1, seed); // the hash of an unset port (-1)

View File

@ -119,7 +119,7 @@ class QTypeInfo<QUrlTwoFlags<E1, E2> > : public QTypeInfoMerger<QUrlTwoFlags<E1,
class QUrl;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) Q_DECL_NOTHROW;
Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) noexcept;
class Q_CORE_EXPORT QUrl
{
@ -183,14 +183,14 @@ public:
QUrl &operator=(const QString &url);
#endif
#ifdef Q_COMPILER_RVALUE_REFS
QUrl(QUrl &&other) Q_DECL_NOTHROW : d(other.d)
QUrl(QUrl &&other) noexcept : d(other.d)
{ other.d = nullptr; }
inline QUrl &operator=(QUrl &&other) Q_DECL_NOTHROW
inline QUrl &operator=(QUrl &&other) noexcept
{ qSwap(d, other.d); return *this; }
#endif
~QUrl();
inline void swap(QUrl &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
inline void swap(QUrl &other) noexcept { qSwap(d, other.d); }
void setUrl(const QString &url, ParsingMode mode = TolerantMode);
QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
@ -361,7 +361,7 @@ public:
static QList<QUrl> fromStringList(const QStringList &uris, ParsingMode mode = TolerantMode);
static void setIdnWhitelist(const QStringList &);
friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW;
friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) noexcept;
private:
QUrlPrivate *d;

View File

@ -434,7 +434,7 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const
Returns the hash value for \a key,
using \a seed to seed the calculation.
*/
uint qHash(const QUrlQuery &key, uint seed) Q_DECL_NOTHROW
uint qHash(const QUrlQuery &key, uint seed) noexcept
{
if (const QUrlQueryPrivate *d = key.d) {
QtPrivate::QHashCombine hash;

View File

@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) Q_DECL_NOTHROW;
Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) noexcept;
class QUrlQueryPrivate;
class Q_CORE_EXPORT QUrlQuery
@ -71,7 +71,7 @@ public:
QUrlQuery(const QUrlQuery &other);
QUrlQuery &operator=(const QUrlQuery &other);
#ifdef Q_COMPILER_RVALUE_REFS
QUrlQuery &operator=(QUrlQuery &&other) Q_DECL_NOTHROW { swap(other); return *this; }
QUrlQuery &operator=(QUrlQuery &&other) noexcept { swap(other); return *this; }
#endif
~QUrlQuery();
@ -79,7 +79,7 @@ public:
bool operator!=(const QUrlQuery &other) const
{ return !(*this == other); }
void swap(QUrlQuery &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
void swap(QUrlQuery &other) noexcept { qSwap(d, other.d); }
bool isEmpty() const;
bool isDetached() const;
@ -111,7 +111,7 @@ public:
private:
friend class QUrl;
friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) Q_DECL_NOTHROW;
friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) noexcept;
QSharedDataPointer<QUrlQueryPrivate> d;
public:
typedef QSharedDataPointer<QUrlQueryPrivate> DataPtr;

View File

@ -692,7 +692,7 @@ qt_urlRecode(QString &appendTo, const QChar *begin, const QChar *end,
}
// qstring.cpp
bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW;
bool qt_is_ascii(const char *&ptr, const char *end) noexcept;
/*!
\internal

View File

@ -57,12 +57,12 @@ class Q_CORE_EXPORT QModelIndex
{
friend class QAbstractItemModel;
public:
Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(nullptr) {}
Q_DECL_CONSTEXPR inline QModelIndex() noexcept : r(-1), c(-1), i(0), m(nullptr) {}
// compiler-generated copy/move ctors/assignment operators are fine!
Q_DECL_CONSTEXPR inline int row() const Q_DECL_NOTHROW { return r; }
Q_DECL_CONSTEXPR inline int column() const Q_DECL_NOTHROW { return c; }
Q_DECL_CONSTEXPR inline quintptr internalId() const Q_DECL_NOTHROW { return i; }
inline void *internalPointer() const Q_DECL_NOTHROW { return reinterpret_cast<void*>(i); }
Q_DECL_CONSTEXPR inline int row() const noexcept { return r; }
Q_DECL_CONSTEXPR inline int column() const noexcept { return c; }
Q_DECL_CONSTEXPR inline quintptr internalId() const noexcept { return i; }
inline void *internalPointer() const noexcept { return reinterpret_cast<void*>(i); }
inline QModelIndex parent() const;
inline QModelIndex sibling(int row, int column) const;
inline QModelIndex siblingAtColumn(int column) const;
@ -72,13 +72,13 @@ public:
#endif
inline QVariant data(int role = Qt::DisplayRole) const;
inline Qt::ItemFlags flags() const;
Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; }
Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != nullptr); }
Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const noexcept { return m; }
Q_DECL_CONSTEXPR inline bool isValid() const noexcept { return (r >= 0) && (c >= 0) && (m != nullptr); }
Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const noexcept
{ return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); }
Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const noexcept
{ return !(*this == other); }
Q_DECL_CONSTEXPR inline bool operator<(const QModelIndex &other) const Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline bool operator<(const QModelIndex &other) const noexcept
{
return r < other.r
|| (r == other.r && (c < other.c
@ -86,9 +86,9 @@ public:
|| (i == other.i && std::less<const QAbstractItemModel *>()(m, other.m))))));
}
private:
inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) Q_DECL_NOTHROW
inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) noexcept
: r(arow), c(acolumn), i(reinterpret_cast<quintptr>(ptr)), m(amodel) {}
Q_DECL_CONSTEXPR inline QModelIndex(int arow, int acolumn, quintptr id, const QAbstractItemModel *amodel) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR inline QModelIndex(int arow, int acolumn, quintptr id, const QAbstractItemModel *amodel) noexcept
: r(arow), c(acolumn), i(id), m(amodel) {}
int r, c;
quintptr i;
@ -103,7 +103,7 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &);
class QPersistentModelIndexData;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
uint qHash(const QPersistentModelIndex &index, uint seed = 0) Q_DECL_NOTHROW;
uint qHash(const QPersistentModelIndex &index, uint seed = 0) noexcept;
class Q_CORE_EXPORT QPersistentModelIndex
{
@ -118,12 +118,12 @@ public:
{ return !operator==(other); }
QPersistentModelIndex &operator=(const QPersistentModelIndex &other);
#ifdef Q_COMPILER_RVALUE_REFS
inline QPersistentModelIndex(QPersistentModelIndex &&other) Q_DECL_NOTHROW
inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
: d(other.d) { other.d = nullptr; }
inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) Q_DECL_NOTHROW
inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) noexcept
{ qSwap(d, other.d); return *this; }
#endif
inline void swap(QPersistentModelIndex &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
inline void swap(QPersistentModelIndex &other) noexcept { qSwap(d, other.d); }
bool operator==(const QModelIndex &other) const;
bool operator!=(const QModelIndex &other) const;
QPersistentModelIndex &operator=(const QModelIndex &other);
@ -143,14 +143,14 @@ public:
bool isValid() const;
private:
QPersistentModelIndexData *d;
friend uint qHash(const QPersistentModelIndex &, uint seed) Q_DECL_NOTHROW;
friend uint qHash(const QPersistentModelIndex &, uint seed) noexcept;
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
#endif
};
Q_DECLARE_SHARED(QPersistentModelIndex)
inline uint qHash(const QPersistentModelIndex &index, uint seed) Q_DECL_NOTHROW
inline uint qHash(const QPersistentModelIndex &index, uint seed) noexcept
{ return qHash(index.d, seed); }
@ -464,7 +464,7 @@ inline QVariant QModelIndex::data(int arole) const
inline Qt::ItemFlags QModelIndex::flags() const
{ return m ? m->flags(*this) : Qt::ItemFlags(); }
inline uint qHash(const QModelIndex &index) Q_DECL_NOTHROW
inline uint qHash(const QModelIndex &index) noexcept
{ return uint((uint(index.row()) << 4) + index.column() + index.internalId()); }
QT_END_NAMESPACE

View File

@ -61,9 +61,9 @@ public:
inline QItemSelectionRange(const QItemSelectionRange &other)
: tl(other.tl), br(other.br) {}
# ifdef Q_COMPILER_RVALUE_REFS
QItemSelectionRange(QItemSelectionRange &&other) Q_DECL_NOTHROW
QItemSelectionRange(QItemSelectionRange &&other) noexcept
: tl(std::move(other.tl)), br(std::move(other.br)) {}
QItemSelectionRange &operator=(QItemSelectionRange &&other) Q_DECL_NOTHROW
QItemSelectionRange &operator=(QItemSelectionRange &&other) noexcept
{ tl = std::move(other.tl); br = std::move(other.br); return *this; }
# endif
QItemSelectionRange &operator=(const QItemSelectionRange &other)
@ -72,7 +72,7 @@ public:
QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR) : tl(topL), br(bottomR) {}
explicit QItemSelectionRange(const QModelIndex &index) : tl(index), br(tl) {}
void swap(QItemSelectionRange &other) Q_DECL_NOTHROW
void swap(QItemSelectionRange &other) noexcept
{
qSwap(tl, other.tl);
qSwap(br, other.br);
@ -249,7 +249,7 @@ Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QList<QItemSelectionRange>;
class Q_CORE_EXPORT QItemSelection : public QList<QItemSelectionRange>
{
public:
QItemSelection() Q_DECL_NOTHROW : QList<QItemSelectionRange>() {}
QItemSelection() noexcept : QList<QItemSelectionRange>() {}
QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight);
// reusing QList::swap() here is OK!

View File

@ -347,7 +347,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
#endif
// in qelapsedtimer_mac.cpp or qtimestamp_unix.cpp
timespec qt_gettime() Q_DECL_NOTHROW;
timespec qt_gettime() noexcept;
void qt_nanosleep(timespec amount);
QByteArray qt_readlink(const char *path);

View File

@ -369,7 +369,7 @@ uint QCoreApplicationPrivate::attribs =
(1 << Qt::AA_SynthesizeMouseForUnhandledTabletEvents);
struct QCoreApplicationData {
QCoreApplicationData() Q_DECL_NOTHROW {
QCoreApplicationData() noexcept {
applicationNameSet = false;
applicationVersionSet = false;
}

View File

@ -421,7 +421,7 @@ struct QBasicAtomicBitField {
QBasicAtomicInteger<uint> next;
QBasicAtomicInteger<uint> data[NumInts];
bool allocateSpecific(int which) Q_DECL_NOTHROW
bool allocateSpecific(int which) noexcept
{
QBasicAtomicInteger<uint> &entry = data[which / BitsPerInt];
const uint old = entry.load();
@ -437,7 +437,7 @@ struct QBasicAtomicBitField {
// loop.
}
int allocateNext() Q_DECL_NOTHROW
int allocateNext() noexcept
{
// Unroll loop to iterate over ints, then bits? Would save
// potentially a lot of cmpxchgs, because we can scan the
@ -463,7 +463,7 @@ typedef QBasicAtomicBitField<QEvent::MaxUser - QEvent::User + 1> UserEventTypeRe
static UserEventTypeRegistry userEventTypeRegistry;
static inline int registerEventTypeZeroBased(int id) Q_DECL_NOTHROW
static inline int registerEventTypeZeroBased(int id) noexcept
{
// if the type hint hasn't been registered yet, take it:
if (id < UserEventTypeRegistry::NumBits && id >= 0 && userEventTypeRegistry.allocateSpecific(id))
@ -486,7 +486,7 @@ static inline int registerEventTypeZeroBased(int id) Q_DECL_NOTHROW
Returns -1 if all available values are already taken or the
program is shutting down.
*/
int QEvent::registerEventType(int hint) Q_DECL_NOTHROW
int QEvent::registerEventType(int hint) noexcept
{
const int result = registerEventTypeZeroBased(QEvent::MaxUser - hint);
return result < 0 ? -1 : QEvent::MaxUser - result ;

View File

@ -307,7 +307,7 @@ public:
inline void accept() { m_accept = true; }
inline void ignore() { m_accept = false; }
static int registerEventType(int hint = -1) Q_DECL_NOTHROW;
static int registerEventType(int hint = -1) noexcept;
protected:
QEventPrivate *d;

View File

@ -188,7 +188,7 @@ Q_DECL_CONST_FUNCTION static inline QPair<qint64, qint64> toSecsAndNSecs(qint64
\sa hasExpired(), isForever(), remainingTime(), setRemainingTime()
*/
QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) noexcept
: t2(0)
{
setRemainingTime(msecs, type);
@ -260,7 +260,7 @@ QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
\sa setPreciseRemainingTime(), hasExpired(), isForever(), remainingTime()
*/
void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) noexcept
{
if (msecs == -1)
*this = QDeadlineTimer(Forever, timerType);
@ -279,7 +279,7 @@ void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_D
\sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
*/
void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::TimerType timerType) noexcept
{
if (secs == -1) {
*this = QDeadlineTimer(Forever, timerType);
@ -342,7 +342,7 @@ void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::Time
\sa isForever(), remainingTime()
*/
bool QDeadlineTimer::hasExpired() const Q_DECL_NOTHROW
bool QDeadlineTimer::hasExpired() const noexcept
{
if (isForever())
return false;
@ -389,7 +389,7 @@ void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
\sa remainingTimeNSecs(), isForever(), hasExpired()
*/
qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
qint64 QDeadlineTimer::remainingTime() const noexcept
{
qint64 ns = remainingTimeNSecs();
return ns <= 0 ? ns : (ns + 999999) / (1000 * 1000);
@ -403,7 +403,7 @@ qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
\sa remainingTime(), isForever(), hasExpired()
*/
qint64 QDeadlineTimer::remainingTimeNSecs() const Q_DECL_NOTHROW
qint64 QDeadlineTimer::remainingTimeNSecs() const noexcept
{
if (isForever())
return -1;
@ -416,7 +416,7 @@ qint64 QDeadlineTimer::remainingTimeNSecs() const Q_DECL_NOTHROW
Same as remainingTimeNSecs, but may return negative remaining times. Does
not deal with Forever.
*/
qint64 QDeadlineTimer::rawRemainingTimeNSecs() const Q_DECL_NOTHROW
qint64 QDeadlineTimer::rawRemainingTimeNSecs() const noexcept
{
QDeadlineTimer now = current(timerType());
if (QDeadlineTimerNanosecondsInT2)
@ -444,7 +444,7 @@ qint64 QDeadlineTimer::rawRemainingTimeNSecs() const Q_DECL_NOTHROW
\sa remainingTime(), deadlineNSecs(), setDeadline()
*/
qint64 QDeadlineTimer::deadline() const Q_DECL_NOTHROW
qint64 QDeadlineTimer::deadline() const noexcept
{
if (isForever())
return t1;
@ -471,7 +471,7 @@ qint64 QDeadlineTimer::deadline() const Q_DECL_NOTHROW
\sa remainingTime(), deadlineNSecs()
*/
qint64 QDeadlineTimer::deadlineNSecs() const Q_DECL_NOTHROW
qint64 QDeadlineTimer::deadlineNSecs() const noexcept
{
if (isForever())
return t1;
@ -492,7 +492,7 @@ qint64 QDeadlineTimer::deadlineNSecs() const Q_DECL_NOTHROW
\sa setPreciseDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
*/
void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) noexcept
{
if (msecs == (std::numeric_limits<qint64>::max)()) {
setPreciseDeadline(msecs, 0, timerType); // msecs == MAX implies Forever
@ -513,7 +513,7 @@ void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) Q_DECL_N
\sa setDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
*/
void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType timerType) noexcept
{
type = timerType;
if (secs == (std::numeric_limits<qint64>::max)() || nsecs == (std::numeric_limits<qint64>::max)()) {
@ -534,7 +534,7 @@ void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType
\note if \a dt was created as expired, its deadline is indeterminate and
adding an amount of time may or may not cause it to become unexpired.
*/
QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW
QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) noexcept
{
if (dt.isForever() || nsecs == (std::numeric_limits<qint64>::max)()) {
dt = QDeadlineTimer(Forever, dt.timerType());

View File

@ -63,49 +63,49 @@ class Q_CORE_EXPORT QDeadlineTimer
public:
enum ForeverConstant { Forever };
Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) noexcept
: t1(0), t2(0), type(type_) {}
Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) noexcept
: t1(std::numeric_limits<qint64>::max()), t2(0), type(type_) {}
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept;
void swap(QDeadlineTimer &other) Q_DECL_NOTHROW
void swap(QDeadlineTimer &other) noexcept
{ qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); }
Q_DECL_CONSTEXPR bool isForever() const Q_DECL_NOTHROW
Q_DECL_CONSTEXPR bool isForever() const noexcept
{ return t1 == (std::numeric_limits<qint64>::max)(); }
bool hasExpired() const Q_DECL_NOTHROW;
bool hasExpired() const noexcept;
Qt::TimerType timerType() const Q_DECL_NOTHROW
Qt::TimerType timerType() const noexcept
{ return Qt::TimerType(type & 0xff); }
void setTimerType(Qt::TimerType type);
qint64 remainingTime() const Q_DECL_NOTHROW;
qint64 remainingTimeNSecs() const Q_DECL_NOTHROW;
void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
qint64 remainingTime() const noexcept;
qint64 remainingTimeNSecs() const noexcept;
void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept;
void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0,
Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
Qt::TimerType type = Qt::CoarseTimer) noexcept;
qint64 deadline() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
qint64 deadlineNSecs() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
qint64 deadline() const noexcept Q_DECL_PURE_FUNCTION;
qint64 deadlineNSecs() const noexcept Q_DECL_PURE_FUNCTION;
void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) noexcept;
void setPreciseDeadline(qint64 secs, qint64 nsecs = 0,
Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
Qt::TimerType type = Qt::CoarseTimer) noexcept;
static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) noexcept Q_DECL_PURE_FUNCTION;
static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) noexcept;
friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
{ return d1.t1 == d2.t1 && d1.t2 == d2.t2; }
friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
{ return !(d1 == d2); }
friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
{ return d1.t1 < d2.t1 || (d1.t1 == d2.t1 && d1.t2 < d2.t2); }
friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
{ return d1 == d2 || d1 < d2; }
friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
{ return d2 < d1; }
friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) Q_DECL_NOTHROW
friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2) noexcept
{ return !(d1 < d2); }
friend QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
@ -160,7 +160,7 @@ public:
setPreciseRemainingTime(0, std::chrono::nanoseconds(remaining).count(), type_);
}
std::chrono::nanoseconds remainingTimeAsDuration() const Q_DECL_NOTHROW
std::chrono::nanoseconds remainingTimeAsDuration() const noexcept
{
if (isForever())
return std::chrono::nanoseconds::max();
@ -186,7 +186,7 @@ private:
unsigned t2;
unsigned type;
qint64 rawRemainingTimeNSecs() const Q_DECL_NOTHROW;
qint64 rawRemainingTimeNSecs() const noexcept;
public:
// This is not a public function, it's here only for Qt's internal convenience...

View File

@ -236,7 +236,7 @@ static const qint64 invalidData = Q_INT64_C(0x8000000000000000);
\sa isValid(), start(), restart()
*/
void QElapsedTimer::invalidate() Q_DECL_NOTHROW
void QElapsedTimer::invalidate() noexcept
{
t1 = t2 = invalidData;
}
@ -247,7 +247,7 @@ void QElapsedTimer::invalidate() Q_DECL_NOTHROW
\sa invalidate(), start(), restart()
*/
bool QElapsedTimer::isValid() const Q_DECL_NOTHROW
bool QElapsedTimer::isValid() const noexcept
{
return t1 != invalidData && t2 != invalidData;
}
@ -260,7 +260,7 @@ bool QElapsedTimer::isValid() const Q_DECL_NOTHROW
\sa elapsed(), QDeadlineTimer
*/
bool QElapsedTimer::hasExpired(qint64 timeout) const Q_DECL_NOTHROW
bool QElapsedTimer::hasExpired(qint64 timeout) const noexcept
{
// if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be
// considered as never expired

View File

@ -62,28 +62,28 @@ public:
{
}
static ClockType clockType() Q_DECL_NOTHROW;
static bool isMonotonic() Q_DECL_NOTHROW;
static ClockType clockType() noexcept;
static bool isMonotonic() noexcept;
void start() Q_DECL_NOTHROW;
qint64 restart() Q_DECL_NOTHROW;
void invalidate() Q_DECL_NOTHROW;
bool isValid() const Q_DECL_NOTHROW;
void start() noexcept;
qint64 restart() noexcept;
void invalidate() noexcept;
bool isValid() const noexcept;
qint64 nsecsElapsed() const Q_DECL_NOTHROW;
qint64 elapsed() const Q_DECL_NOTHROW;
bool hasExpired(qint64 timeout) const Q_DECL_NOTHROW;
qint64 nsecsElapsed() const noexcept;
qint64 elapsed() const noexcept;
bool hasExpired(qint64 timeout) const noexcept;
qint64 msecsSinceReference() const Q_DECL_NOTHROW;
qint64 msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW;
qint64 secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW;
qint64 msecsSinceReference() const noexcept;
qint64 msecsTo(const QElapsedTimer &other) const noexcept;
qint64 secsTo(const QElapsedTimer &other) const noexcept;
bool operator==(const QElapsedTimer &other) const Q_DECL_NOTHROW
bool operator==(const QElapsedTimer &other) const noexcept
{ return t1 == other.t1 && t2 == other.t2; }
bool operator!=(const QElapsedTimer &other) const Q_DECL_NOTHROW
bool operator!=(const QElapsedTimer &other) const noexcept
{ return !(*this == other); }
friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW;
friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept;
private:
qint64 t1;

View File

@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\sa isMonotonic()
*/
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
{
return SystemTime;
}
@ -60,7 +60,7 @@ QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
\sa clockType(), QElapsedTimer::ClockType
*/
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
bool QElapsedTimer::isMonotonic() noexcept
{
return false;
}
@ -75,7 +75,7 @@ bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
\sa restart(), invalidate(), elapsed()
*/
void QElapsedTimer::start() Q_DECL_NOTHROW
void QElapsedTimer::start() noexcept
{
restart();
}
@ -97,7 +97,7 @@ void QElapsedTimer::start() Q_DECL_NOTHROW
\sa start(), invalidate(), elapsed(), isValid()
*/
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
qint64 QElapsedTimer::restart() noexcept
{
qint64 old = t1;
t1 = QDateTime::currentMSecsSinceEpoch();
@ -118,7 +118,7 @@ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
\sa start(), restart(), hasExpired(), invalidate()
*/
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::nsecsElapsed() const noexcept
{
return elapsed() * 1000000;
}
@ -132,7 +132,7 @@ qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
\sa start(), restart(), hasExpired(), isValid(), invalidate()
*/
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::elapsed() const noexcept
{
return QDateTime::currentMSecsSinceEpoch() - t1;
}
@ -152,7 +152,7 @@ qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
\sa clockType(), elapsed()
*/
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsSinceReference() const noexcept
{
return t1;
}
@ -167,7 +167,7 @@ qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
\sa secsTo(), elapsed()
*/
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
{
qint64 diff = other.t1 - t1;
return diff;
@ -183,7 +183,7 @@ qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
\sa msecsTo(), elapsed()
*/
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
{
return msecsTo(other) / 1000;
}
@ -197,12 +197,12 @@ qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
and the other isn't. However, two invalid timers are equal and thus this
function will return false.
*/
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
{
return v1.t1 < v2.t1;
}
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
{
QDeadlineTimer result;
result.t1 = QDateTime::currentMSecsSinceEpoch() * 1000 * 1000;

View File

@ -58,12 +58,12 @@ typedef __int128_t LargeInt;
typedef qint64 LargeInt;
#endif
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
{
return MachAbsoluteTime;
}
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
bool QElapsedTimer::isMonotonic() noexcept
{
return true;
}
@ -87,7 +87,7 @@ static qint64 absoluteToMSecs(qint64 cpuTime)
return absoluteToNSecs(cpuTime) / 1000000;
}
timespec qt_gettime() Q_DECL_NOTHROW
timespec qt_gettime() noexcept
{
timespec tv;
@ -107,13 +107,13 @@ void qt_nanosleep(timespec amount)
EINTR_LOOP(r, nanosleep(&amount, &amount));
}
void QElapsedTimer::start() Q_DECL_NOTHROW
void QElapsedTimer::start() noexcept
{
t1 = mach_absolute_time();
t2 = 0;
}
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
qint64 QElapsedTimer::restart() noexcept
{
qint64 old = t1;
t1 = mach_absolute_time();
@ -122,39 +122,39 @@ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
return absoluteToMSecs(t1 - old);
}
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::nsecsElapsed() const noexcept
{
uint64_t cpu_time = mach_absolute_time();
return absoluteToNSecs(cpu_time - t1);
}
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::elapsed() const noexcept
{
uint64_t cpu_time = mach_absolute_time();
return absoluteToMSecs(cpu_time - t1);
}
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsSinceReference() const noexcept
{
return absoluteToMSecs(t1);
}
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
{
return absoluteToMSecs(other.t1 - t1);
}
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
{
return msecsTo(other) / 1000;
}
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
{
return v1.t1 < v2.t1;
}
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
{
Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
QDeadlineTimer result;

View File

@ -150,12 +150,12 @@ static int unixCheckClockType()
#endif
}
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
bool QElapsedTimer::isMonotonic() noexcept
{
return clockType() == MonotonicClock;
}
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
{
return unixCheckClockType() == CLOCK_REALTIME ? SystemTime : MonotonicClock;
}
@ -169,7 +169,7 @@ static inline void do_gettime(qint64 *sec, qint64 *frac)
}
// used in qcore_unix.cpp and qeventdispatcher_unix.cpp
struct timespec qt_gettime() Q_DECL_NOTHROW
struct timespec qt_gettime() noexcept
{
qint64 sec, frac;
do_gettime(&sec, &frac);
@ -204,17 +204,17 @@ static qint64 elapsedAndRestart(qint64 sec, qint64 frac,
return (sec * Q_INT64_C(1000000000) + frac) / Q_INT64_C(1000000);
}
void QElapsedTimer::start() Q_DECL_NOTHROW
void QElapsedTimer::start() noexcept
{
do_gettime(&t1, &t2);
}
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
qint64 QElapsedTimer::restart() noexcept
{
return elapsedAndRestart(t1, t2, &t1, &t2);
}
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::nsecsElapsed() const noexcept
{
qint64 sec, frac;
do_gettime(&sec, &frac);
@ -223,34 +223,34 @@ qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
return sec * Q_INT64_C(1000000000) + frac;
}
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::elapsed() const noexcept
{
return nsecsElapsed() / Q_INT64_C(1000000);
}
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsSinceReference() const noexcept
{
return t1 * Q_INT64_C(1000) + t2 / Q_INT64_C(1000000);
}
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
{
qint64 secs = other.t1 - t1;
qint64 fraction = other.t2 - t2;
return (secs * Q_INT64_C(1000000000) + fraction) / Q_INT64_C(1000000);
}
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
{
return other.t1 - t1;
}
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
{
return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2);
}
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
{
Q_STATIC_ASSERT(QDeadlineTimerNanosecondsInT2);
QDeadlineTimer result;

View File

@ -110,25 +110,25 @@ quint64 qt_msectime()
return ticksToNanoseconds(getTickCount()) / 1000000;
}
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
QElapsedTimer::ClockType QElapsedTimer::clockType() noexcept
{
resolveCounterFrequency();
return counterFrequency > 0 ? PerformanceCounter : TickCounter;
}
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
bool QElapsedTimer::isMonotonic() noexcept
{
return true;
}
void QElapsedTimer::start() Q_DECL_NOTHROW
void QElapsedTimer::start() noexcept
{
t1 = getTickCount();
t2 = 0;
}
qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
qint64 QElapsedTimer::restart() noexcept
{
qint64 oldt1 = t1;
t1 = getTickCount();
@ -136,40 +136,40 @@ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW
return ticksToNanoseconds(t1 - oldt1) / 1000000;
}
qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::nsecsElapsed() const noexcept
{
qint64 elapsed = getTickCount() - t1;
return ticksToNanoseconds(elapsed);
}
qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
qint64 QElapsedTimer::elapsed() const noexcept
{
qint64 elapsed = getTickCount() - t1;
return ticksToNanoseconds(elapsed) / 1000000;
}
qint64 QElapsedTimer::msecsSinceReference() const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsSinceReference() const noexcept
{
return ticksToNanoseconds(t1) / 1000000;
}
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const noexcept
{
qint64 difference = other.t1 - t1;
return ticksToNanoseconds(difference) / 1000000;
}
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW
qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const noexcept
{
return msecsTo(other) / 1000;
}
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) noexcept
{
return (v1.t1 - v2.t1) < 0;
}
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) noexcept
{
Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
QDeadlineTimer result;

View File

@ -64,10 +64,10 @@ class QEventDispatcherUNIXPrivate;
struct Q_CORE_EXPORT QSocketNotifierSetUNIX final
{
inline QSocketNotifierSetUNIX() Q_DECL_NOTHROW;
inline QSocketNotifierSetUNIX() noexcept;
inline bool isEmpty() const Q_DECL_NOTHROW;
inline short events() const Q_DECL_NOTHROW;
inline bool isEmpty() const noexcept;
inline short events() const noexcept;
QSocketNotifier *notifiers[3];
};
@ -150,19 +150,19 @@ public:
QAtomicInt interrupt; // bool
};
inline QSocketNotifierSetUNIX::QSocketNotifierSetUNIX() Q_DECL_NOTHROW
inline QSocketNotifierSetUNIX::QSocketNotifierSetUNIX() noexcept
{
notifiers[0] = nullptr;
notifiers[1] = nullptr;
notifiers[2] = nullptr;
}
inline bool QSocketNotifierSetUNIX::isEmpty() const Q_DECL_NOTHROW
inline bool QSocketNotifierSetUNIX::isEmpty() const noexcept
{
return !notifiers[0] && !notifiers[1] && !notifiers[2];
}
inline short QSocketNotifierSetUNIX::events() const Q_DECL_NOTHROW
inline short QSocketNotifierSetUNIX::events() const noexcept
{
short result = 0;

View File

@ -72,8 +72,8 @@ Q_DECLARE_TYPEINFO(Variable, Q_MOVABLE_TYPE);
struct NameEquals {
typedef bool result_type;
const char *name;
explicit NameEquals(const char *name) Q_DECL_NOTHROW : name(name) {}
result_type operator()(const Variable &other) const Q_DECL_NOTHROW
explicit NameEquals(const char *name) noexcept : name(name) {}
result_type operator()(const Variable &other) const noexcept
{ return qstrcmp(other.name, name) == 0; }
};

View File

@ -335,7 +335,7 @@ const char *QMetaObject::className() const
\since 5.7
*/
bool QMetaObject::inherits(const QMetaObject *metaObject) const Q_DECL_NOEXCEPT
bool QMetaObject::inherits(const QMetaObject *metaObject) const noexcept
{
const QMetaObject *m = this;
do {

View File

@ -915,7 +915,7 @@ template <int... TypeIds> struct MetaTypeOffsets<QtPrivate::IndexesList<TypeIds.
short offsets[sizeof...(TypeIds)];
constexpr MetaTypeOffsets() : offsets{calculateOffsetForTypeId(TypeIds)...} {}
const char *operator[](int typeId) const Q_DECL_NOTHROW
const char *operator[](int typeId) const noexcept
{
short o = offsets[typeId];
return o < 0 ? nullptr : metaTypeStrings + o;

View File

@ -1427,7 +1427,7 @@ bool QObject::eventFilter(QObject * /* watched */, QEvent * /* event */)
\sa signalsBlocked(), QSignalBlocker
*/
bool QObject::blockSignals(bool block) Q_DECL_NOTHROW
bool QObject::blockSignals(bool block) noexcept
{
Q_D(QObject);
bool previous = d->blockSig;

View File

@ -142,8 +142,8 @@ public:
inline bool isWidgetType() const { return d_ptr->isWidget; }
inline bool isWindowType() const { return d_ptr->isWindow; }
inline bool signalsBlocked() const Q_DECL_NOTHROW { return d_ptr->blockSig; }
bool blockSignals(bool b) Q_DECL_NOTHROW;
inline bool signalsBlocked() const noexcept { return d_ptr->blockSig; }
bool blockSignals(bool b) noexcept;
QThread *thread() const;
void moveToThread(QThread *thread);
@ -436,7 +436,7 @@ protected:
QScopedPointer<QObjectData> d_ptr;
static const QMetaObject staticQtMetaObject;
friend inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT;
friend inline const QMetaObject *qt_getQtMetaObject() noexcept;
friend struct QMetaObject;
friend struct QMetaObjectPrivate;
@ -467,7 +467,7 @@ inline QMetaObject::Connection QObject::connect(const QObject *asender, const ch
const char *amember, Qt::ConnectionType atype) const
{ return connect(asender, asignal, this, amember, atype); }
inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT
inline const QMetaObject *qt_getQtMetaObject() noexcept
{ return &QObject::staticQtMetaObject; }
#ifndef QT_NO_USERDATA
@ -540,17 +540,17 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *);
class QSignalBlocker
{
public:
inline explicit QSignalBlocker(QObject *o) Q_DECL_NOTHROW;
inline explicit QSignalBlocker(QObject &o) Q_DECL_NOTHROW;
inline explicit QSignalBlocker(QObject *o) noexcept;
inline explicit QSignalBlocker(QObject &o) noexcept;
inline ~QSignalBlocker();
#ifdef Q_COMPILER_RVALUE_REFS
inline QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW;
inline QSignalBlocker &operator=(QSignalBlocker &&other) Q_DECL_NOTHROW;
inline QSignalBlocker(QSignalBlocker &&other) noexcept;
inline QSignalBlocker &operator=(QSignalBlocker &&other) noexcept;
#endif
inline void reblock() Q_DECL_NOTHROW;
inline void unblock() Q_DECL_NOTHROW;
inline void reblock() noexcept;
inline void unblock() noexcept;
private:
Q_DISABLE_COPY(QSignalBlocker)
QObject * m_o;
@ -558,20 +558,20 @@ private:
bool m_inhibited;
};
QSignalBlocker::QSignalBlocker(QObject *o) Q_DECL_NOTHROW
QSignalBlocker::QSignalBlocker(QObject *o) noexcept
: m_o(o),
m_blocked(o && o->blockSignals(true)),
m_inhibited(false)
{}
QSignalBlocker::QSignalBlocker(QObject &o) Q_DECL_NOTHROW
QSignalBlocker::QSignalBlocker(QObject &o) noexcept
: m_o(&o),
m_blocked(o.blockSignals(true)),
m_inhibited(false)
{}
#ifdef Q_COMPILER_RVALUE_REFS
QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW
QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) noexcept
: m_o(other.m_o),
m_blocked(other.m_blocked),
m_inhibited(other.m_inhibited)
@ -579,7 +579,7 @@ QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW
other.m_o = nullptr;
}
QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) Q_DECL_NOTHROW
QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) noexcept
{
if (this != &other) {
// if both *this and other block the same object's signals:
@ -602,13 +602,13 @@ QSignalBlocker::~QSignalBlocker()
m_o->blockSignals(m_blocked);
}
void QSignalBlocker::reblock() Q_DECL_NOTHROW
void QSignalBlocker::reblock() noexcept
{
if (m_o) m_o->blockSignals(true);
m_inhibited = false;
}
void QSignalBlocker::unblock() Q_DECL_NOTHROW
void QSignalBlocker::unblock() noexcept
{
if (m_o) m_o->blockSignals(m_blocked);
m_inhibited = true;

View File

@ -119,13 +119,13 @@ class QString;
#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x)
#define Q_ENUM_IMPL(ENUM) \
friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
#define Q_ENUM_NS_IMPL(ENUM) \
inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
@ -340,7 +340,7 @@ struct Q_CORE_EXPORT QMetaObject
const char *className() const;
const QMetaObject *superClass() const;
bool inherits(const QMetaObject *metaObject) const Q_DECL_NOEXCEPT;
bool inherits(const QMetaObject *metaObject) const noexcept;
QObject *cast(QObject *obj) const;
const QObject *cast(const QObject *obj) const;
@ -605,8 +605,8 @@ public:
operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : nullptr; }
#endif
Connection(Connection &&o) Q_DECL_NOTHROW : d_ptr(o.d_ptr) { o.d_ptr = nullptr; }
Connection &operator=(Connection &&other) Q_DECL_NOTHROW
Connection(Connection &&o) noexcept : d_ptr(o.d_ptr) { o.d_ptr = nullptr; }
Connection &operator=(Connection &&other) noexcept
{ qSwap(d_ptr, other.d_ptr); return *this; }
};

View File

@ -386,8 +386,8 @@ namespace QtPrivate {
public:
explicit QSlotObjectBase(ImplFn fn) : m_ref(1), m_impl(fn) {}
inline int ref() Q_DECL_NOTHROW { return m_ref.ref(); }
inline void destroyIfLastRef() Q_DECL_NOTHROW
inline int ref() noexcept { return m_ref.ref(); }
inline void destroyIfLastRef() noexcept
{ if (!m_ref.deref()) m_impl(Destroy, this, nullptr, nullptr, nullptr); }
inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, nullptr, a, &ret); return ret; }

View File

@ -218,7 +218,7 @@ private:
inline int startTimer(int){ return -1;}
inline void killTimer(int){}
static Q_DECL_CONSTEXPR Qt::TimerType defaultTypeFor(int msecs) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR Qt::TimerType defaultTypeFor(int msecs) noexcept
{ return msecs >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer; }
static void singleShotImpl(int msec, Qt::TimerType timerType,
const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj);

View File

@ -201,7 +201,7 @@ class Q_CORE_EXPORT QVariant
LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type
};
QVariant() Q_DECL_NOTHROW : d() {}
QVariant() noexcept : d() {}
~QVariant();
QVariant(Type type);
QVariant(int typeId, const void *copy);
@ -268,13 +268,13 @@ class Q_CORE_EXPORT QVariant
QVariant& operator=(const QVariant &other);
#ifdef Q_COMPILER_RVALUE_REFS
inline QVariant(QVariant &&other) Q_DECL_NOTHROW : d(other.d)
inline QVariant(QVariant &&other) noexcept : d(other.d)
{ other.d = Private(); }
inline QVariant &operator=(QVariant &&other) Q_DECL_NOTHROW
inline QVariant &operator=(QVariant &&other) noexcept
{ qSwap(d, other.d); return *this; }
#endif
inline void swap(QVariant &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
inline void swap(QVariant &other) noexcept { qSwap(d, other.d); }
Type type() const;
int userType() const;
@ -387,15 +387,15 @@ class Q_CORE_EXPORT QVariant
};
struct Private
{
inline Private() Q_DECL_NOTHROW : type(Invalid), is_shared(false), is_null(true)
inline Private() noexcept : type(Invalid), is_shared(false), is_null(true)
{ data.ptr = nullptr; }
// Internal constructor for initialized variants.
explicit inline Private(uint variantType) Q_DECL_NOTHROW
explicit inline Private(uint variantType) noexcept
: type(variantType), is_shared(false), is_null(false)
{}
inline Private(const Private &other) Q_DECL_NOTHROW
inline Private(const Private &other) noexcept
: data(other.data), type(other.type),
is_shared(other.is_shared), is_null(other.is_null)
{}

View File

@ -88,7 +88,7 @@ public:
{
}
void swap(QMimeGlobPattern &other) Q_DECL_NOTHROW
void swap(QMimeGlobPattern &other) noexcept
{
qSwap(m_pattern, other.m_pattern);
qSwap(m_mimeType, other.m_mimeType);

View File

@ -69,7 +69,7 @@ public:
QMimeMagicRule(const QString &typeStr, const QByteArray &value, const QString &offsets,
const QByteArray &mask, QString *errorString);
void swap(QMimeMagicRule &other) Q_DECL_NOTHROW
void swap(QMimeMagicRule &other) noexcept
{
qSwap(m_type, other.m_type);
qSwap(m_value, other.m_value);

View File

@ -66,7 +66,7 @@ class QMimeMagicRuleMatcher
public:
explicit QMimeMagicRuleMatcher(const QString &mime, unsigned priority = 65535);
void swap(QMimeMagicRuleMatcher &other) Q_DECL_NOTHROW
void swap(QMimeMagicRuleMatcher &other) noexcept
{
qSwap(m_list, other.m_list);
qSwap(m_priority, other.m_priority);

View File

@ -192,7 +192,7 @@ bool QMimeType::operator==(const QMimeType &other) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
uint qHash(const QMimeType &key, uint seed) Q_DECL_NOTHROW
uint qHash(const QMimeType &key, uint seed) noexcept
{
return qHash(key.d->name, seed);
}

View File

@ -55,7 +55,7 @@ class QMimeTypePrivate;
class QStringList;
class QMimeType;
Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed = 0) Q_DECL_NOTHROW;
Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed = 0) noexcept;
class Q_CORE_EXPORT QMimeType
{
@ -79,9 +79,9 @@ public:
QMimeType(const QMimeType &other);
QMimeType &operator=(const QMimeType &other);
#ifdef Q_COMPILER_RVALUE_REFS
QMimeType &operator=(QMimeType &&other) Q_DECL_NOTHROW { swap(other); return *this; }
QMimeType &operator=(QMimeType &&other) noexcept { swap(other); return *this; }
#endif
void swap(QMimeType &other) Q_DECL_NOTHROW
void swap(QMimeType &other) noexcept
{
qSwap(d, other.d);
}
@ -121,7 +121,7 @@ protected:
friend class QMimeXMLProvider;
friend class QMimeBinaryProvider;
friend class QMimeTypePrivate;
friend Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed) Q_DECL_NOTHROW;
friend Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed) noexcept;
QExplicitlySharedDataPointer<QMimeTypePrivate> d;
};

View File

@ -397,7 +397,7 @@ QUuid::QUuid(const QString &text)
\sa toString(), QUuid()
*/
QUuid QUuid::fromString(QStringView text) Q_DECL_NOTHROW
QUuid QUuid::fromString(QStringView text) noexcept
{
if (text.size() > MaxStringUuidLength)
text = text.left(MaxStringUuidLength); // text.truncate(MaxStringUuidLength);
@ -427,7 +427,7 @@ QUuid QUuid::fromString(QStringView text) Q_DECL_NOTHROW
\sa toString(), QUuid()
*/
QUuid QUuid::fromString(QLatin1String text) Q_DECL_NOTHROW
QUuid QUuid::fromString(QLatin1String text) noexcept
{
if (Q_UNLIKELY(text.size() < MaxStringUuidLength - 2
|| (text.front() == QLatin1Char('{') && text.size() < MaxStringUuidLength - 1))) {
@ -864,7 +864,7 @@ QDataStream &operator>>(QDataStream &s, QUuid &id)
Returns \c true if this is the null UUID
{00000000-0000-0000-0000-000000000000}; otherwise returns \c false.
*/
bool QUuid::isNull() const Q_DECL_NOTHROW
bool QUuid::isNull() const noexcept
{
return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 &&
data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 &&
@ -913,7 +913,7 @@ bool QUuid::isNull() const Q_DECL_NOTHROW
\sa version()
*/
QUuid::Variant QUuid::variant() const Q_DECL_NOTHROW
QUuid::Variant QUuid::variant() const noexcept
{
if (isNull())
return VarUnknown;
@ -934,7 +934,7 @@ QUuid::Variant QUuid::variant() const Q_DECL_NOTHROW
\sa variant()
*/
QUuid::Version QUuid::version() const Q_DECL_NOTHROW
QUuid::Version QUuid::version() const noexcept
{
// Check the 4 MSB of data3
Version ver = (Version)(data3>>12);
@ -957,7 +957,7 @@ QUuid::Version QUuid::version() const Q_DECL_NOTHROW
\sa variant()
*/
bool QUuid::operator<(const QUuid &other) const Q_DECL_NOTHROW
bool QUuid::operator<(const QUuid &other) const noexcept
{
if (variant() != other.variant())
return variant() < other.variant();
@ -984,7 +984,7 @@ bool QUuid::operator<(const QUuid &other) const Q_DECL_NOTHROW
\sa variant()
*/
bool QUuid::operator>(const QUuid &other) const Q_DECL_NOTHROW
bool QUuid::operator>(const QUuid &other) const noexcept
{
return other < *this;
}
@ -1089,7 +1089,7 @@ QDebug operator<<(QDebug dbg, const QUuid &id)
\relates QUuid
Returns a hash of the UUID \a uuid, using \a seed to seed the calculation.
*/
uint qHash(const QUuid &uuid, uint seed) Q_DECL_NOTHROW
uint qHash(const QUuid &uuid, uint seed) noexcept
{
return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16)
^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])

View File

@ -93,13 +93,13 @@ public:
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_CLANG_QDOC)
Q_DECL_CONSTEXPR QUuid() Q_DECL_NOTHROW : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
Q_DECL_CONSTEXPR QUuid() noexcept : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) Q_DECL_NOTHROW
uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept
: data1(l), data2(w1), data3(w2), data4{b1, b2, b3, b4, b5, b6, b7, b8} {}
#else
QUuid() Q_DECL_NOTHROW
QUuid() noexcept
{
data1 = 0;
data2 = 0;
@ -107,7 +107,7 @@ public:
for(int i = 0; i < 8; i++)
data4[i] = 0;
}
QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) Q_DECL_NOTHROW
QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept
{
data1 = l;
data2 = w1;
@ -124,8 +124,8 @@ public:
#endif
QUuid(const QString &);
static QUuid fromString(QStringView string) Q_DECL_NOTHROW;
static QUuid fromString(QLatin1String string) Q_DECL_NOTHROW;
static QUuid fromString(QStringView string) noexcept;
static QUuid fromString(QLatin1String string) noexcept;
QUuid(const char *);
QString toString() const;
QString toString(StringFormat mode) const; // ### Qt6: merge with previous
@ -134,9 +134,9 @@ public:
QByteArray toByteArray(StringFormat mode) const; // ### Qt6: merge with previous
QByteArray toRfc4122() const;
static QUuid fromRfc4122(const QByteArray &);
bool isNull() const Q_DECL_NOTHROW;
bool isNull() const noexcept;
Q_DECL_RELAXED_CONSTEXPR bool operator==(const QUuid &orig) const Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR bool operator==(const QUuid &orig) const noexcept
{
if (data1 != orig.data1 || data2 != orig.data2 ||
data3 != orig.data3)
@ -149,24 +149,24 @@ public:
return true;
}
Q_DECL_RELAXED_CONSTEXPR bool operator!=(const QUuid &orig) const Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR bool operator!=(const QUuid &orig) const noexcept
{
return !(*this == orig);
}
bool operator<(const QUuid &other) const Q_DECL_NOTHROW;
bool operator>(const QUuid &other) const Q_DECL_NOTHROW;
bool operator<(const QUuid &other) const noexcept;
bool operator>(const QUuid &other) const noexcept;
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_CLANG_QDOC)
Q_DECL_CONSTEXPR QUuid(const GUID &guid) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR QUuid(const GUID &guid) noexcept
: data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]} {}
#else
QUuid(const GUID &guid) Q_DECL_NOTHROW
QUuid(const GUID &guid) noexcept
{
data1 = guid.Data1;
data2 = guid.Data2;
@ -176,24 +176,24 @@ public:
}
#endif
Q_DECL_RELAXED_CONSTEXPR QUuid &operator=(const GUID &guid) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR QUuid &operator=(const GUID &guid) noexcept
{
*this = QUuid(guid);
return *this;
}
Q_DECL_RELAXED_CONSTEXPR operator GUID() const Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR operator GUID() const noexcept
{
GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } };
return guid;
}
Q_DECL_RELAXED_CONSTEXPR bool operator==(const GUID &guid) const Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR bool operator==(const GUID &guid) const noexcept
{
return *this == QUuid(guid);
}
Q_DECL_RELAXED_CONSTEXPR bool operator!=(const GUID &guid) const Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR bool operator!=(const GUID &guid) const noexcept
{
return !(*this == guid);
}
@ -216,8 +216,8 @@ public:
}
QUuid::Variant variant() const Q_DECL_NOTHROW;
QUuid::Version version() const Q_DECL_NOTHROW;
QUuid::Variant variant() const noexcept;
QUuid::Version version() const noexcept;
#if defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
static QUuid fromCFUUID(CFUUIDRef uuid);
@ -243,11 +243,11 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &);
Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &);
#endif
Q_CORE_EXPORT uint qHash(const QUuid &uuid, uint seed = 0) Q_DECL_NOTHROW;
Q_CORE_EXPORT uint qHash(const QUuid &uuid, uint seed = 0) noexcept;
inline bool operator<=(const QUuid &lhs, const QUuid &rhs) Q_DECL_NOTHROW
inline bool operator<=(const QUuid &lhs, const QUuid &rhs) noexcept
{ return !(rhs < lhs); }
inline bool operator>=(const QUuid &lhs, const QUuid &rhs) Q_DECL_NOTHROW
inline bool operator>=(const QUuid &lhs, const QUuid &rhs) noexcept
{ return !(lhs < rhs); }
QT_END_NAMESPACE

View File

@ -304,7 +304,7 @@ public:
return *this;
}
QLatin1String toQLatin1String() const Q_DECL_NOTHROW {
QLatin1String toQLatin1String() const noexcept {
return QLatin1String(d->latin1, d->length);
}
@ -339,23 +339,23 @@ public:
};
#define DEF_OP(op) \
inline bool operator op(Latin1String lhs, Latin1String rhs) Q_DECL_NOTHROW \
inline bool operator op(Latin1String lhs, Latin1String rhs) noexcept \
{ \
return lhs.toQLatin1String() op rhs.toQLatin1String(); \
} \
inline bool operator op(QLatin1String lhs, Latin1String rhs) Q_DECL_NOTHROW \
inline bool operator op(QLatin1String lhs, Latin1String rhs) noexcept \
{ \
return lhs op rhs.toQLatin1String(); \
} \
inline bool operator op(Latin1String lhs, QLatin1String rhs) Q_DECL_NOTHROW \
inline bool operator op(Latin1String lhs, QLatin1String rhs) noexcept \
{ \
return lhs.toQLatin1String() op rhs; \
} \
inline bool operator op(const QString &lhs, Latin1String rhs) Q_DECL_NOTHROW \
inline bool operator op(const QString &lhs, Latin1String rhs) noexcept \
{ \
return lhs op rhs.toQLatin1String(); \
} \
inline bool operator op(Latin1String lhs, const QString &rhs) Q_DECL_NOTHROW \
inline bool operator op(Latin1String lhs, const QString &rhs) noexcept \
{ \
return lhs.toQLatin1String() op rhs; \
} \

View File

@ -72,7 +72,7 @@ public:
QJsonArray(const QJsonArray &other);
QJsonArray &operator =(const QJsonArray &other);
QJsonArray(QJsonArray &&other) Q_DECL_NOTHROW
QJsonArray(QJsonArray &&other) noexcept
: d(other.d),
a(other.a)
{
@ -80,7 +80,7 @@ public:
other.a = nullptr;
}
QJsonArray &operator =(QJsonArray &&other) Q_DECL_NOTHROW
QJsonArray &operator =(QJsonArray &&other) noexcept
{
swap(other);
return *this;
@ -115,7 +115,7 @@ public:
bool operator==(const QJsonArray &other) const;
bool operator!=(const QJsonArray &other) const;
void swap(QJsonArray &other) Q_DECL_NOTHROW
void swap(QJsonArray &other) noexcept
{
qSwap(d, other.d);
qSwap(a, other.a);

View File

@ -93,19 +93,19 @@ public:
QJsonDocument(const QJsonDocument &other);
QJsonDocument &operator =(const QJsonDocument &other);
QJsonDocument(QJsonDocument &&other) Q_DECL_NOTHROW
QJsonDocument(QJsonDocument &&other) noexcept
: d(other.d)
{
other.d = nullptr;
}
QJsonDocument &operator =(QJsonDocument &&other) Q_DECL_NOTHROW
QJsonDocument &operator =(QJsonDocument &&other) noexcept
{
swap(other);
return *this;
}
void swap(QJsonDocument &other) Q_DECL_NOTHROW
void swap(QJsonDocument &other) noexcept
{
qSwap(d, other.d);
}

View File

@ -74,20 +74,20 @@ public:
QJsonObject(const QJsonObject &other);
QJsonObject &operator =(const QJsonObject &other);
QJsonObject(QJsonObject &&other) Q_DECL_NOTHROW
QJsonObject(QJsonObject &&other) noexcept
: d(other.d), o(other.o)
{
other.d = nullptr;
other.o = nullptr;
}
QJsonObject &operator =(QJsonObject &&other) Q_DECL_NOTHROW
QJsonObject &operator =(QJsonObject &&other) noexcept
{
swap(other);
return *this;
}
void swap(QJsonObject &other) Q_DECL_NOTHROW
void swap(QJsonObject &other) noexcept
{
qSwap(d, other.d);
qSwap(o, other.o);

View File

@ -92,7 +92,7 @@ public:
QJsonValue(const QJsonValue &other);
QJsonValue &operator =(const QJsonValue &other);
QJsonValue(QJsonValue &&other) Q_DECL_NOTHROW
QJsonValue(QJsonValue &&other) noexcept
: ui(other.ui),
d(other.d),
t(other.t)
@ -102,13 +102,13 @@ public:
other.t = Null;
}
QJsonValue &operator =(QJsonValue &&other) Q_DECL_NOTHROW
QJsonValue &operator =(QJsonValue &&other) noexcept
{
swap(other);
return *this;
}
void swap(QJsonValue &other) Q_DECL_NOTHROW
void swap(QJsonValue &other) noexcept
{
qSwap(ui, other.ui);
qSwap(d, other.d);

View File

@ -213,8 +213,8 @@ typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument
class Q_CORE_EXPORT QTextStreamManipulator
{
public:
Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(nullptr), arg(a), ch() {}
Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(nullptr), mc(m), arg(-1), ch(c) {}
Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) noexcept : mf(m), mc(nullptr), arg(a), ch() {}
Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) noexcept : mf(nullptr), mc(m), arg(-1), ch(c) {}
void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } }
private:

View File

@ -60,16 +60,16 @@ public:
:m_string(aString.string()?*aString.string():QString()), m_position(aString.position()), m_size(aString.size()){}
QXmlStreamStringRef(const QString &aString) : m_string(aString), m_position(0), m_size(m_string.size()) {}
#ifdef Q_COMPILER_RVALUE_REFS
QXmlStreamStringRef(QString &&aString) Q_DECL_NOTHROW : m_string(std::move(aString)), m_position(0), m_size(m_string.size()) {}
QXmlStreamStringRef(QString &&aString) noexcept : m_string(std::move(aString)), m_position(0), m_size(m_string.size()) {}
#endif
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QXmlStreamStringRef(const QXmlStreamStringRef &other) // = default
: m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {}
#ifdef Q_COMPILER_RVALUE_REFS
QXmlStreamStringRef(QXmlStreamStringRef &&other) Q_DECL_NOTHROW // = default
QXmlStreamStringRef(QXmlStreamStringRef &&other) noexcept // = default
: m_string(std::move(other.m_string)), m_position(other.m_position), m_size(other.m_size) {}
QXmlStreamStringRef &operator=(QXmlStreamStringRef &&other) Q_DECL_NOTHROW // = default
QXmlStreamStringRef &operator=(QXmlStreamStringRef &&other) noexcept // = default
{ swap(other); return *this; }
#endif
QXmlStreamStringRef &operator=(const QXmlStreamStringRef &other) // = default
@ -79,7 +79,7 @@ public:
// ### Qt 5, since that would change the way its passed to functions. In Qt 6, remove all.
#endif // Qt < 6.0
void swap(QXmlStreamStringRef &other) Q_DECL_NOTHROW
void swap(QXmlStreamStringRef &other) noexcept
{
qSwap(m_string, other.m_string);
qSwap(m_position, other.m_position);
@ -112,7 +112,7 @@ public:
QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value);
QXmlStreamAttribute(const QXmlStreamAttribute &);
#ifdef Q_COMPILER_RVALUE_REFS
QXmlStreamAttribute(QXmlStreamAttribute &&other) Q_DECL_NOTHROW // = default;
QXmlStreamAttribute(QXmlStreamAttribute &&other) noexcept // = default;
: m_name(std::move(other.m_name)),
m_namespaceUri(std::move(other.m_namespaceUri)),
m_qualifiedName(std::move(other.m_qualifiedName)),
@ -122,7 +122,7 @@ public:
{
other.reserved = nullptr;
}
QXmlStreamAttribute &operator=(QXmlStreamAttribute &&other) Q_DECL_NOTHROW // = default;
QXmlStreamAttribute &operator=(QXmlStreamAttribute &&other) noexcept // = default;
{
m_name = std::move(other.m_name);
m_namespaceUri = std::move(other.m_namespaceUri);
@ -199,14 +199,14 @@ public:
QXmlStreamNamespaceDeclaration();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QXmlStreamNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &);
QXmlStreamNamespaceDeclaration(QXmlStreamNamespaceDeclaration &&other) Q_DECL_NOTHROW // = default
QXmlStreamNamespaceDeclaration(QXmlStreamNamespaceDeclaration &&other) noexcept // = default
: m_prefix(std::move(other.m_prefix)),
m_namespaceUri(std::move(other.m_namespaceUri)),
reserved(other.reserved)
{
other.reserved = nullptr;
}
QXmlStreamNamespaceDeclaration &operator=(QXmlStreamNamespaceDeclaration &&other) Q_DECL_NOTHROW // = default
QXmlStreamNamespaceDeclaration &operator=(QXmlStreamNamespaceDeclaration &&other) noexcept // = default
{
m_prefix = std::move(other.m_prefix);
m_namespaceUri = std::move(other.m_namespaceUri);
@ -242,7 +242,7 @@ public:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
~QXmlStreamNotationDeclaration();
QXmlStreamNotationDeclaration(const QXmlStreamNotationDeclaration &);
QXmlStreamNotationDeclaration(QXmlStreamNotationDeclaration &&other) Q_DECL_NOTHROW // = default
QXmlStreamNotationDeclaration(QXmlStreamNotationDeclaration &&other) noexcept // = default
: m_name(std::move(other.m_name)),
m_systemId(std::move(other.m_systemId)),
m_publicId(std::move(other.m_publicId)),
@ -251,7 +251,7 @@ public:
other.reserved = nullptr;
}
QXmlStreamNotationDeclaration& operator=(const QXmlStreamNotationDeclaration &);
QXmlStreamNotationDeclaration &operator=(QXmlStreamNotationDeclaration &&other) Q_DECL_NOTHROW // = default
QXmlStreamNotationDeclaration &operator=(QXmlStreamNotationDeclaration &&other) noexcept // = default
{
m_name = std::move(other.m_name);
m_systemId = std::move(other.m_systemId);
@ -287,7 +287,7 @@ public:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
~QXmlStreamEntityDeclaration();
QXmlStreamEntityDeclaration(const QXmlStreamEntityDeclaration &);
QXmlStreamEntityDeclaration(QXmlStreamEntityDeclaration &&other) Q_DECL_NOTHROW // = default
QXmlStreamEntityDeclaration(QXmlStreamEntityDeclaration &&other) noexcept // = default
: m_name(std::move(other.m_name)),
m_notationName(std::move(other.m_notationName)),
m_systemId(std::move(other.m_systemId)),
@ -298,7 +298,7 @@ public:
other.reserved = nullptr;
}
QXmlStreamEntityDeclaration& operator=(const QXmlStreamEntityDeclaration &);
QXmlStreamEntityDeclaration &operator=(QXmlStreamEntityDeclaration &&other) Q_DECL_NOTHROW // = default
QXmlStreamEntityDeclaration &operator=(QXmlStreamEntityDeclaration &&other) noexcept // = default
{
m_name = std::move(other.m_name);
m_notationName = std::move(other.m_notationName);

View File

@ -222,14 +222,14 @@ public:
{ return qHash(qMakePair(key.obj, key.prop), seed); }
friend uint qHash(const RestorableId &key) Q_DECL_NOEXCEPT_EXPR(noexcept(qHash(key, 0U)))
{ return qHash(key, 0U); }
friend bool operator==(const RestorableId &lhs, const RestorableId &rhs) Q_DECL_NOTHROW
friend bool operator==(const RestorableId &lhs, const RestorableId &rhs) noexcept
{ return lhs.obj == rhs.obj && lhs.prop == rhs.prop; }
friend bool operator!=(const RestorableId &lhs, const RestorableId &rhs) Q_DECL_NOTHROW
friend bool operator!=(const RestorableId &lhs, const RestorableId &rhs) noexcept
{ return !operator==(lhs, rhs); }
public:
explicit RestorableId(QObject *o, QByteArray p) Q_DECL_NOTHROW : guard(o), obj(o), prop(qMove(p)) {}
QObject *object() const Q_DECL_NOTHROW { return guard; }
QByteArray propertyName() const Q_DECL_NOTHROW { return prop; }
explicit RestorableId(QObject *o, QByteArray p) noexcept : guard(o), obj(o), prop(qMove(p)) {}
QObject *object() const noexcept { return guard; }
QByteArray propertyName() const noexcept { return prop; }
};
QHash<QAbstractState*, QHash<RestorableId, QVariant> > registeredRestorablesForState;
bool hasRestorable(QAbstractState *state, QObject *object, const QByteArray &propertyName) const;
@ -271,7 +271,7 @@ public:
QList<QAbstractAnimation*> handledAnimations;
QList<QAbstractAnimation*> localResetEndValues;
void swap(InitializeAnimationResult &other) Q_DECL_NOTHROW
void swap(InitializeAnimationResult &other) noexcept
{
qSwap(handledAnimations, other.handledAnimations);
qSwap(localResetEndValues, other.localResetEndValues);

View File

@ -57,15 +57,15 @@ class QAtomicInteger : public QBasicAtomicInteger<T>
public:
// Non-atomic API
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
constexpr QAtomicInteger(T value = 0) Q_DECL_NOTHROW : QBasicAtomicInteger<T>(value) {}
constexpr QAtomicInteger(T value = 0) noexcept : QBasicAtomicInteger<T>(value) {}
#else
inline QAtomicInteger(T value = 0) Q_DECL_NOTHROW
inline QAtomicInteger(T value = 0) noexcept
{
this->_q_value = value;
}
#endif
inline QAtomicInteger(const QAtomicInteger &other) Q_DECL_NOTHROW
inline QAtomicInteger(const QAtomicInteger &other) noexcept
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
: QBasicAtomicInteger<T>()
#endif
@ -73,7 +73,7 @@ public:
this->storeRelease(other.loadAcquire());
}
inline QAtomicInteger &operator=(const QAtomicInteger &other) Q_DECL_NOTHROW
inline QAtomicInteger &operator=(const QAtomicInteger &other) noexcept
{
this->storeRelease(other.loadAcquire());
return *this;
@ -159,7 +159,7 @@ public:
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
constexpr
#endif
QAtomicInt(int value = 0) Q_DECL_NOTHROW : QAtomicInteger<int>(value) {}
QAtomicInt(int value = 0) noexcept : QAtomicInteger<int>(value) {}
};
// High-level atomic pointer operations
@ -168,14 +168,14 @@ class QAtomicPointer : public QBasicAtomicPointer<T>
{
public:
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
constexpr QAtomicPointer(T *value = nullptr) Q_DECL_NOTHROW : QBasicAtomicPointer<T>(value) {}
constexpr QAtomicPointer(T *value = nullptr) noexcept : QBasicAtomicPointer<T>(value) {}
#else
inline QAtomicPointer(T *value = nullptr) Q_DECL_NOTHROW
inline QAtomicPointer(T *value = nullptr) noexcept
{
this->store(value);
}
#endif
inline QAtomicPointer(const QAtomicPointer<T> &other) Q_DECL_NOTHROW
inline QAtomicPointer(const QAtomicPointer<T> &other) noexcept
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
: QBasicAtomicPointer<T>()
#endif
@ -183,7 +183,7 @@ public:
this->storeRelease(other.loadAcquire());
}
inline QAtomicPointer<T> &operator=(const QAtomicPointer<T> &other) Q_DECL_NOTHROW
inline QAtomicPointer<T> &operator=(const QAtomicPointer<T> &other) noexcept
{
this->storeRelease(other.loadAcquire());
return *this;

View File

@ -56,16 +56,16 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
{
typedef T Type;
static bool ref(T &_q_value) Q_DECL_NOTHROW
static bool ref(T &_q_value) noexcept
{
return ++_q_value != 0;
}
static bool deref(T &_q_value) Q_DECL_NOTHROW
static bool deref(T &_q_value) noexcept
{
return --_q_value != 0;
}
static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept
{
if (currentValue)
*currentValue = _q_value;
@ -76,7 +76,7 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
return false;
}
static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
static T fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept
{
T tmp = _q_value;
_q_value = newValue;
@ -84,7 +84,7 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
}
template <typename AdditiveType> static
T fetchAndAddRelaxed(T &_q_value, AdditiveType valueToAdd) Q_DECL_NOTHROW
T fetchAndAddRelaxed(T &_q_value, AdditiveType valueToAdd) noexcept
{
T returnValue = _q_value;
_q_value += valueToAdd;

View File

@ -222,43 +222,43 @@ template <typename X> struct QAtomicOps
typedef std::atomic<X> Type;
template <typename T> static inline
T load(const std::atomic<T> &_q_value) Q_DECL_NOTHROW
T load(const std::atomic<T> &_q_value) noexcept
{
return _q_value.load(std::memory_order_relaxed);
}
template <typename T> static inline
T load(const volatile std::atomic<T> &_q_value) Q_DECL_NOTHROW
T load(const volatile std::atomic<T> &_q_value) noexcept
{
return _q_value.load(std::memory_order_relaxed);
}
template <typename T> static inline
T loadAcquire(const std::atomic<T> &_q_value) Q_DECL_NOTHROW
T loadAcquire(const std::atomic<T> &_q_value) noexcept
{
return _q_value.load(std::memory_order_acquire);
}
template <typename T> static inline
T loadAcquire(const volatile std::atomic<T> &_q_value) Q_DECL_NOTHROW
T loadAcquire(const volatile std::atomic<T> &_q_value) noexcept
{
return _q_value.load(std::memory_order_acquire);
}
template <typename T> static inline
void store(std::atomic<T> &_q_value, T newValue) Q_DECL_NOTHROW
void store(std::atomic<T> &_q_value, T newValue) noexcept
{
_q_value.store(newValue, std::memory_order_relaxed);
}
template <typename T> static inline
void storeRelease(std::atomic<T> &_q_value, T newValue) Q_DECL_NOTHROW
void storeRelease(std::atomic<T> &_q_value, T newValue) noexcept
{
_q_value.store(newValue, std::memory_order_release);
}
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return isTestAndSetNative(); }
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept { return isTestAndSetNative(); }
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept { return false; }
template <typename T>
static inline bool ref(std::atomic<T> &_q_value)
{
@ -266,17 +266,17 @@ template <typename X> struct QAtomicOps
}
template <typename T>
static inline bool deref(std::atomic<T> &_q_value) Q_DECL_NOTHROW
static inline bool deref(std::atomic<T> &_q_value) noexcept
{
return --_q_value != 0;
}
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept
{ return QAtomicTraits<sizeof(X)>::isLockFree(); }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return false; }
template <typename T>
static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed, std::memory_order_relaxed);
if (currentValue)
@ -285,7 +285,7 @@ template <typename X> struct QAtomicOps
}
template <typename T>
static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire, std::memory_order_acquire);
if (currentValue)
@ -294,7 +294,7 @@ template <typename X> struct QAtomicOps
}
template <typename T>
static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release, std::memory_order_relaxed);
if (currentValue)
@ -303,7 +303,7 @@ template <typename X> struct QAtomicOps
}
template <typename T>
static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel, std::memory_order_acquire);
if (currentValue)
@ -311,152 +311,152 @@ template <typename X> struct QAtomicOps
return tmp;
}
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return isTestAndSetNative(); }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return isTestAndSetNative(); }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return false; }
template <typename T>
static T fetchAndStoreRelaxed(std::atomic<T> &_q_value, T newValue) Q_DECL_NOTHROW
static T fetchAndStoreRelaxed(std::atomic<T> &_q_value, T newValue) noexcept
{
return _q_value.exchange(newValue, std::memory_order_relaxed);
}
template <typename T>
static T fetchAndStoreAcquire(std::atomic<T> &_q_value, T newValue) Q_DECL_NOTHROW
static T fetchAndStoreAcquire(std::atomic<T> &_q_value, T newValue) noexcept
{
return _q_value.exchange(newValue, std::memory_order_acquire);
}
template <typename T>
static T fetchAndStoreRelease(std::atomic<T> &_q_value, T newValue) Q_DECL_NOTHROW
static T fetchAndStoreRelease(std::atomic<T> &_q_value, T newValue) noexcept
{
return _q_value.exchange(newValue, std::memory_order_release);
}
template <typename T>
static T fetchAndStoreOrdered(std::atomic<T> &_q_value, T newValue) Q_DECL_NOTHROW
static T fetchAndStoreOrdered(std::atomic<T> &_q_value, T newValue) noexcept
{
return _q_value.exchange(newValue, std::memory_order_acq_rel);
}
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return isTestAndSetNative(); }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return isTestAndSetNative(); }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return false; }
template <typename T> static inline
T fetchAndAddRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_add(valueToAdd, std::memory_order_relaxed);
}
template <typename T> static inline
T fetchAndAddAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_add(valueToAdd, std::memory_order_acquire);
}
template <typename T> static inline
T fetchAndAddRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_add(valueToAdd, std::memory_order_release);
}
template <typename T> static inline
T fetchAndAddOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_add(valueToAdd, std::memory_order_acq_rel);
}
template <typename T> static inline
T fetchAndSubRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndSubRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_sub(valueToAdd, std::memory_order_relaxed);
}
template <typename T> static inline
T fetchAndSubAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndSubAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_sub(valueToAdd, std::memory_order_acquire);
}
template <typename T> static inline
T fetchAndSubRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndSubRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_sub(valueToAdd, std::memory_order_release);
}
template <typename T> static inline
T fetchAndSubOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndSubOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_sub(valueToAdd, std::memory_order_acq_rel);
}
template <typename T> static inline
T fetchAndAndRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAndRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_and(valueToAdd, std::memory_order_relaxed);
}
template <typename T> static inline
T fetchAndAndAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAndAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_and(valueToAdd, std::memory_order_acquire);
}
template <typename T> static inline
T fetchAndAndRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAndRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_and(valueToAdd, std::memory_order_release);
}
template <typename T> static inline
T fetchAndAndOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAndOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_and(valueToAdd, std::memory_order_acq_rel);
}
template <typename T> static inline
T fetchAndOrRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndOrRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_or(valueToAdd, std::memory_order_relaxed);
}
template <typename T> static inline
T fetchAndOrAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndOrAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_or(valueToAdd, std::memory_order_acquire);
}
template <typename T> static inline
T fetchAndOrRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndOrRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_or(valueToAdd, std::memory_order_release);
}
template <typename T> static inline
T fetchAndOrOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndOrOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_or(valueToAdd, std::memory_order_acq_rel);
}
template <typename T> static inline
T fetchAndXorRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndXorRelaxed(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_xor(valueToAdd, std::memory_order_relaxed);
}
template <typename T> static inline
T fetchAndXorAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndXorAcquire(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_xor(valueToAdd, std::memory_order_acquire);
}
template <typename T> static inline
T fetchAndXorRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndXorRelease(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_xor(valueToAdd, std::memory_order_release);
}
template <typename T> static inline
T fetchAndXorOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndXorOrdered(std::atomic<T> &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return _q_value.fetch_xor(valueToAdd, std::memory_order_acq_rel);
}

View File

@ -269,24 +269,24 @@ template <> struct QAtomicWindowsType<4> { typedef long Type; };
template <int N> struct QAtomicOpsBySize : QGenericAtomicOps<QAtomicOpsBySize<N> >
{
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static bool ref(T &_q_value) Q_DECL_NOTHROW;
template <typename T> static bool deref(T &_q_value) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept { return true; }
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept { return true; }
template <typename T> static bool ref(T &_q_value) noexcept;
template <typename T> static bool deref(T &_q_value) noexcept;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return true; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return true; }
template <typename T> static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) noexcept;
template <typename T>
static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW;
static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) noexcept;
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return true; }
template <typename T> static T fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept;
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return true; }
template <typename T> static T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept;
private:
typedef typename QAtomicWindowsType<N>::Type Type;
@ -303,76 +303,76 @@ struct QAtomicOps : QAtomicOpsBySize<sizeof(T)>
};
template<> template<typename T>
inline bool QAtomicOpsBySize<4>::ref(T &_q_value) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<4>::ref(T &_q_value) noexcept
{
return QT_INTERLOCKED_FUNCTION(Increment)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<4>::deref(T &_q_value) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<4>::deref(T &_q_value) noexcept
{
return QT_INTERLOCKED_FUNCTION(Decrement)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) noexcept
{
return QT_INTERLOCKED_FUNCTION(CompareExchange)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
}
template<> template <typename T>
inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) noexcept
{
*currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange)(atomic(&_q_value), newValue, expectedValue));
return *currentValue == expectedValue;
}
template<> template<typename T>
inline T QAtomicOpsBySize<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
inline T QAtomicOpsBySize<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept
{
return QT_INTERLOCKED_FUNCTION(Exchange)(atomic(&_q_value), value(newValue));
}
template<> template<typename T>
inline T QAtomicOpsBySize<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
inline T QAtomicOpsBySize<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return QT_INTERLOCKED_FUNCTION(ExchangeAdd)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
}
#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
template<> template<typename T>
inline bool QAtomicOpsBySize<2>::ref(T &_q_value) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<2>::ref(T &_q_value) noexcept
{
return QT_INTERLOCKED_FUNCTION(Increment16)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<2>::deref(T &_q_value) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<2>::deref(T &_q_value) noexcept
{
return QT_INTERLOCKED_FUNCTION(Decrement16)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) noexcept
{
return QT_INTERLOCKED_FUNCTION(CompareExchange16)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
}
template<> template <typename T>
inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) noexcept
{
*currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange16)(atomic(&_q_value), newValue, expectedValue));
return *currentValue == expectedValue;
}
template<> template<typename T>
inline T QAtomicOpsBySize<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
inline T QAtomicOpsBySize<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept
{
return QT_INTERLOCKED_FUNCTION(Exchange16)(atomic(&_q_value), value(newValue));
}
template<> template<typename T>
inline T QAtomicOpsBySize<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
inline T QAtomicOpsBySize<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return QT_INTERLOCKED_FUNCTION(ExchangeAdd16)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
}
@ -380,38 +380,38 @@ inline T QAtomicOpsBySize<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAd
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
template<> template<typename T>
inline bool QAtomicOpsBySize<8>::ref(T &_q_value) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<8>::ref(T &_q_value) noexcept
{
return QT_INTERLOCKED_FUNCTION(Increment64)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<8>::deref(T &_q_value) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<8>::deref(T &_q_value) noexcept
{
return QT_INTERLOCKED_FUNCTION(Decrement64)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) noexcept
{
return QT_INTERLOCKED_FUNCTION(CompareExchange64)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
}
template<> template <typename T>
inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) noexcept
{
*currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange64)(atomic(&_q_value), newValue, expectedValue));
return *currentValue == expectedValue;
}
template<> template<typename T>
inline T QAtomicOpsBySize<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
inline T QAtomicOpsBySize<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept
{
return QT_INTERLOCKED_FUNCTION(Exchange64)(atomic(&_q_value), value(newValue));
}
template<> template<typename T>
inline T QAtomicOpsBySize<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
inline T QAtomicOpsBySize<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
return QT_INTERLOCKED_FUNCTION(ExchangeAdd64)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
}
@ -423,41 +423,41 @@ struct QAtomicOps<T *> : QGenericAtomicOps<QAtomicOps<T *> >
{
typedef T *Type;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW;
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return true; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return true; }
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) noexcept;
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) noexcept;
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
static T *fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return true; }
static T *fetchAndStoreRelaxed(T *&_q_value, T *newValue) noexcept;
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
static T *fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return true; }
static T *fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) noexcept;
};
template <typename T>
inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW
inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) noexcept
{
return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue) == expectedValue;
}
template <typename T>
inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) Q_DECL_NOTHROW
inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) noexcept
{
*currentValue = reinterpret_cast<T *>(QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue));
return *currentValue == expectedValue;
}
template <typename T>
inline T *QAtomicOps<T *>::fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW
inline T *QAtomicOps<T *>::fetchAndStoreRelaxed(T *&_q_value, T *newValue) noexcept
{
return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, newValue));
}
template <typename T>
inline T *QAtomicOps<T *>::fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW
inline T *QAtomicOps<T *>::fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) noexcept
{
return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_ADD_POINTER(&_q_value, valueToAdd * sizeof(T)));
}

View File

@ -100,125 +100,125 @@ public:
// Everything below is either implemented in ../arch/qatomic_XXX.h or (as fallback) in qgenericatomic.h
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
T load() const noexcept { return Ops::load(_q_value); }
void store(T newValue) noexcept { Ops::store(_q_value, newValue); }
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
operator T() const Q_DECL_NOTHROW { return loadAcquire(); }
T operator=(T newValue) Q_DECL_NOTHROW { storeRelease(newValue); return newValue; }
T loadAcquire() const noexcept { return Ops::loadAcquire(_q_value); }
void storeRelease(T newValue) noexcept { Ops::storeRelease(_q_value, newValue); }
operator T() const noexcept { return loadAcquire(); }
T operator=(T newValue) noexcept { storeRelease(newValue); return newValue; }
static Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); }
static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return Ops::isReferenceCountingWaitFree(); }
static Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept { return Ops::isReferenceCountingNative(); }
static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept { return Ops::isReferenceCountingWaitFree(); }
bool ref() Q_DECL_NOTHROW { return Ops::ref(_q_value); }
bool deref() Q_DECL_NOTHROW { return Ops::deref(_q_value); }
bool ref() noexcept { return Ops::ref(_q_value); }
bool deref() noexcept { return Ops::deref(_q_value); }
static Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return Ops::isTestAndSetNative(); }
static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return Ops::isTestAndSetWaitFree(); }
static Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); }
static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); }
bool testAndSetRelaxed(T expectedValue, T newValue) Q_DECL_NOTHROW
bool testAndSetRelaxed(T expectedValue, T newValue) noexcept
{ return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); }
bool testAndSetAcquire(T expectedValue, T newValue) Q_DECL_NOTHROW
bool testAndSetAcquire(T expectedValue, T newValue) noexcept
{ return Ops::testAndSetAcquire(_q_value, expectedValue, newValue); }
bool testAndSetRelease(T expectedValue, T newValue) Q_DECL_NOTHROW
bool testAndSetRelease(T expectedValue, T newValue) noexcept
{ return Ops::testAndSetRelease(_q_value, expectedValue, newValue); }
bool testAndSetOrdered(T expectedValue, T newValue) Q_DECL_NOTHROW
bool testAndSetOrdered(T expectedValue, T newValue) noexcept
{ return Ops::testAndSetOrdered(_q_value, expectedValue, newValue); }
bool testAndSetRelaxed(T expectedValue, T newValue, T &currentValue) Q_DECL_NOTHROW
bool testAndSetRelaxed(T expectedValue, T newValue, T &currentValue) noexcept
{ return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue, &currentValue); }
bool testAndSetAcquire(T expectedValue, T newValue, T &currentValue) Q_DECL_NOTHROW
bool testAndSetAcquire(T expectedValue, T newValue, T &currentValue) noexcept
{ return Ops::testAndSetAcquire(_q_value, expectedValue, newValue, &currentValue); }
bool testAndSetRelease(T expectedValue, T newValue, T &currentValue) Q_DECL_NOTHROW
bool testAndSetRelease(T expectedValue, T newValue, T &currentValue) noexcept
{ return Ops::testAndSetRelease(_q_value, expectedValue, newValue, &currentValue); }
bool testAndSetOrdered(T expectedValue, T newValue, T &currentValue) Q_DECL_NOTHROW
bool testAndSetOrdered(T expectedValue, T newValue, T &currentValue) noexcept
{ return Ops::testAndSetOrdered(_q_value, expectedValue, newValue, &currentValue); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return Ops::isFetchAndStoreNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndStoreWaitFree(); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); }
T fetchAndStoreRelaxed(T newValue) Q_DECL_NOTHROW
T fetchAndStoreRelaxed(T newValue) noexcept
{ return Ops::fetchAndStoreRelaxed(_q_value, newValue); }
T fetchAndStoreAcquire(T newValue) Q_DECL_NOTHROW
T fetchAndStoreAcquire(T newValue) noexcept
{ return Ops::fetchAndStoreAcquire(_q_value, newValue); }
T fetchAndStoreRelease(T newValue) Q_DECL_NOTHROW
T fetchAndStoreRelease(T newValue) noexcept
{ return Ops::fetchAndStoreRelease(_q_value, newValue); }
T fetchAndStoreOrdered(T newValue) Q_DECL_NOTHROW
T fetchAndStoreOrdered(T newValue) noexcept
{ return Ops::fetchAndStoreOrdered(_q_value, newValue); }
static Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return Ops::isFetchAndAddNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndAddWaitFree(); }
static Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); }
T fetchAndAddRelaxed(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAddRelaxed(T valueToAdd) noexcept
{ return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); }
T fetchAndAddAcquire(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAddAcquire(T valueToAdd) noexcept
{ return Ops::fetchAndAddAcquire(_q_value, valueToAdd); }
T fetchAndAddRelease(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAddRelease(T valueToAdd) noexcept
{ return Ops::fetchAndAddRelease(_q_value, valueToAdd); }
T fetchAndAddOrdered(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAddOrdered(T valueToAdd) noexcept
{ return Ops::fetchAndAddOrdered(_q_value, valueToAdd); }
T fetchAndSubRelaxed(T valueToAdd) Q_DECL_NOTHROW
T fetchAndSubRelaxed(T valueToAdd) noexcept
{ return Ops::fetchAndSubRelaxed(_q_value, valueToAdd); }
T fetchAndSubAcquire(T valueToAdd) Q_DECL_NOTHROW
T fetchAndSubAcquire(T valueToAdd) noexcept
{ return Ops::fetchAndSubAcquire(_q_value, valueToAdd); }
T fetchAndSubRelease(T valueToAdd) Q_DECL_NOTHROW
T fetchAndSubRelease(T valueToAdd) noexcept
{ return Ops::fetchAndSubRelease(_q_value, valueToAdd); }
T fetchAndSubOrdered(T valueToAdd) Q_DECL_NOTHROW
T fetchAndSubOrdered(T valueToAdd) noexcept
{ return Ops::fetchAndSubOrdered(_q_value, valueToAdd); }
T fetchAndAndRelaxed(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAndRelaxed(T valueToAdd) noexcept
{ return Ops::fetchAndAndRelaxed(_q_value, valueToAdd); }
T fetchAndAndAcquire(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAndAcquire(T valueToAdd) noexcept
{ return Ops::fetchAndAndAcquire(_q_value, valueToAdd); }
T fetchAndAndRelease(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAndRelease(T valueToAdd) noexcept
{ return Ops::fetchAndAndRelease(_q_value, valueToAdd); }
T fetchAndAndOrdered(T valueToAdd) Q_DECL_NOTHROW
T fetchAndAndOrdered(T valueToAdd) noexcept
{ return Ops::fetchAndAndOrdered(_q_value, valueToAdd); }
T fetchAndOrRelaxed(T valueToAdd) Q_DECL_NOTHROW
T fetchAndOrRelaxed(T valueToAdd) noexcept
{ return Ops::fetchAndOrRelaxed(_q_value, valueToAdd); }
T fetchAndOrAcquire(T valueToAdd) Q_DECL_NOTHROW
T fetchAndOrAcquire(T valueToAdd) noexcept
{ return Ops::fetchAndOrAcquire(_q_value, valueToAdd); }
T fetchAndOrRelease(T valueToAdd) Q_DECL_NOTHROW
T fetchAndOrRelease(T valueToAdd) noexcept
{ return Ops::fetchAndOrRelease(_q_value, valueToAdd); }
T fetchAndOrOrdered(T valueToAdd) Q_DECL_NOTHROW
T fetchAndOrOrdered(T valueToAdd) noexcept
{ return Ops::fetchAndOrOrdered(_q_value, valueToAdd); }
T fetchAndXorRelaxed(T valueToAdd) Q_DECL_NOTHROW
T fetchAndXorRelaxed(T valueToAdd) noexcept
{ return Ops::fetchAndXorRelaxed(_q_value, valueToAdd); }
T fetchAndXorAcquire(T valueToAdd) Q_DECL_NOTHROW
T fetchAndXorAcquire(T valueToAdd) noexcept
{ return Ops::fetchAndXorAcquire(_q_value, valueToAdd); }
T fetchAndXorRelease(T valueToAdd) Q_DECL_NOTHROW
T fetchAndXorRelease(T valueToAdd) noexcept
{ return Ops::fetchAndXorRelease(_q_value, valueToAdd); }
T fetchAndXorOrdered(T valueToAdd) Q_DECL_NOTHROW
T fetchAndXorOrdered(T valueToAdd) noexcept
{ return Ops::fetchAndXorOrdered(_q_value, valueToAdd); }
T operator++() Q_DECL_NOTHROW
T operator++() noexcept
{ return fetchAndAddOrdered(1) + 1; }
T operator++(int) Q_DECL_NOTHROW
T operator++(int) noexcept
{ return fetchAndAddOrdered(1); }
T operator--() Q_DECL_NOTHROW
T operator--() noexcept
{ return fetchAndSubOrdered(1) - 1; }
T operator--(int) Q_DECL_NOTHROW
T operator--(int) noexcept
{ return fetchAndSubOrdered(1); }
T operator+=(T v) Q_DECL_NOTHROW
T operator+=(T v) noexcept
{ return fetchAndAddOrdered(v) + v; }
T operator-=(T v) Q_DECL_NOTHROW
T operator-=(T v) noexcept
{ return fetchAndSubOrdered(v) - v; }
T operator&=(T v) Q_DECL_NOTHROW
T operator&=(T v) noexcept
{ return fetchAndAndOrdered(v) & v; }
T operator|=(T v) Q_DECL_NOTHROW
T operator|=(T v) noexcept
{ return fetchAndOrOrdered(v) | v; }
T operator^=(T v) Q_DECL_NOTHROW
T operator^=(T v) noexcept
{ return fetchAndXorOrdered(v) ^ v; }
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
QBasicAtomicInteger() = default;
constexpr QBasicAtomicInteger(T value) Q_DECL_NOTHROW : _q_value(value) {}
constexpr QBasicAtomicInteger(T value) noexcept : _q_value(value) {}
QBasicAtomicInteger(const QBasicAtomicInteger &) = delete;
QBasicAtomicInteger &operator=(const QBasicAtomicInteger &) = delete;
QBasicAtomicInteger &operator=(const QBasicAtomicInteger &) volatile = delete;
@ -236,85 +236,85 @@ public:
AtomicType _q_value;
Type load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
void store(Type newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
operator Type() const Q_DECL_NOTHROW { return loadAcquire(); }
Type operator=(Type newValue) Q_DECL_NOTHROW { storeRelease(newValue); return newValue; }
Type load() const noexcept { return Ops::load(_q_value); }
void store(Type newValue) noexcept { Ops::store(_q_value, newValue); }
operator Type() const noexcept { return loadAcquire(); }
Type operator=(Type newValue) noexcept { storeRelease(newValue); return newValue; }
// Atomic API, implemented in qatomic_XXX.h
Type loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
void storeRelease(Type newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
Type loadAcquire() const noexcept { return Ops::loadAcquire(_q_value); }
void storeRelease(Type newValue) noexcept { Ops::storeRelease(_q_value, newValue); }
static Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return Ops::isTestAndSetNative(); }
static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return Ops::isTestAndSetWaitFree(); }
static Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); }
static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); }
bool testAndSetRelaxed(Type expectedValue, Type newValue) Q_DECL_NOTHROW
bool testAndSetRelaxed(Type expectedValue, Type newValue) noexcept
{ return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); }
bool testAndSetAcquire(Type expectedValue, Type newValue) Q_DECL_NOTHROW
bool testAndSetAcquire(Type expectedValue, Type newValue) noexcept
{ return Ops::testAndSetAcquire(_q_value, expectedValue, newValue); }
bool testAndSetRelease(Type expectedValue, Type newValue) Q_DECL_NOTHROW
bool testAndSetRelease(Type expectedValue, Type newValue) noexcept
{ return Ops::testAndSetRelease(_q_value, expectedValue, newValue); }
bool testAndSetOrdered(Type expectedValue, Type newValue) Q_DECL_NOTHROW
bool testAndSetOrdered(Type expectedValue, Type newValue) noexcept
{ return Ops::testAndSetOrdered(_q_value, expectedValue, newValue); }
bool testAndSetRelaxed(Type expectedValue, Type newValue, Type &currentValue) Q_DECL_NOTHROW
bool testAndSetRelaxed(Type expectedValue, Type newValue, Type &currentValue) noexcept
{ return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue, &currentValue); }
bool testAndSetAcquire(Type expectedValue, Type newValue, Type &currentValue) Q_DECL_NOTHROW
bool testAndSetAcquire(Type expectedValue, Type newValue, Type &currentValue) noexcept
{ return Ops::testAndSetAcquire(_q_value, expectedValue, newValue, &currentValue); }
bool testAndSetRelease(Type expectedValue, Type newValue, Type &currentValue) Q_DECL_NOTHROW
bool testAndSetRelease(Type expectedValue, Type newValue, Type &currentValue) noexcept
{ return Ops::testAndSetRelease(_q_value, expectedValue, newValue, &currentValue); }
bool testAndSetOrdered(Type expectedValue, Type newValue, Type &currentValue) Q_DECL_NOTHROW
bool testAndSetOrdered(Type expectedValue, Type newValue, Type &currentValue) noexcept
{ return Ops::testAndSetOrdered(_q_value, expectedValue, newValue, &currentValue); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return Ops::isFetchAndStoreNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndStoreWaitFree(); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); }
Type fetchAndStoreRelaxed(Type newValue) Q_DECL_NOTHROW
Type fetchAndStoreRelaxed(Type newValue) noexcept
{ return Ops::fetchAndStoreRelaxed(_q_value, newValue); }
Type fetchAndStoreAcquire(Type newValue) Q_DECL_NOTHROW
Type fetchAndStoreAcquire(Type newValue) noexcept
{ return Ops::fetchAndStoreAcquire(_q_value, newValue); }
Type fetchAndStoreRelease(Type newValue) Q_DECL_NOTHROW
Type fetchAndStoreRelease(Type newValue) noexcept
{ return Ops::fetchAndStoreRelease(_q_value, newValue); }
Type fetchAndStoreOrdered(Type newValue) Q_DECL_NOTHROW
Type fetchAndStoreOrdered(Type newValue) noexcept
{ return Ops::fetchAndStoreOrdered(_q_value, newValue); }
static Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return Ops::isFetchAndAddNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndAddWaitFree(); }
static Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); }
static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); }
Type fetchAndAddRelaxed(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndAddRelaxed(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); }
Type fetchAndAddAcquire(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndAddAcquire(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndAddAcquire(_q_value, valueToAdd); }
Type fetchAndAddRelease(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndAddRelease(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndAddRelease(_q_value, valueToAdd); }
Type fetchAndAddOrdered(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndAddOrdered(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndAddOrdered(_q_value, valueToAdd); }
Type fetchAndSubRelaxed(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndSubRelaxed(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndSubRelaxed(_q_value, valueToAdd); }
Type fetchAndSubAcquire(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndSubAcquire(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndSubAcquire(_q_value, valueToAdd); }
Type fetchAndSubRelease(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndSubRelease(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndSubRelease(_q_value, valueToAdd); }
Type fetchAndSubOrdered(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type fetchAndSubOrdered(qptrdiff valueToAdd) noexcept
{ return Ops::fetchAndSubOrdered(_q_value, valueToAdd); }
Type operator++() Q_DECL_NOTHROW
Type operator++() noexcept
{ return fetchAndAddOrdered(1) + 1; }
Type operator++(int) Q_DECL_NOTHROW
Type operator++(int) noexcept
{ return fetchAndAddOrdered(1); }
Type operator--() Q_DECL_NOTHROW
Type operator--() noexcept
{ return fetchAndSubOrdered(1) - 1; }
Type operator--(int) Q_DECL_NOTHROW
Type operator--(int) noexcept
{ return fetchAndSubOrdered(1); }
Type operator+=(qptrdiff valueToAdd) Q_DECL_NOTHROW
Type operator+=(qptrdiff valueToAdd) noexcept
{ return fetchAndAddOrdered(valueToAdd) + valueToAdd; }
Type operator-=(qptrdiff valueToSub) Q_DECL_NOTHROW
Type operator-=(qptrdiff valueToSub) noexcept
{ return fetchAndSubOrdered(valueToSub) - valueToSub; }
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
QBasicAtomicPointer() = default;
constexpr QBasicAtomicPointer(Type value) Q_DECL_NOTHROW : _q_value(value) {}
constexpr QBasicAtomicPointer(Type value) noexcept : _q_value(value) {}
QBasicAtomicPointer(const QBasicAtomicPointer &) = delete;
QBasicAtomicPointer &operator=(const QBasicAtomicPointer &) = delete;
QBasicAtomicPointer &operator=(const QBasicAtomicPointer &) volatile = delete;

View File

@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
namespace QtLinuxFutex {
constexpr inline bool futexAvailable() { return true; }
inline int _q_futex(int *addr, int op, int val, quintptr val2 = 0,
int *addr2 = nullptr, int val3 = 0) Q_DECL_NOTHROW
int *addr2 = nullptr, int val3 = 0) noexcept
{
// we use __NR_futex because some libcs (like Android's bionic) don't
// provide SYS_futex etc.

View File

@ -72,32 +72,32 @@ template <typename BaseClass> struct QGenericAtomicOps
{
template <typename T> struct AtomicType { typedef T Type; typedef T *PointerType; };
template <typename T> static void acquireMemoryFence(const T &_q_value) Q_DECL_NOTHROW
template <typename T> static void acquireMemoryFence(const T &_q_value) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
}
template <typename T> static void releaseMemoryFence(const T &_q_value) Q_DECL_NOTHROW
template <typename T> static void releaseMemoryFence(const T &_q_value) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
}
template <typename T> static void orderedMemoryFence(const T &) Q_DECL_NOTHROW
template <typename T> static void orderedMemoryFence(const T &) noexcept
{
}
template <typename T> static Q_ALWAYS_INLINE
T load(const T &_q_value) Q_DECL_NOTHROW
T load(const T &_q_value) noexcept
{
return _q_value;
}
template <typename T, typename X> static Q_ALWAYS_INLINE
void store(T &_q_value, X newValue) Q_DECL_NOTHROW
void store(T &_q_value, X newValue) noexcept
{
_q_value = newValue;
}
template <typename T> static Q_ALWAYS_INLINE
T loadAcquire(const T &_q_value) Q_DECL_NOTHROW
T loadAcquire(const T &_q_value) noexcept
{
T tmp = *static_cast<const volatile T *>(&_q_value);
BaseClass::acquireMemoryFence(_q_value);
@ -105,24 +105,24 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T, typename X> static Q_ALWAYS_INLINE
void storeRelease(T &_q_value, X newValue) Q_DECL_NOTHROW
void storeRelease(T &_q_value, X newValue) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
*static_cast<volatile T *>(&_q_value) = newValue;
}
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() noexcept
{ return BaseClass::isFetchAndAddNative(); }
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() noexcept
{ return BaseClass::isFetchAndAddWaitFree(); }
template <typename T> static Q_ALWAYS_INLINE
bool ref(T &_q_value) Q_DECL_NOTHROW
bool ref(T &_q_value) noexcept
{
return BaseClass::fetchAndAddRelaxed(_q_value, 1) != T(-1);
}
template <typename T> static Q_ALWAYS_INLINE
bool deref(T &_q_value) Q_DECL_NOTHROW
bool deref(T &_q_value) noexcept
{
return BaseClass::fetchAndAddRelaxed(_q_value, -1) != 1;
}
@ -130,16 +130,16 @@ template <typename BaseClass> struct QGenericAtomicOps
#if 0
// These functions have no default implementation
// Archictectures must implement them
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() noexcept;
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() noexcept;
template <typename T, typename X> static inline
bool testAndSetRelaxed(T &_q_value, X expectedValue, X newValue) Q_DECL_NOTHROW;
bool testAndSetRelaxed(T &_q_value, X expectedValue, X newValue) noexcept;
template <typename T, typename X> static inline
bool testAndSetRelaxed(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW;
bool testAndSetRelaxed(T &_q_value, X expectedValue, X newValue, X *currentValue) noexcept;
#endif
template <typename T, typename X> static Q_ALWAYS_INLINE
bool testAndSetAcquire(T &_q_value, X expectedValue, X newValue) Q_DECL_NOTHROW
bool testAndSetAcquire(T &_q_value, X expectedValue, X newValue) noexcept
{
bool tmp = BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue);
BaseClass::acquireMemoryFence(_q_value);
@ -147,21 +147,21 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T, typename X> static Q_ALWAYS_INLINE
bool testAndSetRelease(T &_q_value, X expectedValue, X newValue) Q_DECL_NOTHROW
bool testAndSetRelease(T &_q_value, X expectedValue, X newValue) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue);
}
template <typename T, typename X> static Q_ALWAYS_INLINE
bool testAndSetOrdered(T &_q_value, X expectedValue, X newValue) Q_DECL_NOTHROW
bool testAndSetOrdered(T &_q_value, X expectedValue, X newValue) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue);
}
template <typename T, typename X> static Q_ALWAYS_INLINE
bool testAndSetAcquire(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW
bool testAndSetAcquire(T &_q_value, X expectedValue, X newValue, X *currentValue) noexcept
{
bool tmp = BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue, currentValue);
BaseClass::acquireMemoryFence(_q_value);
@ -169,24 +169,24 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T, typename X> static Q_ALWAYS_INLINE
bool testAndSetRelease(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW
bool testAndSetRelease(T &_q_value, X expectedValue, X newValue, X *currentValue) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue, currentValue);
}
template <typename T, typename X> static Q_ALWAYS_INLINE
bool testAndSetOrdered(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW
bool testAndSetOrdered(T &_q_value, X expectedValue, X newValue, X *currentValue) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue, currentValue);
}
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() noexcept { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() noexcept { return false; }
template <typename T, typename X> static Q_ALWAYS_INLINE
T fetchAndStoreRelaxed(T &_q_value, X newValue) Q_DECL_NOTHROW
T fetchAndStoreRelaxed(T &_q_value, X newValue) noexcept
{
// implement fetchAndStore on top of testAndSet
Q_FOREVER {
@ -197,7 +197,7 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T, typename X> static Q_ALWAYS_INLINE
T fetchAndStoreAcquire(T &_q_value, X newValue) Q_DECL_NOTHROW
T fetchAndStoreAcquire(T &_q_value, X newValue) noexcept
{
T tmp = BaseClass::fetchAndStoreRelaxed(_q_value, newValue);
BaseClass::acquireMemoryFence(_q_value);
@ -205,23 +205,23 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T, typename X> static Q_ALWAYS_INLINE
T fetchAndStoreRelease(T &_q_value, X newValue) Q_DECL_NOTHROW
T fetchAndStoreRelease(T &_q_value, X newValue) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::fetchAndStoreRelaxed(_q_value, newValue);
}
template <typename T, typename X> static Q_ALWAYS_INLINE
T fetchAndStoreOrdered(T &_q_value, X newValue) Q_DECL_NOTHROW
T fetchAndStoreOrdered(T &_q_value, X newValue) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::fetchAndStoreRelaxed(_q_value, newValue);
}
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() noexcept { return false; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() noexcept { return false; }
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
// implement fetchAndAdd on top of testAndSet
Q_FOREVER {
@ -232,7 +232,7 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
T tmp = BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
BaseClass::acquireMemoryFence(_q_value);
@ -240,14 +240,14 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAddRelease(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddRelease(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAddOrdered(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
T fetchAndAddOrdered(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
@ -256,7 +256,7 @@ template <typename BaseClass> struct QGenericAtomicOps
QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4146) // unary minus operator applied to unsigned type, result still unsigned
template <typename T> static Q_ALWAYS_INLINE
T fetchAndSubRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
T fetchAndSubRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) noexcept
{
// implement fetchAndSub on top of fetchAndAdd
return fetchAndAddRelaxed(_q_value, -operand);
@ -264,7 +264,7 @@ QT_WARNING_DISABLE_MSVC(4146) // unary minus operator applied to unsigned type
QT_WARNING_POP
template <typename T> static Q_ALWAYS_INLINE
T fetchAndSubAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
T fetchAndSubAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) noexcept
{
T tmp = BaseClass::fetchAndSubRelaxed(_q_value, operand);
BaseClass::acquireMemoryFence(_q_value);
@ -272,21 +272,21 @@ QT_WARNING_POP
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndSubRelease(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
T fetchAndSubRelease(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::fetchAndSubRelaxed(_q_value, operand);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndSubOrdered(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
T fetchAndSubOrdered(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::fetchAndSubRelaxed(_q_value, operand);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAndRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndAndRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
// implement fetchAndAnd on top of testAndSet
T tmp = BaseClass::load(_q_value);
@ -297,7 +297,7 @@ QT_WARNING_POP
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAndAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndAndAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
T tmp = BaseClass::fetchAndAndRelaxed(_q_value, operand);
BaseClass::acquireMemoryFence(_q_value);
@ -305,21 +305,21 @@ QT_WARNING_POP
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAndRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndAndRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::fetchAndAndRelaxed(_q_value, operand);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndAndOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndAndOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::fetchAndAndRelaxed(_q_value, operand);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndOrRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndOrRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
// implement fetchAndOr on top of testAndSet
T tmp = BaseClass::load(_q_value);
@ -330,7 +330,7 @@ QT_WARNING_POP
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndOrAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndOrAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
T tmp = BaseClass::fetchAndOrRelaxed(_q_value, operand);
BaseClass::acquireMemoryFence(_q_value);
@ -338,21 +338,21 @@ QT_WARNING_POP
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndOrRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndOrRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::fetchAndOrRelaxed(_q_value, operand);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndOrOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndOrOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::fetchAndOrRelaxed(_q_value, operand);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndXorRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndXorRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
// implement fetchAndXor on top of testAndSet
T tmp = BaseClass::load(_q_value);
@ -363,7 +363,7 @@ QT_WARNING_POP
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndXorAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndXorAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
T tmp = BaseClass::fetchAndXorRelaxed(_q_value, operand);
BaseClass::acquireMemoryFence(_q_value);
@ -371,14 +371,14 @@ QT_WARNING_POP
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndXorRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndXorRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
BaseClass::releaseMemoryFence(_q_value);
return BaseClass::fetchAndXorRelaxed(_q_value, operand);
}
template <typename T> static Q_ALWAYS_INLINE
T fetchAndXorOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
T fetchAndXorOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) noexcept
{
BaseClass::orderedMemoryFence(_q_value);
return BaseClass::fetchAndXorRelaxed(_q_value, operand);

View File

@ -82,7 +82,7 @@ public:
QMutex mutex;
bool lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT;
void unlock() Q_DECL_NOTHROW;
void unlock() noexcept;
};
/*
@ -329,7 +329,7 @@ bool QMutex::tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT
\sa lock()
*/
void QMutex::unlock() Q_DECL_NOTHROW
void QMutex::unlock() noexcept
{
QMutexData *current;
if (fastTryUnlock(current))
@ -348,7 +348,7 @@ void QMutex::unlock() Q_DECL_NOTHROW
Returns \c true if the mutex is recursive.
*/
bool QBasicMutex::isRecursive() Q_DECL_NOTHROW
bool QBasicMutex::isRecursive() noexcept
{
return QT_PREPEND_NAMESPACE(isRecursive)(d_ptr.loadAcquire());
}
@ -358,7 +358,7 @@ bool QBasicMutex::isRecursive() Q_DECL_NOTHROW
Returns \c true if the mutex is recursive.
*/
bool QBasicMutex::isRecursive() const Q_DECL_NOTHROW
bool QBasicMutex::isRecursive() const noexcept
{
return QT_PREPEND_NAMESPACE(isRecursive)(d_ptr.loadAcquire());
}
@ -600,7 +600,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
/*!
\internal
*/
void QBasicMutex::unlockInternal() Q_DECL_NOTHROW
void QBasicMutex::unlockInternal() noexcept
{
QMutexData *copy = d_ptr.loadAcquire();
Q_ASSERT(copy); //we must be locked
@ -675,7 +675,7 @@ void QMutexPrivate::release()
}
// atomically subtract "value" to the waiters, and remove the QMutexPrivate::BigNumber flag
void QMutexPrivate::derefWaiters(int value) Q_DECL_NOTHROW
void QMutexPrivate::derefWaiters(int value) noexcept
{
int old_waiters;
int new_waiters;
@ -716,7 +716,7 @@ inline bool QRecursiveMutexPrivate::lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT
/*!
\internal
*/
inline void QRecursiveMutexPrivate::unlock() Q_DECL_NOTHROW
inline void QRecursiveMutexPrivate::unlock() noexcept
{
if (count > 0) {
count--;

View File

@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
#if QT_CONFIG(thread) || defined(Q_CLANG_QDOC)
#ifdef Q_OS_LINUX
# define QT_MUTEX_LOCK_NOEXCEPT Q_DECL_NOTHROW
# define QT_MUTEX_LOCK_NOEXCEPT noexcept
#else
# define QT_MUTEX_LOCK_NOEXCEPT
#endif
@ -80,39 +80,39 @@ public:
}
// BasicLockable concept
inline void unlock() Q_DECL_NOTHROW {
inline void unlock() noexcept {
Q_ASSERT(d_ptr.load()); //mutex must be locked
if (!fastTryUnlock())
unlockInternal();
}
bool tryLock() Q_DECL_NOTHROW {
bool tryLock() noexcept {
return fastTryLock();
}
// Lockable concept
bool try_lock() Q_DECL_NOTHROW { return tryLock(); }
bool try_lock() noexcept { return tryLock(); }
bool isRecursive() Q_DECL_NOTHROW; //### Qt6: remove me
bool isRecursive() const Q_DECL_NOTHROW;
bool isRecursive() noexcept; //### Qt6: remove me
bool isRecursive() const noexcept;
private:
inline bool fastTryLock() Q_DECL_NOTHROW {
inline bool fastTryLock() noexcept {
return d_ptr.testAndSetAcquire(nullptr, dummyLocked());
}
inline bool fastTryUnlock() Q_DECL_NOTHROW {
inline bool fastTryUnlock() noexcept {
return d_ptr.testAndSetRelease(dummyLocked(), nullptr);
}
inline bool fastTryLock(QMutexData *&current) Q_DECL_NOTHROW {
inline bool fastTryLock(QMutexData *&current) noexcept {
return d_ptr.testAndSetAcquire(nullptr, dummyLocked(), current);
}
inline bool fastTryUnlock(QMutexData *&current) Q_DECL_NOTHROW {
inline bool fastTryUnlock(QMutexData *&current) noexcept {
return d_ptr.testAndSetRelease(dummyLocked(), nullptr, current);
}
void lockInternal() QT_MUTEX_LOCK_NOEXCEPT;
bool lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT;
void unlockInternal() Q_DECL_NOTHROW;
void unlockInternal() noexcept;
QBasicAtomicPointer<QMutexData> d_ptr;
static inline QMutexData *dummyLocked() {
@ -134,7 +134,7 @@ public:
void lock() QT_MUTEX_LOCK_NOEXCEPT;
bool tryLock(int timeout = 0) QT_MUTEX_LOCK_NOEXCEPT;
// BasicLockable concept
void unlock() Q_DECL_NOTHROW;
void unlock() noexcept;
// Lockable concept
bool try_lock() QT_MUTEX_LOCK_NOEXCEPT { return tryLock(); }
@ -158,7 +158,7 @@ public:
}
#endif
bool isRecursive() const Q_DECL_NOTHROW
bool isRecursive() const noexcept
{ return QBasicMutex::isRecursive(); }
private:
@ -212,7 +212,7 @@ public:
#endif
inline ~QMutexLocker() { unlock(); }
inline void unlock() Q_DECL_NOTHROW
inline void unlock() noexcept
{
if ((val & quintptr(1u)) == quintptr(1u)) {
val &= ~quintptr(1u);
@ -257,24 +257,24 @@ class Q_CORE_EXPORT QMutex
public:
enum RecursionMode { NonRecursive, Recursive };
inline Q_DECL_CONSTEXPR explicit QMutex(RecursionMode = NonRecursive) Q_DECL_NOTHROW { }
inline Q_DECL_CONSTEXPR explicit QMutex(RecursionMode = NonRecursive) noexcept { }
inline void lock() Q_DECL_NOTHROW {}
inline bool tryLock(int timeout = 0) Q_DECL_NOTHROW { Q_UNUSED(timeout); return true; }
inline bool try_lock() Q_DECL_NOTHROW { return true; }
inline void unlock() Q_DECL_NOTHROW {}
inline bool isRecursive() const Q_DECL_NOTHROW { return true; }
inline void lock() noexcept {}
inline bool tryLock(int timeout = 0) noexcept { Q_UNUSED(timeout); return true; }
inline bool try_lock() noexcept { return true; }
inline void unlock() noexcept {}
inline bool isRecursive() const noexcept { return true; }
#if QT_HAS_INCLUDE(<chrono>)
template <class Rep, class Period>
inline bool try_lock_for(std::chrono::duration<Rep, Period> duration) Q_DECL_NOTHROW
inline bool try_lock_for(std::chrono::duration<Rep, Period> duration) noexcept
{
Q_UNUSED(duration);
return true;
}
template<class Clock, class Duration>
inline bool try_lock_until(std::chrono::time_point<Clock, Duration> timePoint) Q_DECL_NOTHROW
inline bool try_lock_until(std::chrono::time_point<Clock, Duration> timePoint) noexcept
{
Q_UNUSED(timePoint);
return true;
@ -288,12 +288,12 @@ private:
class Q_CORE_EXPORT QMutexLocker
{
public:
inline explicit QMutexLocker(QMutex *) Q_DECL_NOTHROW {}
inline ~QMutexLocker() Q_DECL_NOTHROW {}
inline explicit QMutexLocker(QMutex *) noexcept {}
inline ~QMutexLocker() noexcept {}
inline void unlock() Q_DECL_NOTHROW {}
void relock() Q_DECL_NOTHROW {}
inline QMutex *mutex() const Q_DECL_NOTHROW { return nullptr; }
inline void unlock() noexcept {}
void relock() noexcept {}
inline QMutex *mutex() const noexcept { return nullptr; }
private:
Q_DISABLE_COPY(QMutexLocker)

View File

@ -106,7 +106,7 @@ static inline QMutexData *dummyFutexValue()
}
template <bool IsTimed> static inline
bool lockInternal_helper(QBasicAtomicPointer<QMutexData> &d_ptr, int timeout = -1, QElapsedTimer *elapsedTimer = 0) Q_DECL_NOTHROW
bool lockInternal_helper(QBasicAtomicPointer<QMutexData> &d_ptr, int timeout = -1, QElapsedTimer *elapsedTimer = 0) noexcept
{
if (!IsTimed)
timeout = -1;
@ -153,13 +153,13 @@ bool lockInternal_helper(QBasicAtomicPointer<QMutexData> &d_ptr, int timeout = -
return true;
}
void QBasicMutex::lockInternal() Q_DECL_NOTHROW
void QBasicMutex::lockInternal() noexcept
{
Q_ASSERT(!isRecursive());
lockInternal_helper<false>(d_ptr);
}
bool QBasicMutex::lockInternal(int timeout) Q_DECL_NOTHROW
bool QBasicMutex::lockInternal(int timeout) noexcept
{
Q_ASSERT(!isRecursive());
QElapsedTimer elapsedTimer;
@ -167,7 +167,7 @@ bool QBasicMutex::lockInternal(int timeout) Q_DECL_NOTHROW
return lockInternal_helper<true>(d_ptr, timeout, &elapsedTimer);
}
void QBasicMutex::unlockInternal() Q_DECL_NOTHROW
void QBasicMutex::unlockInternal() noexcept
{
QMutexData *d = d_ptr.load();
Q_ASSERT(d); //we must be locked

View File

@ -79,7 +79,7 @@ bool QMutexPrivate::wait(int timeout)
return (r == KERN_SUCCESS);
}
void QMutexPrivate::wakeUp() Q_DECL_NOTHROW
void QMutexPrivate::wakeUp() noexcept
{
semaphore_signal(mach_semaphore);
}

View File

@ -92,7 +92,7 @@ public:
QMutexPrivate();
bool wait(int timeout = -1);
void wakeUp() Q_DECL_NOTHROW;
void wakeUp() noexcept;
// Control the lifetime of the privates
QAtomicInt refCount;
@ -125,7 +125,7 @@ public:
when the mutex is unlocked.
*/
enum { BigNumber = 0x100000 }; //Must be bigger than the possible number of waiters (number of threads)
void derefWaiters(int value) Q_DECL_NOTHROW;
void derefWaiters(int value) noexcept;
//platform specific stuff
#if defined(Q_OS_MAC)

View File

@ -99,7 +99,7 @@ bool QMutexPrivate::wait(int timeout)
return true;
}
void QMutexPrivate::wakeUp() Q_DECL_NOTHROW
void QMutexPrivate::wakeUp() noexcept
{
report_error(sem_post(&semaphore), "QMutex::unlock", "sem_post");
}
@ -146,7 +146,7 @@ bool QMutexPrivate::wait(int timeout)
return ret;
}
void QMutexPrivate::wakeUp() Q_DECL_NOTHROW
void QMutexPrivate::wakeUp() noexcept
{
report_error(pthread_mutex_lock(&mutex), "QMutex::unlock", "mutex lock");
wakeup = true;

View File

@ -64,7 +64,7 @@ bool QMutexPrivate::wait(int timeout)
return (WaitForSingleObjectEx(event, timeout < 0 ? INFINITE : timeout, FALSE) == WAIT_OBJECT_0);
}
void QMutexPrivate::wakeUp() Q_DECL_NOTHROW
void QMutexPrivate::wakeUp() noexcept
{ SetEvent(event); }
QT_END_NAMESPACE

View File

@ -129,7 +129,7 @@ public:
}
inline ~QBasicMutexLocker() { if (isLocked) unlock(); }
inline void unlock() Q_DECL_NOTHROW
inline void unlock() noexcept
{
isLocked = false;
m->unlock();

View File

@ -180,18 +180,18 @@ class Q_CORE_EXPORT QReadWriteLock
{
public:
enum RecursionMode { NonRecursive, Recursive };
inline explicit QReadWriteLock(RecursionMode = NonRecursive) Q_DECL_NOTHROW { }
inline explicit QReadWriteLock(RecursionMode = NonRecursive) noexcept { }
inline ~QReadWriteLock() { }
static inline void lockForRead() Q_DECL_NOTHROW { }
static inline bool tryLockForRead() Q_DECL_NOTHROW { return true; }
static inline bool tryLockForRead(int timeout) Q_DECL_NOTHROW { Q_UNUSED(timeout); return true; }
static inline void lockForRead() noexcept { }
static inline bool tryLockForRead() noexcept { return true; }
static inline bool tryLockForRead(int timeout) noexcept { Q_UNUSED(timeout); return true; }
static inline void lockForWrite() Q_DECL_NOTHROW { }
static inline bool tryLockForWrite() Q_DECL_NOTHROW { return true; }
static inline bool tryLockForWrite(int timeout) Q_DECL_NOTHROW { Q_UNUSED(timeout); return true; }
static inline void lockForWrite() noexcept { }
static inline bool tryLockForWrite() noexcept { return true; }
static inline bool tryLockForWrite(int timeout) noexcept { Q_UNUSED(timeout); return true; }
static inline void unlock() Q_DECL_NOTHROW { }
static inline void unlock() noexcept { }
private:
Q_DISABLE_COPY(QReadWriteLock)
@ -200,12 +200,12 @@ private:
class Q_CORE_EXPORT QReadLocker
{
public:
inline QReadLocker(QReadWriteLock *) Q_DECL_NOTHROW { }
inline ~QReadLocker() Q_DECL_NOTHROW { }
inline QReadLocker(QReadWriteLock *) noexcept { }
inline ~QReadLocker() noexcept { }
static inline void unlock() Q_DECL_NOTHROW { }
static inline void relock() Q_DECL_NOTHROW { }
static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return nullptr; }
static inline void unlock() noexcept { }
static inline void relock() noexcept { }
static inline QReadWriteLock *readWriteLock() noexcept { return nullptr; }
private:
Q_DISABLE_COPY(QReadLocker)
@ -214,12 +214,12 @@ private:
class Q_CORE_EXPORT QWriteLocker
{
public:
inline explicit QWriteLocker(QReadWriteLock *) Q_DECL_NOTHROW { }
inline ~QWriteLocker() Q_DECL_NOTHROW { }
inline explicit QWriteLocker(QReadWriteLock *) noexcept { }
inline ~QWriteLocker() noexcept { }
static inline void unlock() Q_DECL_NOTHROW { }
static inline void relock() Q_DECL_NOTHROW { }
static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return nullptr; }
static inline void unlock() noexcept { }
static inline void relock() noexcept { }
static inline QReadWriteLock *readWriteLock() noexcept { return nullptr; }
private:
Q_DISABLE_COPY(QWriteLocker)

View File

@ -75,14 +75,14 @@ class QSemaphoreReleaser
{
public:
QSemaphoreReleaser() = default;
explicit QSemaphoreReleaser(QSemaphore &sem, int n = 1) Q_DECL_NOTHROW
explicit QSemaphoreReleaser(QSemaphore &sem, int n = 1) noexcept
: m_sem(&sem), m_n(n) {}
explicit QSemaphoreReleaser(QSemaphore *sem, int n = 1) Q_DECL_NOTHROW
explicit QSemaphoreReleaser(QSemaphore *sem, int n = 1) noexcept
: m_sem(sem), m_n(n) {}
QSemaphoreReleaser(QSemaphoreReleaser &&other) Q_DECL_NOTHROW
QSemaphoreReleaser(QSemaphoreReleaser &&other) noexcept
: m_sem(other.m_sem), m_n(other.m_n)
{ other.m_sem = nullptr; }
QSemaphoreReleaser &operator=(QSemaphoreReleaser &&other) Q_DECL_NOTHROW
QSemaphoreReleaser &operator=(QSemaphoreReleaser &&other) noexcept
{ QSemaphoreReleaser moved(std::move(other)); swap(moved); return *this; }
~QSemaphoreReleaser()
@ -91,16 +91,16 @@ public:
m_sem->release(m_n);
}
void swap(QSemaphoreReleaser &other) Q_DECL_NOTHROW
void swap(QSemaphoreReleaser &other) noexcept
{
qSwap(m_sem, other.m_sem);
qSwap(m_n, other.m_n);
}
QSemaphore *semaphore() const Q_DECL_NOTHROW
QSemaphore *semaphore() const noexcept
{ return m_sem; }
QSemaphore *cancel() Q_DECL_NOTHROW
QSemaphore *cancel() noexcept
{
QSemaphore *old = m_sem;
m_sem = nullptr;

View File

@ -839,7 +839,7 @@ bool QThread::event(QEvent* event)
return QObject::event(event);
}
Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
Qt::HANDLE QThread::currentThreadId() noexcept
{
return Qt::HANDLE(currentThread());
}
@ -849,7 +849,7 @@ QThread *QThread::currentThread()
return QThreadData::current()->thread;
}
int QThread::idealThreadCount() Q_DECL_NOTHROW
int QThread::idealThreadCount() noexcept
{
return 1;
}

View File

@ -70,9 +70,9 @@ class Q_CORE_EXPORT QThread : public QObject
{
Q_OBJECT
public:
static Qt::HANDLE currentThreadId() Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
static Qt::HANDLE currentThreadId() noexcept Q_DECL_PURE_FUNCTION;
static QThread *currentThread();
static int idealThreadCount() Q_DECL_NOTHROW;
static int idealThreadCount() noexcept;
static void yieldCurrentThread();
explicit QThread(QObject *parent = nullptr);

View File

@ -187,8 +187,8 @@ public:
#endif // Q_OS_UNIX
#ifdef Q_OS_WIN
static unsigned int __stdcall start(void *) Q_DECL_NOEXCEPT;
static void finish(void *, bool lockAnyway=true) Q_DECL_NOEXCEPT;
static unsigned int __stdcall start(void *) noexcept;
static void finish(void *, bool lockAnyway=true) noexcept;
Qt::HANDLE handle;
unsigned int id;

View File

@ -443,7 +443,7 @@ void QThreadPrivate::finish(void *arg)
** QThread
*************************************************************************/
Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
Qt::HANDLE QThread::currentThreadId() noexcept
{
// requires a C cast here otherwise we run into trouble on AIX
return to_HANDLE(pthread_self());
@ -454,7 +454,7 @@ Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
# define _SC_NPROCESSORS_ONLN 84
#endif
int QThread::idealThreadCount() Q_DECL_NOTHROW
int QThread::idealThreadCount() noexcept
{
int cores = 1;

View File

@ -372,7 +372,7 @@ QAbstractEventDispatcher *QThreadPrivate::createEventDispatcher(QThreadData *dat
#if QT_CONFIG(thread)
unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(void *arg) Q_DECL_NOEXCEPT
unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(void *arg) noexcept
{
QThread *thr = reinterpret_cast<QThread *>(arg);
QThreadData *data = QThreadData::get2(thr);
@ -406,7 +406,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi
return 0;
}
void QThreadPrivate::finish(void *arg, bool lockAnyway) Q_DECL_NOEXCEPT
void QThreadPrivate::finish(void *arg, bool lockAnyway) noexcept
{
QThread *thr = reinterpret_cast<QThread *>(arg);
QThreadPrivate *d = thr->d_func();
@ -447,12 +447,12 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway) Q_DECL_NOEXCEPT
** QThread
*************************************************************************/
Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
Qt::HANDLE QThread::currentThreadId() noexcept
{
return reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId()));
}
int QThread::idealThreadCount() Q_DECL_NOTHROW
int QThread::idealThreadCount() noexcept
{
SYSTEM_INFO sysinfo;
#ifndef Q_OS_WINRT

View File

@ -533,7 +533,7 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera
#if defined QT_HAS_CONSTEXPR_BUILTINS
#if defined(Q_CC_GNU) || defined(Q_CC_CLANG)
# define QT_HAS_BUILTIN_CTZS
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
{
# if QT_HAS_BUILTIN(__builtin_ctzs)
return __builtin_ctzs(v);
@ -542,7 +542,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
# endif
}
#define QT_HAS_BUILTIN_CLZS
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept
{
# if QT_HAS_BUILTIN(__builtin_clzs)
return __builtin_clzs(v);
@ -551,40 +551,40 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
# endif
}
#define QT_HAS_BUILTIN_CTZ
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctz(quint32 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctz(quint32 v) noexcept
{
return __builtin_ctz(v);
}
#define QT_HAS_BUILTIN_CLZ
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clz(quint32 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clz(quint32 v) noexcept
{
return __builtin_clz(v);
}
#define QT_HAS_BUILTIN_CTZLL
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzll(quint64 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzll(quint64 v) noexcept
{
return __builtin_ctzll(v);
}
#define QT_HAS_BUILTIN_CLZLL
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzll(quint64 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzll(quint64 v) noexcept
{
return __builtin_clzll(v);
}
#define QALGORITHMS_USE_BUILTIN_POPCOUNT
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) noexcept
{
return __builtin_popcount(v);
}
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) noexcept
{
return __builtin_popcount(v);
}
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) noexcept
{
return __builtin_popcount(v);
}
#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) noexcept
{
return __builtin_popcountll(v);
}
@ -630,12 +630,12 @@ Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val)
}
#endif // MSVC 64bit
# define QT_HAS_BUILTIN_CTZS
Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
{
return qt_builtin_ctz(v);
}
#define QT_HAS_BUILTIN_CLZS
Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept
{
return qt_builtin_clz(v) - 16U;
}
@ -652,19 +652,19 @@ Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
#if defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__)
#define QALGORITHMS_USE_BUILTIN_POPCOUNT
#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) noexcept
{
return __popcnt(v);
}
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) noexcept
{
return __popcnt16(v);
}
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) noexcept
{
return __popcnt16(v);
}
Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) noexcept
{
#if Q_PROCESSOR_WORDSIZE == 8
return __popcnt64(v);
@ -685,7 +685,7 @@ Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
} //namespace QAlgorithmsPrivate
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 v) noexcept
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
return QAlgorithmsPrivate::qt_builtin_popcount(v);
@ -698,7 +698,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32
#endif
}
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 v) noexcept
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
return QAlgorithmsPrivate::qt_builtin_popcount(v);
@ -708,7 +708,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8
#endif
}
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 v) noexcept
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
return QAlgorithmsPrivate::qt_builtin_popcount(v);
@ -719,7 +719,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16
#endif
}
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 v) noexcept
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNTLL
return QAlgorithmsPrivate::qt_builtin_popcountll(v);
@ -734,7 +734,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64
#endif
}
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long unsigned int v) noexcept
{
return qPopulationCount(static_cast<quint64>(v));
}
@ -744,7 +744,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long un
#endif
#undef QT_POPCOUNT_CONSTEXPR
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CTZ)
return v ? QAlgorithmsPrivate::qt_builtin_ctz(v) : 32U;
@ -762,7 +762,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NO
#endif
}
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CTZ)
return v ? QAlgorithmsPrivate::qt_builtin_ctz(v) : 8U;
@ -777,7 +777,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) Q_DECL_NOT
#endif
}
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CTZS)
return v ? QAlgorithmsPrivate::qt_builtin_ctzs(v) : 16U;
@ -793,7 +793,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NO
#endif
}
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint64 v) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint64 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CTZLL)
return v ? QAlgorithmsPrivate::qt_builtin_ctzll(v) : 64;
@ -804,12 +804,12 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint64 v) Q_DECL_NO
#endif
}
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(unsigned long v) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(unsigned long v) noexcept
{
return qCountTrailingZeroBits(QIntegerForSizeof<long>::Unsigned(v));
}
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CLZ)
return v ? QAlgorithmsPrivate::qt_builtin_clz(v) : 32U;
@ -824,7 +824,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) Q_DECL_NOT
#endif
}
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTHROW
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CLZ)
return v ? QAlgorithmsPrivate::qt_builtin_clz(v)-24U : 8U;
@ -836,7 +836,7 @@ QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL
#endif
}
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CLZS)
return v ? QAlgorithmsPrivate::qt_builtin_clzs(v) : 16U;
@ -849,7 +849,7 @@ QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DEC
#endif
}
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DECL_NOTHROW
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) noexcept
{
#if defined(QT_HAS_BUILTIN_CLZLL)
return v ? QAlgorithmsPrivate::qt_builtin_clzll(v) : 64U;
@ -864,7 +864,7 @@ QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DEC
#endif
}
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(unsigned long v) Q_DECL_NOTHROW
QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(unsigned long v) noexcept
{
return qCountLeadingZeroBits(QIntegerForSizeof<long>::Unsigned(v));
}

View File

@ -87,7 +87,7 @@ static QArrayData *reallocateData(QArrayData *header, size_t allocSize, uint opt
}
QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
size_t capacity, AllocationOptions options) Q_DECL_NOTHROW
size_t capacity, AllocationOptions options) noexcept
{
// Alignment is a power of two
Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData)
@ -135,7 +135,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
}
QArrayData *QArrayData::reallocateUnaligned(QArrayData *data, size_t objectSize, size_t capacity,
AllocationOptions options) Q_DECL_NOTHROW
AllocationOptions options) noexcept
{
Q_ASSERT(data);
Q_ASSERT(data->isMutable());
@ -150,7 +150,7 @@ QArrayData *QArrayData::reallocateUnaligned(QArrayData *data, size_t objectSize,
}
void QArrayData::deallocate(QArrayData *data, size_t objectSize,
size_t alignment) Q_DECL_NOTHROW
size_t alignment) noexcept
{
// Alignment is a power of two
Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData)

View File

@ -113,14 +113,14 @@ struct Q_CORE_EXPORT QArrayData
}
Q_REQUIRED_RESULT static QArrayData *allocate(size_t objectSize, size_t alignment,
size_t capacity, AllocationOptions options = Default) Q_DECL_NOTHROW;
size_t capacity, AllocationOptions options = Default) noexcept;
Q_REQUIRED_RESULT static QArrayData *reallocateUnaligned(QArrayData *data, size_t objectSize,
size_t newCapacity, AllocationOptions newOptions = Default) Q_DECL_NOTHROW;
size_t newCapacity, AllocationOptions newOptions = Default) noexcept;
static void deallocate(QArrayData *data, size_t objectSize,
size_t alignment) Q_DECL_NOTHROW;
size_t alignment) noexcept;
static const QArrayData shared_null[2];
static QArrayData *sharedNull() Q_DECL_NOTHROW { return const_cast<QArrayData*>(shared_null); }
static QArrayData *sharedNull() noexcept { return const_cast<QArrayData*>(shared_null); }
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QArrayData::AllocationOptions)
@ -254,7 +254,7 @@ struct QTypedArrayData
return result;
}
static QTypedArrayData *sharedNull() Q_DECL_NOTHROW
static QTypedArrayData *sharedNull() noexcept
{
Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
return static_cast<QTypedArrayData *>(QArrayData::sharedNull());

View File

@ -52,7 +52,7 @@ private:
typedef QArrayDataOps<T> DataOps;
public:
QArrayDataPointer() Q_DECL_NOTHROW
QArrayDataPointer() noexcept
: d(Data::sharedNull())
{
}
@ -83,13 +83,13 @@ public:
}
#ifdef Q_COMPILER_RVALUE_REFS
QArrayDataPointer(QArrayDataPointer &&other) Q_DECL_NOTHROW
QArrayDataPointer(QArrayDataPointer &&other) noexcept
: d(other.d)
{
other.d = Data::sharedNull();
}
QArrayDataPointer &operator=(QArrayDataPointer &&other) Q_DECL_NOTHROW
QArrayDataPointer &operator=(QArrayDataPointer &&other) noexcept
{
QArrayDataPointer moved(std::move(other));
this->swap(moved);
@ -150,7 +150,7 @@ public:
bool isSharable() const { return d->isSharable(); }
#endif
void swap(QArrayDataPointer &other) Q_DECL_NOTHROW
void swap(QArrayDataPointer &other) noexcept
{
qSwap(d, other.d);
}

View File

@ -50,21 +50,21 @@ class Q_CORE_EXPORT QBitArray
{
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &);
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &);
friend Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed) Q_DECL_NOTHROW;
friend Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed) noexcept;
QByteArray d;
public:
inline QBitArray() Q_DECL_NOTHROW {}
inline QBitArray() noexcept {}
explicit QBitArray(int size, bool val = false);
QBitArray(const QBitArray &other) : d(other.d) {}
inline QBitArray &operator=(const QBitArray &other) { d = other.d; return *this; }
#ifdef Q_COMPILER_RVALUE_REFS
inline QBitArray(QBitArray &&other) Q_DECL_NOTHROW : d(std::move(other.d)) {}
inline QBitArray &operator=(QBitArray &&other) Q_DECL_NOTHROW
inline QBitArray(QBitArray &&other) noexcept : d(std::move(other.d)) {}
inline QBitArray &operator=(QBitArray &&other) noexcept
{ qSwap(d, other.d); return *this; }
#endif
inline void swap(QBitArray &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
inline void swap(QBitArray &other) noexcept { qSwap(d, other.d); }
inline int size() const { return (d.size() << 3) - *d.constData(); }
inline int count() const { return (d.size() << 3) - *d.constData(); }

View File

@ -165,7 +165,7 @@ int qFindByteArray(
This function returns SIZE_MAX (~0) on overflow or if the memory block size
would not fit an int.
*/
size_t qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) Q_DECL_NOTHROW
size_t qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) noexcept
{
unsigned count = unsigned(elementCount);
unsigned size = unsigned(elementSize);
@ -206,7 +206,7 @@ size_t qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t heade
needed.
*/
CalculateGrowingBlockSizeResult
qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) Q_DECL_NOTHROW
qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) noexcept
{
CalculateGrowingBlockSizeResult result = {
std::numeric_limits<size_t>::max(),std::numeric_limits<size_t>::max()
@ -1281,7 +1281,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
Assigns \a other to this byte array and returns a reference to
this byte array.
*/
QByteArray &QByteArray::operator=(const QByteArray & other) Q_DECL_NOTHROW
QByteArray &QByteArray::operator=(const QByteArray & other) noexcept
{
other.d->ref.ref();
if (!d->ref.deref())

View File

@ -168,22 +168,22 @@ public:
};
Q_DECLARE_FLAGS(Base64Options, Base64Option)
inline QByteArray() Q_DECL_NOTHROW;
inline QByteArray() noexcept;
QByteArray(const char *, int size = -1);
QByteArray(int size, char c);
QByteArray(int size, Qt::Initialization);
inline QByteArray(const QByteArray &) Q_DECL_NOTHROW;
inline QByteArray(const QByteArray &) noexcept;
inline ~QByteArray();
QByteArray &operator=(const QByteArray &) Q_DECL_NOTHROW;
QByteArray &operator=(const QByteArray &) noexcept;
QByteArray &operator=(const char *str);
#ifdef Q_COMPILER_RVALUE_REFS
inline QByteArray(QByteArray && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); }
inline QByteArray &operator=(QByteArray &&other) Q_DECL_NOTHROW
inline QByteArray(QByteArray && other) noexcept : d(other.d) { other.d = Data::sharedNull(); }
inline QByteArray &operator=(QByteArray &&other) noexcept
{ qSwap(d, other.d); return *this; }
#endif
inline void swap(QByteArray &other) Q_DECL_NOTHROW
inline void swap(QByteArray &other) noexcept
{ qSwap(d, other.d); }
inline int size() const;
@ -472,7 +472,7 @@ public:
Q_DECLARE_OPERATORS_FOR_FLAGS(QByteArray::Base64Options)
inline QByteArray::QByteArray() Q_DECL_NOTHROW : d(Data::sharedNull()) { }
inline QByteArray::QByteArray() noexcept : d(Data::sharedNull()) { }
inline QByteArray::~QByteArray() { if (!d->ref.deref()) Data::deallocate(d); }
inline int QByteArray::size() const
{ return d->size; }
@ -502,7 +502,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) Q_DECL_NOTHROW : d(a.d)
inline QByteArray::QByteArray(const QByteArray &a) noexcept : d(a.d)
{ d->ref.ref(); }
inline int QByteArray::capacity() const
@ -617,41 +617,41 @@ inline int QByteArray::compare(const QByteArray &a, Qt::CaseSensitivity cs) cons
return cs == Qt::CaseSensitive ? qstrcmp(*this, a) :
qstrnicmp(data(), size(), a.data(), a.size());
}
inline bool operator==(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator==(const QByteArray &a1, const QByteArray &a2) noexcept
{ return (a1.size() == a2.size()) && (memcmp(a1.constData(), a2.constData(), a1.size())==0); }
inline bool operator==(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW
inline bool operator==(const QByteArray &a1, const char *a2) noexcept
{ return a2 ? qstrcmp(a1,a2) == 0 : a1.isEmpty(); }
inline bool operator==(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator==(const char *a1, const QByteArray &a2) noexcept
{ return a1 ? qstrcmp(a1,a2) == 0 : a2.isEmpty(); }
inline bool operator!=(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator!=(const QByteArray &a1, const QByteArray &a2) noexcept
{ return !(a1==a2); }
inline bool operator!=(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW
inline bool operator!=(const QByteArray &a1, const char *a2) noexcept
{ return a2 ? qstrcmp(a1,a2) != 0 : !a1.isEmpty(); }
inline bool operator!=(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator!=(const char *a1, const QByteArray &a2) noexcept
{ return a1 ? qstrcmp(a1,a2) != 0 : !a2.isEmpty(); }
inline bool operator<(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator<(const QByteArray &a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) < 0; }
inline bool operator<(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW
inline bool operator<(const QByteArray &a1, const char *a2) noexcept
{ return qstrcmp(a1, a2) < 0; }
inline bool operator<(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator<(const char *a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) < 0; }
inline bool operator<=(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator<=(const QByteArray &a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) <= 0; }
inline bool operator<=(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW
inline bool operator<=(const QByteArray &a1, const char *a2) noexcept
{ return qstrcmp(a1, a2) <= 0; }
inline bool operator<=(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator<=(const char *a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) <= 0; }
inline bool operator>(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator>(const QByteArray &a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) > 0; }
inline bool operator>(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW
inline bool operator>(const QByteArray &a1, const char *a2) noexcept
{ return qstrcmp(a1, a2) > 0; }
inline bool operator>(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator>(const char *a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) > 0; }
inline bool operator>=(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator>=(const QByteArray &a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) >= 0; }
inline bool operator>=(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW
inline bool operator>=(const QByteArray &a1, const char *a2) noexcept
{ return qstrcmp(a1, a2) >= 0; }
inline bool operator>=(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW
inline bool operator>=(const char *a1, const QByteArray &a2) noexcept
{ return qstrcmp(a1, a2) >= 0; }
#if !defined(QT_USE_QSTRINGBUILDER)
inline const QByteArray operator+(const QByteArray &a1, const QByteArray &a2)

View File

@ -404,7 +404,7 @@ int qFindByteArray(
/*!
\internal
*/
int QStaticByteArrayMatcherBase::indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const Q_DECL_NOTHROW
int QStaticByteArrayMatcherBase::indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const noexcept
{
if (from < 0)
from = 0;

View File

@ -90,15 +90,15 @@ class QStaticByteArrayMatcherBase
uchar data[256];
} m_skiptable;
protected:
explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcherBase(const char *pattern, uint n) Q_DECL_NOTHROW
explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcherBase(const char *pattern, uint n) noexcept
: m_skiptable(generate(pattern, n)) {}
// compiler-generated copy/more ctors/assignment operators are ok!
// compiler-generated dtor is ok!
Q_CORE_EXPORT int indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const Q_DECL_NOTHROW;
Q_CORE_EXPORT int indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const noexcept;
private:
static Q_DECL_RELAXED_CONSTEXPR Skiptable generate(const char *pattern, uint n) Q_DECL_NOTHROW
static Q_DECL_RELAXED_CONSTEXPR Skiptable generate(const char *pattern, uint n) noexcept
{
const auto uchar_max = (std::numeric_limits<uchar>::max)();
uchar max = n > uchar_max ? uchar_max : n;
@ -140,23 +140,23 @@ class QStaticByteArrayMatcher : QStaticByteArrayMatcherBase
char m_pattern[N];
Q_STATIC_ASSERT_X(N > 2, "QStaticByteArrayMatcher makes no sense for finding a single-char pattern");
public:
explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher(const char (&patternToMatch)[N]) Q_DECL_NOTHROW
explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher(const char (&patternToMatch)[N]) noexcept
: QStaticByteArrayMatcherBase(patternToMatch, N - 1), m_pattern()
{
for (uint i = 0; i < N; ++i)
m_pattern[i] = patternToMatch[i];
}
int indexIn(const QByteArray &haystack, int from = 0) const Q_DECL_NOTHROW
int indexIn(const QByteArray &haystack, int from = 0) const noexcept
{ return this->indexOfIn(m_pattern, N - 1, haystack.data(), haystack.size(), from); }
int indexIn(const char *haystack, int hlen, int from = 0) const Q_DECL_NOTHROW
int indexIn(const char *haystack, int hlen, int from = 0) const noexcept
{ return this->indexOfIn(m_pattern, N - 1, haystack, hlen, from); }
QByteArray pattern() const { return QByteArray(m_pattern, int(N - 1)); }
};
template <uint N>
Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher<N> qMakeStaticByteArrayMatcher(const char (&pattern)[N]) Q_DECL_NOTHROW
Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher<N> qMakeStaticByteArrayMatcher(const char (&pattern)[N]) noexcept
{ return QStaticByteArrayMatcher<N>(pattern); }
QT_END_NAMESPACE

View File

@ -89,7 +89,7 @@ class QCache
Q_DISABLE_COPY(QCache)
public:
inline explicit QCache(int maxCost = 100) Q_DECL_NOTHROW;
inline explicit QCache(int maxCost = 100) noexcept;
inline ~QCache() { clear(); }
inline int maxCost() const { return mx; }
@ -116,7 +116,7 @@ private:
};
template <class Key, class T>
inline QCache<Key, T>::QCache(int amaxCost) Q_DECL_NOTHROW
inline QCache<Key, T>::QCache(int amaxCost) noexcept
: f(nullptr), l(nullptr), mx(amaxCost), total(0) {}
template <class Key, class T>

View File

@ -733,7 +733,7 @@ QT_BEGIN_NAMESPACE
Note that this gives no indication of whether the character is
available in a particular font.
*/
bool QChar::isPrint(uint ucs4) Q_DECL_NOTHROW
bool QChar::isPrint(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -766,7 +766,7 @@ bool QChar::isPrint(uint ucs4) Q_DECL_NOTHROW
/*!
\internal
*/
bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) Q_DECL_NOTHROW
bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -792,7 +792,7 @@ bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) Q_DECL_NOTHROW
Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
a mark (Mark_* categories); otherwise returns \c false.
*/
bool QChar::isMark(uint ucs4) Q_DECL_NOTHROW
bool QChar::isMark(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -816,7 +816,7 @@ bool QChar::isMark(uint ucs4) Q_DECL_NOTHROW
Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
a punctuation mark (Punctuation_* categories); otherwise returns \c false.
*/
bool QChar::isPunct(uint ucs4) Q_DECL_NOTHROW
bool QChar::isPunct(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -844,7 +844,7 @@ bool QChar::isPunct(uint ucs4) Q_DECL_NOTHROW
Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
a symbol (Symbol_* categories); otherwise returns \c false.
*/
bool QChar::isSymbol(uint ucs4) Q_DECL_NOTHROW
bool QChar::isSymbol(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -874,7 +874,7 @@ bool QChar::isSymbol(uint ucs4) Q_DECL_NOTHROW
/*!
\internal
*/
bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) Q_DECL_NOTHROW
bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -909,7 +909,7 @@ bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) Q_DECL_NOTHROW
/*!
\internal
*/
bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) Q_DECL_NOTHROW
bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -938,7 +938,7 @@ bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) Q_DECL_NOTHROW
/*!
\internal
*/
bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Q_DECL_NOTHROW
bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -1101,7 +1101,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Q_DECL_NOTHROW
Returns the numeric value of the digit specified by the UCS-4-encoded
character, \a ucs4, or -1 if the character is not a digit.
*/
int QChar::digitValue(uint ucs4) Q_DECL_NOTHROW
int QChar::digitValue(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return -1;
@ -1118,7 +1118,7 @@ int QChar::digitValue(uint ucs4) Q_DECL_NOTHROW
\overload
Returns the category of the UCS-4-encoded character specified by \a ucs4.
*/
QChar::Category QChar::category(uint ucs4) Q_DECL_NOTHROW
QChar::Category QChar::category(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return QChar::Other_NotAssigned;
@ -1135,7 +1135,7 @@ QChar::Category QChar::category(uint ucs4) Q_DECL_NOTHROW
\overload
Returns the direction of the UCS-4-encoded character specified by \a ucs4.
*/
QChar::Direction QChar::direction(uint ucs4) Q_DECL_NOTHROW
QChar::Direction QChar::direction(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return QChar::DirL;
@ -1158,7 +1158,7 @@ QChar::Direction QChar::direction(uint ucs4) Q_DECL_NOTHROW
character specified by \a ucs4
(needed for certain languages such as Arabic or Syriac).
*/
QChar::JoiningType QChar::joiningType(uint ucs4) Q_DECL_NOTHROW
QChar::JoiningType QChar::joiningType(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return QChar::Joining_None;
@ -1181,7 +1181,7 @@ QChar::JoiningType QChar::joiningType(uint ucs4) Q_DECL_NOTHROW
Returns information about the joining properties of the UCS-4-encoded
character specified by \a ucs4 (needed for certain languages such as Arabic).
*/
QChar::Joining QChar::joining(uint ucs4) Q_DECL_NOTHROW
QChar::Joining QChar::joining(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return QChar::OtherJoining;
@ -1217,7 +1217,7 @@ QChar::Joining QChar::joining(uint ucs4) Q_DECL_NOTHROW
\sa mirroredChar()
*/
bool QChar::hasMirrored(uint ucs4) Q_DECL_NOTHROW
bool QChar::hasMirrored(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return false;
@ -1299,7 +1299,7 @@ bool QChar::hasMirrored(uint ucs4) Q_DECL_NOTHROW
\sa hasMirrored()
*/
uint QChar::mirroredChar(uint ucs4) Q_DECL_NOTHROW
uint QChar::mirroredChar(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return ucs4;
@ -1383,7 +1383,7 @@ QString QChar::decomposition(uint ucs4)
Returns the tag defining the composition of the UCS-4-encoded character
specified by \a ucs4. Returns QChar::NoDecomposition if no decomposition exists.
*/
QChar::Decomposition QChar::decompositionTag(uint ucs4) Q_DECL_NOTHROW
QChar::Decomposition QChar::decompositionTag(uint ucs4) noexcept
{
if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount)
return QChar::Canonical;
@ -1409,7 +1409,7 @@ QChar::Decomposition QChar::decompositionTag(uint ucs4) Q_DECL_NOTHROW
Returns the combining class for the UCS-4-encoded character specified by
\a ucs4, as defined in the Unicode standard.
*/
unsigned char QChar::combiningClass(uint ucs4) Q_DECL_NOTHROW
unsigned char QChar::combiningClass(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return 0;
@ -1430,7 +1430,7 @@ unsigned char QChar::combiningClass(uint ucs4) Q_DECL_NOTHROW
Returns the Unicode script property value for the character specified in
its UCS-4-encoded form as \a ucs4.
*/
QChar::Script QChar::script(uint ucs4) Q_DECL_NOTHROW
QChar::Script QChar::script(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return QChar::Script_Unknown;
@ -1448,7 +1448,7 @@ QChar::Script QChar::script(uint ucs4) Q_DECL_NOTHROW
Returns the Unicode version that introduced the character specified in
its UCS-4-encoded form as \a ucs4.
*/
QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) Q_DECL_NOTHROW
QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return QChar::Unicode_Unassigned;
@ -1458,14 +1458,14 @@ QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) Q_DECL_NOTHROW
/*!
Returns the most recent supported Unicode version.
*/
QChar::UnicodeVersion QChar::currentUnicodeVersion() Q_DECL_NOTHROW
QChar::UnicodeVersion QChar::currentUnicodeVersion() noexcept
{
return UNICODE_DATA_VERSION;
}
template <typename Traits, typename T>
Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) Q_DECL_NOTHROW
Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) noexcept
{
const QUnicodeTables::Properties *prop = qGetProp(uc);
@ -1491,7 +1491,7 @@ Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) Q_DECL_NOTHROW
by \a ucs4 if the character is uppercase or titlecase; otherwise returns
the character itself.
*/
uint QChar::toLower(uint ucs4) Q_DECL_NOTHROW
uint QChar::toLower(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return ucs4;
@ -1511,7 +1511,7 @@ uint QChar::toLower(uint ucs4) Q_DECL_NOTHROW
by \a ucs4 if the character is lowercase or titlecase; otherwise returns
the character itself.
*/
uint QChar::toUpper(uint ucs4) Q_DECL_NOTHROW
uint QChar::toUpper(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return ucs4;
@ -1531,7 +1531,7 @@ uint QChar::toUpper(uint ucs4) Q_DECL_NOTHROW
by \a ucs4 if the character is lowercase or uppercase; otherwise returns
the character itself.
*/
uint QChar::toTitleCase(uint ucs4) Q_DECL_NOTHROW
uint QChar::toTitleCase(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return ucs4;
@ -1546,7 +1546,7 @@ static inline uint foldCase(const ushort *ch, const ushort *start)
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
}
static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW
static inline uint foldCase(uint ch, uint &last) noexcept
{
uint ucs4 = ch;
if (QChar::isLowSurrogate(ucs4) && QChar::isHighSurrogate(last))
@ -1555,12 +1555,12 @@ static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
}
static inline ushort foldCase(ushort ch) Q_DECL_NOTHROW
static inline ushort foldCase(ushort ch) noexcept
{
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);
}
static inline QChar foldCase(QChar ch) Q_DECL_NOTHROW
static inline QChar foldCase(QChar ch) noexcept
{
return QChar(foldCase(ch.unicode()));
}
@ -1577,7 +1577,7 @@ static inline QChar foldCase(QChar ch) Q_DECL_NOTHROW
Returns the case folded equivalent of the UCS-4-encoded character specified
by \a ucs4. For most Unicode characters this is the same as toLower().
*/
uint QChar::toCaseFolded(uint ucs4) Q_DECL_NOTHROW
uint QChar::toCaseFolded(uint ucs4) noexcept
{
if (ucs4 > LastValidCodePoint)
return ucs4;

View File

@ -50,9 +50,9 @@ class QString;
struct QLatin1Char
{
public:
Q_DECL_CONSTEXPR inline explicit QLatin1Char(char c) Q_DECL_NOTHROW : ch(c) {}
Q_DECL_CONSTEXPR inline char toLatin1() const Q_DECL_NOTHROW { return ch; }
Q_DECL_CONSTEXPR inline ushort unicode() const Q_DECL_NOTHROW { return ushort(uchar(ch)); }
Q_DECL_CONSTEXPR inline explicit QLatin1Char(char c) noexcept : ch(c) {}
Q_DECL_CONSTEXPR inline char toLatin1() const noexcept { return ch; }
Q_DECL_CONSTEXPR inline ushort unicode() const noexcept { return ushort(uchar(ch)); }
private:
char ch;
@ -78,30 +78,30 @@ public:
LastValidCodePoint = 0x10ffff
};
Q_DECL_CONSTEXPR QChar() Q_DECL_NOTHROW : ucs(0) {}
Q_DECL_CONSTEXPR QChar(ushort rc) Q_DECL_NOTHROW : ucs(rc) {} // implicit
Q_DECL_CONSTEXPR QChar(uchar c, uchar r) Q_DECL_NOTHROW : ucs(ushort((r << 8) | c)) {}
Q_DECL_CONSTEXPR QChar(short rc) Q_DECL_NOTHROW : ucs(ushort(rc)) {} // implicit
Q_DECL_CONSTEXPR QChar(uint rc) Q_DECL_NOTHROW : ucs(ushort(rc & 0xffff)) {}
Q_DECL_CONSTEXPR QChar(int rc) Q_DECL_NOTHROW : ucs(ushort(rc & 0xffff)) {}
Q_DECL_CONSTEXPR QChar(SpecialCharacter s) Q_DECL_NOTHROW : ucs(ushort(s)) {} // implicit
Q_DECL_CONSTEXPR QChar(QLatin1Char ch) Q_DECL_NOTHROW : ucs(ch.unicode()) {} // implicit
Q_DECL_CONSTEXPR QChar() noexcept : ucs(0) {}
Q_DECL_CONSTEXPR QChar(ushort rc) noexcept : ucs(rc) {} // implicit
Q_DECL_CONSTEXPR QChar(uchar c, uchar r) noexcept : ucs(ushort((r << 8) | c)) {}
Q_DECL_CONSTEXPR QChar(short rc) noexcept : ucs(ushort(rc)) {} // implicit
Q_DECL_CONSTEXPR QChar(uint rc) noexcept : ucs(ushort(rc & 0xffff)) {}
Q_DECL_CONSTEXPR QChar(int rc) noexcept : ucs(ushort(rc & 0xffff)) {}
Q_DECL_CONSTEXPR QChar(SpecialCharacter s) noexcept : ucs(ushort(s)) {} // implicit
Q_DECL_CONSTEXPR QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit
#if defined(Q_COMPILER_UNICODE_STRINGS)
Q_DECL_CONSTEXPR QChar(char16_t ch) Q_DECL_NOTHROW : ucs(ushort(ch)) {} // implicit
Q_DECL_CONSTEXPR QChar(char16_t ch) noexcept : ucs(ushort(ch)) {} // implicit
#endif
#if defined(Q_OS_WIN)
Q_STATIC_ASSERT(sizeof(wchar_t) == sizeof(ushort));
#endif
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
# if !defined(_WCHAR_T_DEFINED) || defined(_NATIVE_WCHAR_T_DEFINED)
Q_DECL_CONSTEXPR QChar(wchar_t ch) Q_DECL_NOTHROW : ucs(ushort(ch)) {} // implicit
Q_DECL_CONSTEXPR QChar(wchar_t ch) noexcept : ucs(ushort(ch)) {} // implicit
# endif
#endif
#ifndef QT_NO_CAST_FROM_ASCII
QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(char c) Q_DECL_NOTHROW : ucs(uchar(c)) { }
QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(char c) noexcept : ucs(uchar(c)) { }
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(uchar c) Q_DECL_NOTHROW : ucs(c) { }
QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(uchar c) noexcept : ucs(c) { }
#endif
#endif
// Unicode information
@ -411,11 +411,11 @@ public:
};
// ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO
inline Category category() const Q_DECL_NOTHROW { return QChar::category(ucs); }
inline Direction direction() const Q_DECL_NOTHROW { return QChar::direction(ucs); }
inline JoiningType joiningType() const Q_DECL_NOTHROW { return QChar::joiningType(ucs); }
inline Category category() const noexcept { return QChar::category(ucs); }
inline Direction direction() const noexcept { return QChar::direction(ucs); }
inline JoiningType joiningType() const noexcept { return QChar::joiningType(ucs); }
#if QT_DEPRECATED_SINCE(5, 3)
QT_DEPRECATED inline Joining joining() const Q_DECL_NOTHROW
QT_DEPRECATED inline Joining joining() const noexcept
{
switch (QChar::joiningType(ucs)) {
case QChar::Joining_Causing: return QChar::Center;
@ -428,198 +428,198 @@ public:
}
}
#endif
inline unsigned char combiningClass() const Q_DECL_NOTHROW { return QChar::combiningClass(ucs); }
inline unsigned char combiningClass() const noexcept { return QChar::combiningClass(ucs); }
inline QChar mirroredChar() const Q_DECL_NOTHROW { return QChar::mirroredChar(ucs); }
inline bool hasMirrored() const Q_DECL_NOTHROW { return QChar::hasMirrored(ucs); }
inline QChar mirroredChar() const noexcept { return QChar::mirroredChar(ucs); }
inline bool hasMirrored() const noexcept { return QChar::hasMirrored(ucs); }
QString decomposition() const;
inline Decomposition decompositionTag() const Q_DECL_NOTHROW { return QChar::decompositionTag(ucs); }
inline Decomposition decompositionTag() const noexcept { return QChar::decompositionTag(ucs); }
inline int digitValue() const Q_DECL_NOTHROW { return QChar::digitValue(ucs); }
inline QChar toLower() const Q_DECL_NOTHROW { return QChar::toLower(ucs); }
inline QChar toUpper() const Q_DECL_NOTHROW { return QChar::toUpper(ucs); }
inline QChar toTitleCase() const Q_DECL_NOTHROW { return QChar::toTitleCase(ucs); }
inline QChar toCaseFolded() const Q_DECL_NOTHROW { return QChar::toCaseFolded(ucs); }
inline int digitValue() const noexcept { return QChar::digitValue(ucs); }
inline QChar toLower() const noexcept { return QChar::toLower(ucs); }
inline QChar toUpper() const noexcept { return QChar::toUpper(ucs); }
inline QChar toTitleCase() const noexcept { return QChar::toTitleCase(ucs); }
inline QChar toCaseFolded() const noexcept { return QChar::toCaseFolded(ucs); }
inline Script script() const Q_DECL_NOTHROW { return QChar::script(ucs); }
inline Script script() const noexcept { return QChar::script(ucs); }
inline UnicodeVersion unicodeVersion() const Q_DECL_NOTHROW { return QChar::unicodeVersion(ucs); }
inline UnicodeVersion unicodeVersion() const noexcept { return QChar::unicodeVersion(ucs); }
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED Q_DECL_CONSTEXPR inline char toAscii() const Q_DECL_NOTHROW { return toLatin1(); }
QT_DEPRECATED Q_DECL_CONSTEXPR inline char toAscii() const noexcept { return toLatin1(); }
#endif
Q_DECL_CONSTEXPR inline char toLatin1() const Q_DECL_NOTHROW { return ucs > 0xff ? '\0' : char(ucs); }
Q_DECL_CONSTEXPR inline ushort unicode() const Q_DECL_NOTHROW { return ucs; }
Q_DECL_RELAXED_CONSTEXPR inline ushort &unicode() Q_DECL_NOTHROW { return ucs; }
Q_DECL_CONSTEXPR inline char toLatin1() const noexcept { return ucs > 0xff ? '\0' : char(ucs); }
Q_DECL_CONSTEXPR inline ushort unicode() const noexcept { return ucs; }
Q_DECL_RELAXED_CONSTEXPR inline ushort &unicode() noexcept { return ucs; }
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED static Q_DECL_CONSTEXPR inline QChar fromAscii(char c) Q_DECL_NOTHROW
QT_DEPRECATED static Q_DECL_CONSTEXPR inline QChar fromAscii(char c) noexcept
{ return fromLatin1(c); }
#endif
static Q_DECL_CONSTEXPR inline QChar fromLatin1(char c) Q_DECL_NOTHROW { return QChar(ushort(uchar(c))); }
static Q_DECL_CONSTEXPR inline QChar fromLatin1(char c) noexcept { return QChar(ushort(uchar(c))); }
Q_DECL_CONSTEXPR inline bool isNull() const Q_DECL_NOTHROW { return ucs == 0; }
Q_DECL_CONSTEXPR inline bool isNull() const noexcept { return ucs == 0; }
inline bool isPrint() const Q_DECL_NOTHROW { return QChar::isPrint(ucs); }
Q_DECL_CONSTEXPR inline bool isSpace() const Q_DECL_NOTHROW { return QChar::isSpace(ucs); }
inline bool isMark() const Q_DECL_NOTHROW { return QChar::isMark(ucs); }
inline bool isPunct() const Q_DECL_NOTHROW { return QChar::isPunct(ucs); }
inline bool isSymbol() const Q_DECL_NOTHROW { return QChar::isSymbol(ucs); }
Q_DECL_CONSTEXPR inline bool isLetter() const Q_DECL_NOTHROW { return QChar::isLetter(ucs); }
Q_DECL_CONSTEXPR inline bool isNumber() const Q_DECL_NOTHROW { return QChar::isNumber(ucs); }
Q_DECL_CONSTEXPR inline bool isLetterOrNumber() const Q_DECL_NOTHROW { return QChar::isLetterOrNumber(ucs); }
Q_DECL_CONSTEXPR inline bool isDigit() const Q_DECL_NOTHROW { return QChar::isDigit(ucs); }
Q_DECL_CONSTEXPR inline bool isLower() const Q_DECL_NOTHROW { return QChar::isLower(ucs); }
Q_DECL_CONSTEXPR inline bool isUpper() const Q_DECL_NOTHROW { return QChar::isUpper(ucs); }
Q_DECL_CONSTEXPR inline bool isTitleCase() const Q_DECL_NOTHROW { return QChar::isTitleCase(ucs); }
inline bool isPrint() const noexcept { return QChar::isPrint(ucs); }
Q_DECL_CONSTEXPR inline bool isSpace() const noexcept { return QChar::isSpace(ucs); }
inline bool isMark() const noexcept { return QChar::isMark(ucs); }
inline bool isPunct() const noexcept { return QChar::isPunct(ucs); }
inline bool isSymbol() const noexcept { return QChar::isSymbol(ucs); }
Q_DECL_CONSTEXPR inline bool isLetter() const noexcept { return QChar::isLetter(ucs); }
Q_DECL_CONSTEXPR inline bool isNumber() const noexcept { return QChar::isNumber(ucs); }
Q_DECL_CONSTEXPR inline bool isLetterOrNumber() const noexcept { return QChar::isLetterOrNumber(ucs); }
Q_DECL_CONSTEXPR inline bool isDigit() const noexcept { return QChar::isDigit(ucs); }
Q_DECL_CONSTEXPR inline bool isLower() const noexcept { return QChar::isLower(ucs); }
Q_DECL_CONSTEXPR inline bool isUpper() const noexcept { return QChar::isUpper(ucs); }
Q_DECL_CONSTEXPR inline bool isTitleCase() const noexcept { return QChar::isTitleCase(ucs); }
Q_DECL_CONSTEXPR inline bool isNonCharacter() const Q_DECL_NOTHROW { return QChar::isNonCharacter(ucs); }
Q_DECL_CONSTEXPR inline bool isHighSurrogate() const Q_DECL_NOTHROW { return QChar::isHighSurrogate(ucs); }
Q_DECL_CONSTEXPR inline bool isLowSurrogate() const Q_DECL_NOTHROW { return QChar::isLowSurrogate(ucs); }
Q_DECL_CONSTEXPR inline bool isSurrogate() const Q_DECL_NOTHROW { return QChar::isSurrogate(ucs); }
Q_DECL_CONSTEXPR inline bool isNonCharacter() const noexcept { return QChar::isNonCharacter(ucs); }
Q_DECL_CONSTEXPR inline bool isHighSurrogate() const noexcept { return QChar::isHighSurrogate(ucs); }
Q_DECL_CONSTEXPR inline bool isLowSurrogate() const noexcept { return QChar::isLowSurrogate(ucs); }
Q_DECL_CONSTEXPR inline bool isSurrogate() const noexcept { return QChar::isSurrogate(ucs); }
Q_DECL_CONSTEXPR inline uchar cell() const Q_DECL_NOTHROW { return uchar(ucs & 0xff); }
Q_DECL_CONSTEXPR inline uchar row() const Q_DECL_NOTHROW { return uchar((ucs>>8)&0xff); }
Q_DECL_RELAXED_CONSTEXPR inline void setCell(uchar acell) Q_DECL_NOTHROW { ucs = ushort((ucs & 0xff00) + acell); }
Q_DECL_RELAXED_CONSTEXPR inline void setRow(uchar arow) Q_DECL_NOTHROW { ucs = ushort((ushort(arow)<<8) + (ucs&0xff)); }
Q_DECL_CONSTEXPR inline uchar cell() const noexcept { return uchar(ucs & 0xff); }
Q_DECL_CONSTEXPR inline uchar row() const noexcept { return uchar((ucs>>8)&0xff); }
Q_DECL_RELAXED_CONSTEXPR inline void setCell(uchar acell) noexcept { ucs = ushort((ucs & 0xff00) + acell); }
Q_DECL_RELAXED_CONSTEXPR inline void setRow(uchar arow) noexcept { ucs = ushort((ushort(arow)<<8) + (ucs&0xff)); }
static Q_DECL_CONSTEXPR inline bool isNonCharacter(uint ucs4) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline bool isNonCharacter(uint ucs4) noexcept
{
return ucs4 >= 0xfdd0 && (ucs4 <= 0xfdef || (ucs4 & 0xfffe) == 0xfffe);
}
static Q_DECL_CONSTEXPR inline bool isHighSurrogate(uint ucs4) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline bool isHighSurrogate(uint ucs4) noexcept
{
return ((ucs4 & 0xfffffc00) == 0xd800);
}
static Q_DECL_CONSTEXPR inline bool isLowSurrogate(uint ucs4) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline bool isLowSurrogate(uint ucs4) noexcept
{
return ((ucs4 & 0xfffffc00) == 0xdc00);
}
static Q_DECL_CONSTEXPR inline bool isSurrogate(uint ucs4) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline bool isSurrogate(uint ucs4) noexcept
{
return (ucs4 - 0xd800u < 2048u);
}
static Q_DECL_CONSTEXPR inline bool requiresSurrogates(uint ucs4) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline bool requiresSurrogates(uint ucs4) noexcept
{
return (ucs4 >= 0x10000);
}
static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(ushort high, ushort low) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(ushort high, ushort low) noexcept
{
return (uint(high)<<10) + low - 0x35fdc00;
}
static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(QChar high, QChar low) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(QChar high, QChar low) noexcept
{
return surrogateToUcs4(high.ucs, low.ucs);
}
static Q_DECL_CONSTEXPR inline ushort highSurrogate(uint ucs4) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline ushort highSurrogate(uint ucs4) noexcept
{
return ushort((ucs4>>10) + 0xd7c0);
}
static Q_DECL_CONSTEXPR inline ushort lowSurrogate(uint ucs4) Q_DECL_NOTHROW
static Q_DECL_CONSTEXPR inline ushort lowSurrogate(uint ucs4) noexcept
{
return ushort(ucs4%0x400 + 0xdc00);
}
static Category QT_FASTCALL category(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static Direction QT_FASTCALL direction(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static JoiningType QT_FASTCALL joiningType(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static Category QT_FASTCALL category(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static Direction QT_FASTCALL direction(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static JoiningType QT_FASTCALL joiningType(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
#if QT_DEPRECATED_SINCE(5, 3)
QT_DEPRECATED static Joining QT_FASTCALL joining(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
QT_DEPRECATED static Joining QT_FASTCALL joining(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
#endif
static unsigned char QT_FASTCALL combiningClass(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static unsigned char QT_FASTCALL combiningClass(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL mirroredChar(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL hasMirrored(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL mirroredChar(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL hasMirrored(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static QString QT_FASTCALL decomposition(uint ucs4);
static Decomposition QT_FASTCALL decompositionTag(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static Decomposition QT_FASTCALL decompositionTag(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static int QT_FASTCALL digitValue(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toLower(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toUpper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toTitleCase(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toCaseFolded(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static int QT_FASTCALL digitValue(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toLower(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toUpper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toTitleCase(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static uint QT_FASTCALL toCaseFolded(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static Script QT_FASTCALL script(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static Script QT_FASTCALL script(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static UnicodeVersion QT_FASTCALL unicodeVersion(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static UnicodeVersion QT_FASTCALL unicodeVersion(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static UnicodeVersion QT_FASTCALL currentUnicodeVersion() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static UnicodeVersion QT_FASTCALL currentUnicodeVersion() noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isPrint(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static Q_DECL_CONSTEXPR inline bool isSpace(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static bool QT_FASTCALL isPrint(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static Q_DECL_CONSTEXPR inline bool isSpace(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{
// note that [0x09..0x0d] + 0x85 are exceptional Cc-s and must be handled explicitly
return ucs4 == 0x20 || (ucs4 <= 0x0d && ucs4 >= 0x09)
|| (ucs4 > 127 && (ucs4 == 0x85 || ucs4 == 0xa0 || QChar::isSpace_helper(ucs4)));
}
static bool QT_FASTCALL isMark(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isPunct(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isSymbol(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static Q_DECL_CONSTEXPR inline bool isLetter(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static bool QT_FASTCALL isMark(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isPunct(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isSymbol(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static Q_DECL_CONSTEXPR inline bool isLetter(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{
return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z'))
|| (ucs4 > 127 && QChar::isLetter_helper(ucs4));
}
static Q_DECL_CONSTEXPR inline bool isNumber(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static Q_DECL_CONSTEXPR inline bool isNumber(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::isNumber_helper(ucs4)); }
static Q_DECL_CONSTEXPR inline bool isLetterOrNumber(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static Q_DECL_CONSTEXPR inline bool isLetterOrNumber(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{
return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z'))
|| (ucs4 >= '0' && ucs4 <= '9')
|| (ucs4 > 127 && QChar::isLetterOrNumber_helper(ucs4));
}
static Q_DECL_CONSTEXPR inline bool isDigit(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static Q_DECL_CONSTEXPR inline bool isDigit(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::category(ucs4) == Number_DecimalDigit); }
static Q_DECL_CONSTEXPR inline bool isLower(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static Q_DECL_CONSTEXPR inline bool isLower(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= 'z' && ucs4 >= 'a') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Lowercase); }
static Q_DECL_CONSTEXPR inline bool isUpper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static Q_DECL_CONSTEXPR inline bool isUpper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return (ucs4 <= 'Z' && ucs4 >= 'A') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Uppercase); }
static Q_DECL_CONSTEXPR inline bool isTitleCase(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION
static Q_DECL_CONSTEXPR inline bool isTitleCase(uint ucs4) noexcept Q_DECL_CONST_FUNCTION
{ return ucs4 > 127 && QChar::category(ucs4) == Letter_Titlecase; }
private:
static bool QT_FASTCALL isSpace_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isLetter_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isNumber_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isLetterOrNumber_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isSpace_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isLetter_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isNumber_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
static bool QT_FASTCALL isLetterOrNumber_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION;
#ifdef QT_NO_CAST_FROM_ASCII
QChar(char c) Q_DECL_NOTHROW;
QChar(uchar c) Q_DECL_NOTHROW;
QChar(char c) noexcept;
QChar(uchar c) noexcept;
#endif
friend Q_DECL_CONSTEXPR bool operator==(QChar, QChar) Q_DECL_NOTHROW;
friend Q_DECL_CONSTEXPR bool operator< (QChar, QChar) Q_DECL_NOTHROW;
friend Q_DECL_CONSTEXPR bool operator==(QChar, QChar) noexcept;
friend Q_DECL_CONSTEXPR bool operator< (QChar, QChar) noexcept;
ushort ucs;
};
Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE);
Q_DECL_CONSTEXPR inline bool operator==(QChar c1, QChar c2) Q_DECL_NOTHROW { return c1.ucs == c2.ucs; }
Q_DECL_CONSTEXPR inline bool operator< (QChar c1, QChar c2) Q_DECL_NOTHROW { return c1.ucs < c2.ucs; }
Q_DECL_CONSTEXPR inline bool operator==(QChar c1, QChar c2) noexcept { return c1.ucs == c2.ucs; }
Q_DECL_CONSTEXPR inline bool operator< (QChar c1, QChar c2) noexcept { return c1.ucs < c2.ucs; }
Q_DECL_CONSTEXPR inline bool operator!=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator==(c1, c2); }
Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator< (c1, c2); }
Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) Q_DECL_NOTHROW { return operator< (c2, c1); }
Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator< (c2, c1); }
Q_DECL_CONSTEXPR inline bool operator!=(QChar c1, QChar c2) noexcept { return !operator==(c1, c2); }
Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) noexcept { return !operator< (c1, c2); }
Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) noexcept { return operator< (c2, c1); }
Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) noexcept { return !operator< (c2, c1); }
Q_DECL_CONSTEXPR inline bool operator==(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return lhs.isNull(); }
Q_DECL_CONSTEXPR inline bool operator< (QChar, std::nullptr_t) Q_DECL_NOTHROW { return false; }
Q_DECL_CONSTEXPR inline bool operator==(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return rhs.isNull(); }
Q_DECL_CONSTEXPR inline bool operator< (std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !rhs.isNull(); }
Q_DECL_CONSTEXPR inline bool operator==(QChar lhs, std::nullptr_t) noexcept { return lhs.isNull(); }
Q_DECL_CONSTEXPR inline bool operator< (QChar, std::nullptr_t) noexcept { return false; }
Q_DECL_CONSTEXPR inline bool operator==(std::nullptr_t, QChar rhs) noexcept { return rhs.isNull(); }
Q_DECL_CONSTEXPR inline bool operator< (std::nullptr_t, QChar rhs) noexcept { return !rhs.isNull(); }
Q_DECL_CONSTEXPR inline bool operator!=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator==(lhs, nullptr); }
Q_DECL_CONSTEXPR inline bool operator>=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator< (lhs, nullptr); }
Q_DECL_CONSTEXPR inline bool operator> (QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return operator< (nullptr, lhs); }
Q_DECL_CONSTEXPR inline bool operator<=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator< (nullptr, lhs); }
Q_DECL_CONSTEXPR inline bool operator!=(QChar lhs, std::nullptr_t) noexcept { return !operator==(lhs, nullptr); }
Q_DECL_CONSTEXPR inline bool operator>=(QChar lhs, std::nullptr_t) noexcept { return !operator< (lhs, nullptr); }
Q_DECL_CONSTEXPR inline bool operator> (QChar lhs, std::nullptr_t) noexcept { return operator< (nullptr, lhs); }
Q_DECL_CONSTEXPR inline bool operator<=(QChar lhs, std::nullptr_t) noexcept { return !operator< (nullptr, lhs); }
Q_DECL_CONSTEXPR inline bool operator!=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator==(nullptr, rhs); }
Q_DECL_CONSTEXPR inline bool operator>=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator< (nullptr, rhs); }
Q_DECL_CONSTEXPR inline bool operator> (std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return operator< (rhs, nullptr); }
Q_DECL_CONSTEXPR inline bool operator<=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator< (rhs, nullptr); }
Q_DECL_CONSTEXPR inline bool operator!=(std::nullptr_t, QChar rhs) noexcept { return !operator==(nullptr, rhs); }
Q_DECL_CONSTEXPR inline bool operator>=(std::nullptr_t, QChar rhs) noexcept { return !operator< (nullptr, rhs); }
Q_DECL_CONSTEXPR inline bool operator> (std::nullptr_t, QChar rhs) noexcept { return operator< (rhs, nullptr); }
Q_DECL_CONSTEXPR inline bool operator<=(std::nullptr_t, QChar rhs) noexcept { return !operator< (rhs, nullptr); }
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QChar);

Some files were not shown because too many files have changed in this diff Show More