diff --git a/src/corelib/global/qendian.cpp b/src/corelib/global/qendian.cpp index 5e46109dd11..1436316ac18 100644 --- a/src/corelib/global/qendian.cpp +++ b/src/corelib/global/qendian.cpp @@ -835,7 +835,7 @@ size_t simdSwapLoop(const uchar *, size_t, uchar *) noexcept } #endif -template static Q_ALWAYS_INLINE +template Q_ALWAYS_INLINE static void *bswapLoop(const uchar *src, size_t n, uchar *dst) noexcept { // Buffers cannot partially overlap: either they're identical or totally diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index 8ef26babc00..a0b97187d41 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -81,7 +81,7 @@ struct QPropertyBindingDataPointer d = reinterpret_cast(observer); } static void fixupAfterMove(QtPrivate::QPropertyBindingData *ptr); - void Q_ALWAYS_INLINE addObserver(QPropertyObserver *observer); + Q_ALWAYS_INLINE void addObserver(QPropertyObserver *observer); inline void setFirstObserver(QPropertyObserver *observer); inline QPropertyObserverPointer firstObserver() const; static QPropertyProxyBindingData *proxyData(QtPrivate::QPropertyBindingData *ptr); @@ -399,7 +399,7 @@ public: bool evaluateRecursive(PendingBindingObserverList &bindingObservers, QBindingStatus *status = nullptr); - bool Q_ALWAYS_INLINE evaluateRecursive_inline(PendingBindingObserverList &bindingObservers, QBindingStatus *status); + Q_ALWAYS_INLINE bool evaluateRecursive_inline(PendingBindingObserverList &bindingObservers, QBindingStatus *status); void notifyNonRecursive(const PendingBindingObserverList &bindingObservers); enum NotificationState : bool { Delayed, Sent }; diff --git a/src/corelib/serialization/qjsoncbor.cpp b/src/corelib/serialization/qjsoncbor.cpp index a2aec8066ed..48cd717cf32 100644 --- a/src/corelib/serialization/qjsoncbor.cpp +++ b/src/corelib/serialization/qjsoncbor.cpp @@ -107,7 +107,7 @@ static QString encodeTag(const QCborContainerPrivate *d) return s; } -static Q_NEVER_INLINE QString makeString(const QCborContainerPrivate *d, qsizetype idx, +Q_NEVER_INLINE static QString makeString(const QCborContainerPrivate *d, qsizetype idx, ConversionMode mode) { const auto &e = d->elements.at(idx); diff --git a/src/corelib/text/qanystringview.h b/src/corelib/text/qanystringview.h index 34cf3e66a86..4b89fa6edbf 100644 --- a/src/corelib/text/qanystringview.h +++ b/src/corelib/text/qanystringview.h @@ -200,7 +200,7 @@ public: inline constexpr QAnyStringView(QLatin1StringView str) noexcept; template = true> - constexpr Q_ALWAYS_INLINE QAnyStringView(const Container &c) noexcept + Q_ALWAYS_INLINE constexpr QAnyStringView(const Container &c) noexcept : QAnyStringView(std::data(c), QtPrivate::lengthHelperContainer(c)) {} template = true> diff --git a/src/corelib/text/qlocale_tools.cpp b/src/corelib/text/qlocale_tools.cpp index cf111e9ecab..ec022c786de 100644 --- a/src/corelib/text/qlocale_tools.cpp +++ b/src/corelib/text/qlocale_tools.cpp @@ -474,7 +474,7 @@ QSimpleParsedNumber qstrntoll(const char *begin, qsizetype size, int } template -static Q_ALWAYS_INLINE void qulltoString_helper(qulonglong number, int base, Char *&p) +Q_ALWAYS_INLINE static void qulltoString_helper(qulonglong number, int base, Char *&p) { // Performance-optimized code. Compiler can generate faster code when base is known. switch (base) { diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 40987ee3ec3..79d3c544f30 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -372,7 +372,7 @@ static constexpr bool UseAvx2 = UseSse4_1 && (qCompilerCpuFeatures & CpuFeatureArchHaswell) == CpuFeatureArchHaswell; [[maybe_unused]] -static Q_ALWAYS_INLINE __m128i mm_load8_zero_extend(const void *ptr) +Q_ALWAYS_INLINE static __m128i mm_load8_zero_extend(const void *ptr) { const __m128i *dataptr = static_cast(ptr); if constexpr (UseSse4_1) { diff --git a/src/corelib/text/qstringalgorithms.h b/src/corelib/text/qstringalgorithms.h index 7b80352eec8..404eb79e70c 100644 --- a/src/corelib/text/qstringalgorithms.h +++ b/src/corelib/text/qstringalgorithms.h @@ -129,7 +129,7 @@ namespace QtPrivate { [[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isLatin1(QStringView s) noexcept; [[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept; -template [[nodiscard]] constexpr Q_ALWAYS_INLINE +template [[nodiscard]] Q_ALWAYS_INLINE constexpr qsizetype lengthHelperContainerLoop(const Char (&str)[N]) { #if defined(__cpp_lib_constexpr_algorithms) && defined(Q_CC_GNU_ONLY) @@ -148,7 +148,7 @@ qsizetype lengthHelperContainerLoop(const Char (&str)[N]) #endif } -template [[nodiscard]] constexpr Q_ALWAYS_INLINE +template [[nodiscard]] Q_ALWAYS_INLINE constexpr std::enable_if_t lengthHelperContainer(const Char (&str)[N]) { diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index 74881f5986b..1c51cf80c20 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -64,7 +64,7 @@ enum { Endian = 0, Data = 1 }; static const uchar utf8bom[] = { 0xef, 0xbb, 0xbf }; #if defined(__SSE2__) || defined(__ARM_NEON__) -static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) noexcept +Q_ALWAYS_INLINE static uint qBitScanReverse(unsigned v) noexcept { #if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L return std::bit_width(v) - 1; @@ -80,7 +80,7 @@ static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) noexcept #endif #if defined(__SSE2__) -template static Q_ALWAYS_INLINE bool +template Q_ALWAYS_INLINE static bool simdEncodeAscii(uchar *&dst, const char16_t *&nextAscii, const char16_t *&src, const char16_t *end) { size_t sizeBytes = reinterpret_cast(end) - reinterpret_cast(src); @@ -247,7 +247,7 @@ simdEncodeAscii(uchar *&dst, const char16_t *&nextAscii, const char16_t *&src, c return src == end; } -template static Q_ALWAYS_INLINE bool +template Q_ALWAYS_INLINE static bool simdDecodeAscii(char16_t *&dst, const uchar *&nextAscii, const uchar *&src, const uchar *end) { // do sixteen characters at a time diff --git a/src/corelib/text/qstringliteral.h b/src/corelib/text/qstringliteral.h index 429d9c02ad5..11fa0794deb 100644 --- a/src/corelib/text/qstringliteral.h +++ b/src/corelib/text/qstringliteral.h @@ -25,7 +25,7 @@ using QStringPrivate = QArrayDataPointer; namespace QtPrivate { template -static Q_ALWAYS_INLINE QStringPrivate qMakeStringPrivate(const char16_t (&literal)[N]) +Q_ALWAYS_INLINE static QStringPrivate qMakeStringPrivate(const char16_t (&literal)[N]) { // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) auto str = const_cast(literal); diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h index 719a8e0b81f..c63ff6fbea1 100644 --- a/src/corelib/text/qstringview.h +++ b/src/corelib/text/qstringview.h @@ -166,7 +166,7 @@ public: #endif template = true> - constexpr Q_ALWAYS_INLINE QStringView(const Container &c) noexcept + Q_ALWAYS_INLINE constexpr QStringView(const Container &c) noexcept : QStringView(std::data(c), QtPrivate::lengthHelperContainer(c)) {} template = true> diff --git a/src/corelib/thread/qyieldcpu.h b/src/corelib/thread/qyieldcpu.h index c30374f005a..310f2cacc5a 100644 --- a/src/corelib/thread/qyieldcpu.h +++ b/src/corelib/thread/qyieldcpu.h @@ -21,10 +21,11 @@ void _mm_pause(void); // the compiler recognizes as intrinsic QT_BEGIN_NAMESPACE +Q_ALWAYS_INLINE #ifdef Q_CC_GNU __attribute__((artificial)) #endif -Q_ALWAYS_INLINE void qYieldCpu(void) Q_DECL_NOEXCEPT; +void qYieldCpu(void) Q_DECL_NOEXCEPT; void qYieldCpu(void) #ifdef __cplusplus diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 46e4af37b0f..00af0c0b66e 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -545,7 +545,7 @@ static QBitArray sizedForOverwrite(const QBitArray &a1, const QBitArray &a2) return result; } -template static Q_NEVER_INLINE +template Q_NEVER_INLINE static QBitArray &performBitwiseOperationHelper(QBitArray &out, const QBitArray &a1, const QBitArray &a2, BitwiseOp op) { @@ -581,7 +581,7 @@ QBitArray &performBitwiseOperationHelper(QBitArray &out, const QBitArray &a1, return out; } -template static Q_NEVER_INLINE +template Q_NEVER_INLINE static QBitArray &performBitwiseOperationInCopy(QBitArray &self, const QBitArray &other, BitwiseOp op) { QBitArray tmp(std::move(self)); @@ -589,7 +589,7 @@ QBitArray &performBitwiseOperationInCopy(QBitArray &self, const QBitArray &other return performBitwiseOperationHelper(self, tmp, other, op); } -template static Q_NEVER_INLINE +template Q_NEVER_INLINE static QBitArray &performBitwiseOperationInPlace(QBitArray &self, const QBitArray &other, BitwiseOp op) { if (self.size() < other.size()) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 3e756bdb478..f5d89f732ae 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -106,7 +106,7 @@ struct HashSeedStorage } private: - Q_DECL_COLD_FUNCTION Q_NEVER_INLINE StateResult initialize(int which) noexcept; + Q_NEVER_INLINE Q_DECL_COLD_FUNCTION StateResult initialize(int which) noexcept; }; [[maybe_unused]] HashSeedStorage::StateResult HashSeedStorage::initialize(int which) noexcept @@ -413,7 +413,7 @@ namespace { } // hash 16 bytes, running 3 scramble rounds of AES on itself (like label "final1") - static void Q_ALWAYS_INLINE QT_FUNCTION_TARGET(AES) QT_VECTORCALL + Q_ALWAYS_INLINE static void QT_FUNCTION_TARGET(AES) QT_VECTORCALL hash16bytes(__m128i &state0, __m128i data) { state0 = _mm_xor_si128(state0, data); diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp index 967abb8b66e..8bc49f42ab5 100644 --- a/src/gui/painting/qdrawhelper_avx2.cpp +++ b/src/gui/painting/qdrawhelper_avx2.cpp @@ -287,7 +287,7 @@ void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl, } } -static Q_NEVER_INLINE +Q_NEVER_INLINE static void Q_DECL_VECTORCALL qt_memfillXX_avx2(uchar *dest, __m256i value256, qsizetype bytes) { __m128i value128 = _mm256_castsi256_si128(value256); diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 79590534f31..4c38e6e4f91 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -198,7 +198,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u } #ifndef __haswell__ -static Q_NEVER_INLINE +Q_NEVER_INLINE static void Q_DECL_VECTORCALL qt_memfillXX_aligned(void *dest, __m128i value128, quintptr bytecount) { __m128i *dst128 = reinterpret_cast<__m128i *>(dest); diff --git a/src/gui/painting/qpixellayout.cpp b/src/gui/painting/qpixellayout.cpp index cfe26d6c5d7..cfb58221070 100644 --- a/src/gui/painting/qpixellayout.cpp +++ b/src/gui/painting/qpixellayout.cpp @@ -368,7 +368,7 @@ static const QRgba64 *QT_FASTCALL fetchRGBToRGB64(QRgba64 *buffer, const uchar * } template -static Q_ALWAYS_INLINE QRgbaFloat32 convertPixelToRGB32F(uint s) +Q_ALWAYS_INLINE static QRgbaFloat32 convertPixelToRGB32F(uint s) { return QRgbaFloat32::fromArgb32(convertPixelToRGB32(s)); } @@ -481,7 +481,7 @@ static const QRgba64 *QT_FASTCALL fetchARGBPMToRGBA64PM(QRgba64 *buffer, const u } template -static Q_ALWAYS_INLINE QRgbaFloat32 convertPixelToRGBA32F(uint s) +Q_ALWAYS_INLINE static QRgbaFloat32 convertPixelToRGBA32F(uint s) { return QRgbaFloat32::fromArgb32(convertPixelToARGB32PM(s)); } diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index 9c0c2103200..1cc6aabcbdd 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -28,7 +28,7 @@ class QRgba64 { #endif }; - explicit Q_ALWAYS_INLINE constexpr QRgba64(quint64 c) : rgba(c) { } + Q_ALWAYS_INLINE explicit constexpr QRgba64(quint64 c) : rgba(c) { } public: QRgba64() = default; @@ -148,11 +148,11 @@ public: } private: - static constexpr Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; } + Q_ALWAYS_INLINE static constexpr quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; } - static constexpr Q_ALWAYS_INLINE quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); } - static constexpr Q_ALWAYS_INLINE quint8 div_257(quint16 x) { return div_257_floor(x + 128U); } - constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const + Q_ALWAYS_INLINE static constexpr quint8 div_257_floor(uint x) { return quint8((x - (x >> 8)) >> 8); } + Q_ALWAYS_INLINE static constexpr quint8 div_257(quint16 x) { return div_257_floor(x + 128U); } + Q_ALWAYS_INLINE constexpr QRgba64 unpremultiplied_32bit() const { if (isOpaque() || isTransparent()) return *this; @@ -162,7 +162,7 @@ private: const quint16 b = quint16((blue() * 0xffff + a/2) / a); return fromRgba64(r, g, b, quint16(a)); } - constexpr Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const + Q_ALWAYS_INLINE constexpr QRgba64 unpremultiplied_64bit() const { if (isOpaque() || isTransparent()) return *this; diff --git a/src/gui/painting/qrgbafloat.h b/src/gui/painting/qrgbafloat.h index f481b285f67..5da8f1fe764 100644 --- a/src/gui/painting/qrgbafloat.h +++ b/src/gui/painting/qrgbafloat.h @@ -89,11 +89,11 @@ public: constexpr quint16 blue16() const { return qRound(blueNormalized() * FastType(65535.0f)); } constexpr quint16 alpha16() const { return qRound(alphaNormalized() * FastType(65535.0f)); } - constexpr Q_ALWAYS_INLINE QRgbaFloat premultiplied() const + Q_ALWAYS_INLINE constexpr QRgbaFloat premultiplied() const { return QRgbaFloat{r * a, g * a, b * a, a}; } - constexpr Q_ALWAYS_INLINE QRgbaFloat unpremultiplied() const + Q_ALWAYS_INLINE constexpr QRgbaFloat unpremultiplied() const { if (a <= F{0.0f}) return QRgbaFloat{}; // default-initialization: zeroes