summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2025-03-21 14:52:43 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2025-03-28 04:05:57 +0100
commit2a7fa4963cdab49e19e1377a3ab627584cd6e1cc (patch)
tree94970371e995989d3e8c03a54b187b58cfe59b16 /src/corelib
parentd2d74673f3dccc04894f2ea67fc7662cc6ef400b (diff)
Shuffle Q_(ALWAYS|NEVER)_INLINE around so they can be attributes
The attribute must appear before the modifiers like 'inline' and 'constexpr'. Change-Id: If3d143fc2f85a8eba6e3ac2ceca10720649f33cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qendian.cpp2
-rw-r--r--src/corelib/kernel/qproperty_p.h4
-rw-r--r--src/corelib/serialization/qjsoncbor.cpp2
-rw-r--r--src/corelib/text/qanystringview.h2
-rw-r--r--src/corelib/text/qlocale_tools.cpp2
-rw-r--r--src/corelib/text/qstring.cpp2
-rw-r--r--src/corelib/text/qstringalgorithms.h4
-rw-r--r--src/corelib/text/qstringconverter.cpp6
-rw-r--r--src/corelib/text/qstringliteral.h2
-rw-r--r--src/corelib/text/qstringview.h2
-rw-r--r--src/corelib/thread/qyieldcpu.h3
-rw-r--r--src/corelib/tools/qbitarray.cpp6
-rw-r--r--src/corelib/tools/qhash.cpp4
13 files changed, 21 insertions, 20 deletions
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 <typename T> static Q_ALWAYS_INLINE
+template <typename T> 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<quintptr>(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 <typename Container, if_compatible_container<Container> = 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 <typename Container, if_convertible_to<QString, Container> = 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<qlonglong> qstrntoll(const char *begin, qsizetype size, int
}
template <typename Char>
-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<const __m128i *>(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 <typename Char, size_t N> [[nodiscard]] constexpr Q_ALWAYS_INLINE
+template <typename Char, size_t N> [[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 <typename Char, size_t N> [[nodiscard]] constexpr Q_ALWAYS_INLINE
+template <typename Char, size_t N> [[nodiscard]] Q_ALWAYS_INLINE constexpr
std::enable_if_t<sizeof(Char) == sizeof(char16_t), qsizetype>
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 <QCpuFeatureType Cpu = _compilerCpuFeatures> static Q_ALWAYS_INLINE bool
+template <QCpuFeatureType Cpu = _compilerCpuFeatures> 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<const char *>(end) - reinterpret_cast<const char *>(src);
@@ -247,7 +247,7 @@ simdEncodeAscii(uchar *&dst, const char16_t *&nextAscii, const char16_t *&src, c
return src == end;
}
-template <QCpuFeatureType Cpu = _compilerCpuFeatures> static Q_ALWAYS_INLINE bool
+template <QCpuFeatureType Cpu = _compilerCpuFeatures> 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<char16_t>;
namespace QtPrivate {
template <qsizetype N>
-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<char16_t *>(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 <typename Container, if_compatible_container<Container> = 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 <typename Char, size_t Size, if_compatible_char<Char> = 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 <typename BitwiseOp> static Q_NEVER_INLINE
+template <typename BitwiseOp> 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 <typename BitwiseOp> static Q_NEVER_INLINE
+template <typename BitwiseOp> 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 <typename BitwiseOp> static Q_NEVER_INLINE
+template <typename BitwiseOp> 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);