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.6 6.5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 143bcbb96f512d8e4014f0abba99f8e7a8729499) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
032e127ad5
commit
21c3f17eaa
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user