summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-12-17 16:50:29 -0300
committerThiago Macieira <thiago.macieira@intel.com>2022-12-04 17:56:45 -0800
commit40083f380f1f9f6208c201941e620443a0cc8fb4 (patch)
treeefa6bee45b634acbd90a835200e018c06646746e /src/corelib
parent9d0c29b882f1ab12e978ec8c9fc8bed09b318fb1 (diff)
QString: extract qustrlen's attribute to a macro
I'll need it for the rest of the algorithms. Change-Id: Ib42b3adc93bf4d43bd55fffd16c1a2b31ac41c6d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/text/qstring.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 43041b7690..e3c5de8fca 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -387,6 +387,14 @@ extern "C" void qt_fromlatin1_mips_asm_unroll8 (char16_t*, const char*, uint);
extern "C" void qt_toLatin1_mips_dsp_asm(uchar *dst, const char16_t *src, int length);
#endif
+#if defined(__SSE2__) && defined(Q_CC_GNU)
+// We may overrun the buffer, but that's a false positive:
+// this won't crash nor produce incorrect results
+# define ATTRIBUTE_NO_SANITIZE __attribute__((__no_sanitize_address__))
+#else
+# define ATTRIBUTE_NO_SANITIZE
+#endif
+
#ifdef __SSE2__
static constexpr bool UseSse4_1 = bool(qCompilerCpuFeatures & CpuFeatureSSE4_1);
static constexpr bool UseAvx2 = UseSse4_1 &&
@@ -509,11 +517,7 @@ static bool simdTestMask(const char *&ptr, const char *end, quint32 maskval)
}
#endif
-#ifdef Q_CC_GNU
-// We may overrun the buffer, but that's a false positive:
-// this won't crash nor produce incorrect results
-__attribute__((__no_sanitize_address__))
-#endif
+ATTRIBUTE_NO_SANITIZE
qsizetype QtPrivate::qustrlen(const char16_t *str) noexcept
{
qsizetype result = 0;