diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-07 21:49:48 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-08 10:31:21 +0100 |
commit | 143bcbb96f512d8e4014f0abba99f8e7a8729499 (patch) | |
tree | 371ed5b34778c1efbfa358f8371090af66891427 /src/corelib/global/qglobalstatic.h | |
parent | 652065b06b338ce2bddea2d4b71d2dd2aa7b3185 (diff) |
QGlobalStatic: suppress -Wtsan warning
QGS employs a call to std::atomic_thread_fence. Unfortunately TSAN does
not support it, and GCC >= 11 raises a warning. This breaks the build
when building under -Werror. Suppress the warning using the usual
pragmas.
There's a catch: qglobalstatic.h is built into a PCH, and GCC <= 13
will still generate a warning because of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431 .
Change-Id: I770f39b7563b66f483851444cd580bcafc5f288a
Pick-to: 6.7 6.6 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qglobalstatic.h')
-rw-r--r-- | src/corelib/global/qglobalstatic.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index c7fbba69e8..93127adab3 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -40,8 +40,16 @@ template <typename QGS> union Holder ~Holder() { + // TSAN does not support atomic_thread_fence and GCC complains: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97868 + // https://github.com/google/sanitizers/issues/1352 +QT_WARNING_PUSH +#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1100 +QT_WARNING_DISABLE_GCC("-Wtsan") +#endif // import changes to *pointer() by other threads before running ~PlainType(): std::atomic_thread_fence(std::memory_order_acquire); +QT_WARNING_POP pointer()->~PlainType(); guard.storeRelease(QtGlobalStatic::Destroyed); } |