summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-06-11 08:37:19 -0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-08-06 07:54:34 +0000
commitc02709f697fdf09c8b62e7cd9b85a7ccdd2c36e4 (patch)
treee799123ebc2095988066b490289c53fcf0a2c17c /src/corelib/text
parentc933e8ab25d3a731537b988798bb7a6dc582b2b5 (diff)
qustrlen: Add #warnings to explain how to deal with GCC 7.x's ASan
The build breaks by disabling ASan in this function because it also removes its ability to emit SSE2 code. That's clearly broken because all x86_64 can use SSE2. So this adds #warnings so people are told how to choose their solution. Clang doesn't currently define __SANITIZE_ADDRESS__ but I added a conditional just in case some future version does. Fixes: QTBUG-84856 Change-Id: I552d244076a447ab92d7fffd1617875fdd8dbe62 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 3caeb0187dec592c78a3bde8d0284475e00e30d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/text')
-rw-r--r--src/corelib/text/qstring.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index a008aaf41e..d9dd8ab30b 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -160,6 +160,13 @@ static inline bool qt_ends_with(QStringView haystack, QLatin1String needle, Qt::
static inline bool qt_ends_with(QStringView haystack, QChar needle, Qt::CaseSensitivity cs);
#if defined(__SSE2__) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
+# if defined(__SANITIZE_ADDRESS__) && Q_CC_GNU < 800 && !defined(Q_CC_CLANG)
+# warning "The __attribute__ on below will likely cause a build failure with your GCC version. Your choices are:"
+# warning "1) disable ASan;"
+# warning "2) disable the optimized code in qustrlen (change __SSE2__ to anything else);"
+# warning "3) upgrade your compiler (preferred)."
+# endif
+
// We may overrun the buffer, but that's a false positive:
// this won't crash nor produce incorrect results
__attribute__((__no_sanitize_address__))