diff options
author | Alberto Faria <afaria@redhat.com> | 2022-12-16 12:07:57 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-01-24 18:26:41 +0100 |
commit | cbdbc47cee539ed1ef3e9a27adc47e26d1f921c6 (patch) | |
tree | 2959d94c714830f78a69a5281b048d82e0f194c3 /include | |
parent | a4b15a8b9ef25b44fa92a4825312622600c1f37c (diff) |
coroutine: annotate coroutine_fn for libclang
Clang has a generic __annotate__ attribute that can be used by
static analyzers to understand properties of functions and
analyze the control flow. Furthermore, unlike TSA annotations, the
__annotate__ attribute applies to function pointers as well.
As a first step towards static analysis of coroutine_fn markers,
attach the attribute to the marker when compiling with clang.
Signed-off-by: Alberto Faria <afaria@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20221216110758.559947-2-pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/osdep.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index c850001408..d1be7bf8b9 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -171,7 +171,11 @@ extern "C" { * .... * } */ +#ifdef __clang__ +#define coroutine_fn __attribute__((__annotate__("coroutine_fn"))) +#else #define coroutine_fn +#endif /* * For mingw, as of v6.0.0, the function implementing the assert macro is |