From: Alberto Faria <afa...@redhat.com> 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 <afa...@redhat.com> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- include/qemu/coroutine.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index 89650a2d7fab..b0c97f6fb7ad 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -42,7 +42,11 @@ * .... * } */ +#ifdef __clang__ +#define coroutine_fn __attribute__((__annotate__("coroutine_fn"))) +#else #define coroutine_fn +#endif typedef struct Coroutine Coroutine; -- 2.38.1