From b972361ec4535d8c7eac765d917aec54e52e796d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 4 Sep 2024 16:00:10 +0200 Subject: [PATCH] QtPrivate: add "defined in" comment to findByteArray/lastIndexOf(~~~, char) It's customary to add such a comment when an inline function is not defined in the same header it is declared. As a drive-by, remove the pure attribute from lastIndexOf(). Q_DECL_PURE/CONST_FUNCTIONS are only useful for out-of-line functions. For inline functions, the compiler sees the body and can determine that they're pure or const (in the __attribute__((const)) sense) itself. Found in API-review. Change-Id: I27aa5cfaf21b1015a6c8b9e4773a1c2c5134a226 Reviewed-by: Juha Vuolle (cherry picked from commit 3b812f0409c50c6a3fd1d66a9c18bc323e0a0ca3) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qbytearrayalgorithms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/text/qbytearrayalgorithms.h b/src/corelib/text/qbytearrayalgorithms.h index 7b9529eba95..65676552e1e 100644 --- a/src/corelib/text/qbytearrayalgorithms.h +++ b/src/corelib/text/qbytearrayalgorithms.h @@ -25,13 +25,13 @@ bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept; [[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept; -[[nodiscard]] inline +[[nodiscard]] inline // defined in qbytearrayview.h qsizetype findByteArray(QByteArrayView haystack, qsizetype from, char needle) noexcept; [[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findByteArray(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept; -[[nodiscard]] inline Q_DECL_PURE_FUNCTION +[[nodiscard]] inline // defined in qbytearrayview.h qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, uchar needle) noexcept; [[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION