Skip to content

Commit 3715a05

Browse files
committed
meson: hide tsan related warnings
When building with gcc-12 -fsanitize=thread, gcc reports some constructions not supported with tsan. Found on debian stable. qemu/include/qemu/atomic.h:36:52: error: ‘atomic_thread_fence’ is not supported with ‘-fsanitize=thread’ [-Werror=tsan] 36 | #define smp_mb() ({ barrier(); __atomic_thread_fence(__ATOMIC_SEQ_CST); }) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Pierrick Bouvier <[email protected]>
1 parent 25deaa1 commit 3715a05

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

meson.build

+9-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,15 @@ if get_option('tsan')
538538
prefix: '#include <sanitizer/tsan_interface.h>')
539539
error('Cannot enable TSAN due to missing fiber annotation interface')
540540
endif
541-
qemu_cflags = ['-fsanitize=thread'] + qemu_cflags
541+
tsan_warn_suppress = []
542+
# gcc (>=11) will report constructions not supported by tsan:
543+
# "error: ‘atomic_thread_fence’ is not supported with ‘-fsanitize=thread’"
544+
# https://gcc.gnu.org/gcc-11/changes.html
545+
# However, clang does not support this warning and this triggers an error.
546+
if cc.has_argument('-Wno-tsan')
547+
tsan_warn_suppress = ['-Wno-tsan']
548+
endif
549+
qemu_cflags = ['-fsanitize=thread'] + tsan_warn_suppress + qemu_cflags
542550
qemu_ldflags = ['-fsanitize=thread'] + qemu_ldflags
543551
endif
544552

0 commit comments

Comments
 (0)