diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2020-06-11 08:37:19 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2020-08-05 21:51:24 -0700 |
commit | 3caeb0187dec592c78a3bde8d0284475e00e30d4 (patch) | |
tree | ac05a70a7ab77678b929784729f3e439fd238f7a /src/corelib/text | |
parent | 274e07a339ebedddd8b3366342ebde3cbfb9536a (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
Pick-to: 5.15
Change-Id: I552d244076a447ab92d7fffd1617875fdd8dbe62
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qstring.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index f068c5e94a..773688d783 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -162,6 +162,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__)) |