mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 05:51:53 -06:00
coroutine: Move coroutine_fn to qemu/osdep.h, trim includes
block/block-hmp-cmds.h and qemu/co-shared-resource.h use coroutine_fn without including qemu/coroutine.h. They compile only if it's already included from elsewhere. I could fix that, but pulling in qemu/coroutine.h and everything it includes just for a macro that expands into nothing feels silly. Instead, move the macro to qemu/osdep.h. Inclusions of qemu/coroutine.h just for coroutine_fn become superfluous. Drop them. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20221221131435.3851212-3-armbru@redhat.com>
This commit is contained in:
parent
2379247810
commit
af7f8eb591
6 changed files with 23 additions and 17 deletions
|
@ -26,23 +26,19 @@
|
|||
* waiting for events to complete.
|
||||
*
|
||||
* These functions are re-entrant and may be used outside the global mutex.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mark a function that executes in coroutine context
|
||||
*
|
||||
* Functions that execute in coroutine context cannot be called directly from
|
||||
* normal functions. In the future it would be nice to enable compiler or
|
||||
* static checker support for catching such errors. This annotation might make
|
||||
* it possible and in the meantime it serves as documentation.
|
||||
*
|
||||
* For example:
|
||||
* Functions that execute in coroutine context cannot be called
|
||||
* directly from normal functions. Use @coroutine_fn to mark such
|
||||
* functions. For example:
|
||||
*
|
||||
* static void coroutine_fn foo(void) {
|
||||
* ....
|
||||
* }
|
||||
*
|
||||
* In the future it would be nice to have the compiler or a static
|
||||
* checker catch misuse of such functions. This annotation might make
|
||||
* it possible and in the meantime it serves as documentation.
|
||||
*/
|
||||
#define coroutine_fn
|
||||
|
||||
typedef struct Coroutine Coroutine;
|
||||
|
||||
|
|
|
@ -157,6 +157,22 @@ extern "C" {
|
|||
|
||||
#include "qemu/typedefs.h"
|
||||
|
||||
/**
|
||||
* Mark a function that executes in coroutine context
|
||||
*
|
||||
* Functions that execute in coroutine context cannot be called directly from
|
||||
* normal functions. In the future it would be nice to enable compiler or
|
||||
* static checker support for catching such errors. This annotation might make
|
||||
* it possible and in the meantime it serves as documentation.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* static void coroutine_fn foo(void) {
|
||||
* ....
|
||||
* }
|
||||
*/
|
||||
#define coroutine_fn
|
||||
|
||||
/*
|
||||
* For mingw, as of v6.0.0, the function implementing the assert macro is
|
||||
* not marked as noreturn, so the compiler cannot delete code following an
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue