aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-20 17:26:09 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-21 17:08:52 +0400
commitc213ef9a66b0774771cb0cc04c9b3b019bb508db (patch)
treee3d209ca6d65ad6b0fa7cab5c1e0edec758cb1eb
parent5472b5b6a42482e924014bca0c42a79044d6e7d9 (diff)
compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}
Simplify a bit pre-compiler conditions. For TSAN, QEMU already has CONFIG_TSAN, but it is only set when the fiber API is present. (I wonder whether supporting TSAN without the fiber API is really relevant) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220420132624.2439741-27-marcandre.lureau@redhat.com>
-rw-r--r--include/qemu/compiler.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index f12c0fb581..f20a76e4a2 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -106,6 +106,14 @@
#define __has_attribute(x) 0 /* compatibility with older GCC */
#endif
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
+# define QEMU_SANITIZE_ADDRESS 1
+#endif
+
+#if defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer)
+# define QEMU_SANITIZE_THREAD 1
+#endif
+
/*
* GCC doesn't provide __has_attribute() until GCC 5, but we know all the GCC
* versions we support have the "flatten" attribute. Clang may not have the