From: Alberto Faria Date: Fri, 16 Dec 2022 11:07:57 +0000 (+0100) Subject: coroutine: annotate coroutine_fn for libclang X-Git-Tag: v8.0.0-rc0~78^2~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cbdbc47cee539ed1ef3e9a27adc47e26d1f921c6;p=thirdparty%2Fqemu.git 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 --- 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