Skip to content

Commit

Permalink
compiler: introduce QEMU_ANNOTATE
Browse files Browse the repository at this point in the history
Allow a more shorter syntax when defining wrapper macros for
__attribute__((annotate(...))).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Sep 26, 2023
1 parent e2dbca0 commit d79b920
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions include/qemu/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,10 @@
#define BUILTIN_SUBCLL_BROKEN
#endif

#if __has_attribute(annotate)
#define QEMU_ANNOTATE(x) __attribute__((annotate(x)))
#else
#define QEMU_ANNOTATE(x)
#endif

#endif /* COMPILER_H */
6 changes: 3 additions & 3 deletions include/qemu/osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ extern "C" {
* }
*/
#ifdef __clang__
#define coroutine_fn __attribute__((__annotate__("coroutine_fn")))
#define coroutine_fn QEMU_ANNOTATE("coroutine_fn")
#else
#define coroutine_fn
#endif
Expand All @@ -195,7 +195,7 @@ extern "C" {
* but can handle running in non-coroutine context too.
*/
#ifdef __clang__
#define coroutine_mixed_fn __attribute__((__annotate__("coroutine_mixed_fn")))
#define coroutine_mixed_fn QEMU_ANNOTATE("coroutine_mixed_fn")
#else
#define coroutine_mixed_fn
#endif
Expand Down Expand Up @@ -224,7 +224,7 @@ extern "C" {
* }
*/
#ifdef __clang__
#define no_coroutine_fn __attribute__((__annotate__("no_coroutine_fn")))
#define no_coroutine_fn QEMU_ANNOTATE("no_coroutine_fn")
#else
#define no_coroutine_fn
#endif
Expand Down

0 comments on commit d79b920

Please sign in to comment.