diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-04-20 17:26:09 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-04-21 17:08:52 +0400 |
commit | c213ef9a66b0774771cb0cc04c9b3b019bb508db (patch) | |
tree | e3d209ca6d65ad6b0fa7cab5c1e0edec758cb1eb /include/qemu | |
parent | 5472b5b6a42482e924014bca0c42a79044d6e7d9 (diff) | |
download | qemu-c213ef9a66b0774771cb0cc04c9b3b019bb508db.zip qemu-c213ef9a66b0774771cb0cc04c9b3b019bb508db.tar.gz qemu-c213ef9a66b0774771cb0cc04c9b3b019bb508db.tar.bz2 |
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>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/compiler.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index f12c0fb..f20a76e 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 |