[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 26/41] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}
From: |
marcandre . lureau |
Subject: |
[PATCH 26/41] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD} |
Date: |
Wed, 20 Apr 2022 17:26:09 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
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>
---
include/qemu/compiler.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index f12c0fb581ec..f20a76e4a286 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
--
2.35.1.693.g805e0a68082a
- [PATCH 22/41] include: move qemu_*_exec_dir() to cutils, (continued)
- [PATCH 22/41] include: move qemu_*_exec_dir() to cutils, marcandre . lureau, 2022/04/20
- [PATCH 23/41] include: add qemu/keyval.h, marcandre . lureau, 2022/04/20
- [PATCH 21/41] include: move qemu_fdatasync() to osdep, marcandre . lureau, 2022/04/20
- [PATCH 25/41] tests: remove block/qdict checks from check-qobject.c, marcandre . lureau, 2022/04/20
- [PATCH 24/41] include: move qdict_{crumple,flatten} declarations, marcandre . lureau, 2022/04/20
- [PATCH 26/41] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD},
marcandre . lureau <=
- [PATCH 27/41] Use QEMU_SANITIZE_THREAD, marcandre . lureau, 2022/04/20
- [PATCH 28/41] Use QEMU_SANITIZE_ADDRESS, marcandre . lureau, 2022/04/20
- [PATCH 29/41] tests: run-time skip test-qga if TSAN is enabled, marcandre . lureau, 2022/04/20
- [PATCH 30/41] Move error_printf_unless_qmp() with monitor unit, marcandre . lureau, 2022/04/20