This patch series is a follow up to a previous RFC about converting functions that dynamically yield execution depending on whether they are in executing in a coroutine context or not to be explicitly statically annotated. This change is necessary for the GSoC CPC project, but was also agreed in an IRC conversation on #qemu to be benefical overall if it can be upstream before the end of the project. This is an update to see if the approach I'm taking to implementing this conversion is correct.
In order to statically check the tree to ensure the annotations are correct, I've been using CPC to compile the QEMU tree. This does a source to source translation to convert coroutine code to continuation-passing style (the purpose of the GSoC project), but as a side benefit statically checks annotations (any functions annotated with coroutine_fn are transformed into CPS, so have a different "calling style" to the standard C convention). In order to compile the tree with CPC: $ git clone git://github.com/kerneis/cpc.git $ cd cpc $ make $ ./configure $ make $ cd .. $ export CPC=$(pwd)/cpc/bin/cpc $ cd qemu $ mkdir -p bin/cpc $ cd bin/cpc $ ../../configure --enable-debug --disable-werror --target-list=x86_64-softmmu --cc="$CPC" --extra-cflags="--noMakeStaticGlobal --useLogicalOperators --useCaseRange --save-temps -U__SSE2__ -w -Dcoroutine_fn='__attribute__((__cps__))' --docpsInference --warnall " $ make Charlie Shepherd (5): Add an explanation of when a function should be marked qemu_coroutine_self should not be marked coroutine_fn Convert BlockDriver to explicit coroutine annotations Convert block functions to coroutine versions Convert block layer callers' annotations block.c | 247 ++++++++++++++++++++++-------------------- block/blkdebug.c | 10 +- block/blkverify.c | 4 +- block/bochs.c | 12 +- block/cloop.c | 10 +- block/cow.c | 20 ++-- block/curl.c | 12 +- block/dmg.c | 14 +-- block/mirror.c | 4 +- block/nbd.c | 28 ++--- block/parallels.c | 6 +- block/qcow.c | 14 +-- block/qcow2-cluster.c | 8 +- block/qcow2.c | 66 ++++++++--- block/qcow2.h | 6 +- block/qed.c | 8 +- block/raw-posix.c | 34 +++--- block/raw.c | 8 +- block/sheepdog.c | 24 ++-- block/snapshot.c | 32 +++++- block/ssh.c | 14 +-- block/vdi.c | 16 +-- block/vhdx.c | 4 +- block/vmdk.c | 46 ++++---- block/vpc.c | 16 +-- block/vvfat.c | 32 +++--- blockjob.c | 2 +- coroutine-ucontext.c | 2 +- include/block/block.h | 37 ++++--- include/block/block_int.h | 10 +- include/block/blockjob.h | 2 +- include/block/coroutine.h | 9 +- include/block/coroutine_int.h | 2 +- nbd.c | 4 +- qemu-coroutine-lock.c | 4 +- qemu-img.c | 54 +++++++-- qemu-io-cmds.c | 12 +- 37 files changed, 477 insertions(+), 356 deletions(-) -- 1.8.3.2