From a72077a88903fe532f6a749677eb4da4ea99f79f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 5 Mar 2025 14:16:37 +0100 Subject: [PATCH] Disable -Werror=tsan on GCC < 15 QGlobalStatic has a warning suppression for -Wtsan because of its usage of std::atomic_thread_fence, which TSAN doesn't support. That header is included in QtCore's PCH, and that triggers a GCC bug that causes the warning to be emitted despite the suppression [1]. In a developer build, the warning turns fatal. We could either disable PCHs in such a build configuration (TSAN+developer-build+GCC < 15), or: simply make the warning non-fatal on earlier compiler versions. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64117 Pick-to: 6.9 6.8 6.5 Fixes: QTBUG-134415 Change-Id: If80a4acdb1372d00804a60361f6c3d6893b96106 Reviewed-by: David Faure Reviewed-by: Alexandru Croitor --- cmake/QtInternalTargets.cmake | 8 ++++++++ src/corelib/global/qglobalstatic.h | 1 + 2 files changed, 9 insertions(+) diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index c3bd6ab9f71..8be08163550 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -81,6 +81,14 @@ function(qt_internal_set_warnings_are_errors_flags target target_scope) # This in turn triggers a fallthrough warning in cborparser.c, so we disable # this warning. -no-integrated-cpp -Wno-implicit-fallthrough + CONDITIONS VERSION_LESS 15.1 + AND $ + AND $ + OPTIONS + # GCC < 15 raises a TSAN warning from Qt's own PCHs, despite the warning + # being suppressed (QTBUG-134415) + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64117 + -Wno-error=tsan COMMON_CONDITIONS ${common_conditions} ${language_args} diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index 93127adab36..928d763d506 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -43,6 +43,7 @@ template union 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 + // QTBUG-134415 QT_WARNING_PUSH #if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1100 QT_WARNING_DISABLE_GCC("-Wtsan")