Skip to content

Commit

Permalink
Disable -Werror=tsan on GCC < 15
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
dangelog committed Mar 8, 2025
1 parent d429fce commit a72077a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmake/QtInternalTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BOOL:${QT_FEATURE_sanitize_thread}>
AND $<BOOL:${BUILD_WITH_PCH}>
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}
Expand Down
1 change: 1 addition & 0 deletions src/corelib/global/qglobalstatic.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ template <typename QGS> 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")
Expand Down

0 comments on commit a72077a

Please sign in to comment.