From cbdbc47cee539ed1ef3e9a27adc47e26d1f921c6 Mon Sep 17 00:00:00 2001 From: Alberto Faria Date: Fri, 16 Dec 2022 12:07:57 +0100 Subject: [PATCH] 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 Signed-off-by: Paolo Bonzini Message-Id: <20221216110758.559947-2-pbonzini@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/qemu/osdep.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index c850001408e..d1be7bf8b99 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 -- 2.39.5