qapi: Plumb in 'boxed' to qapi generator lower levels

The next patch will add support for passing a qapi union type
as the 'data' of a command.  But to do that, the user function
for implementing the command, as called by the generated
marshal command, must take the corresponding C struct as a
single boxed pointer, rather than a breakdown into one
parameter per member.  Even without a union, being able to use
a C struct rather than a list of parameters can make it much
easier to handle coding with QAPI.

This patch adds the internal plumbing of a 'boxed' flag
associated with each command and event.  In several cases,
this means adding indentation, with one new dead branch and
the remaining branch being the original code more deeply
nested; this was done so that the new implementation in the
next patch is easier to review without also being mixed with
indentation changes.

For this patch, no behavior or generated output changes, other
than the testsuite outputting the value of the new flag
(always False for now).

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1468468228-27827-9-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Identifier box renamed to boxed in two places]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Eric Blake 2016-07-13 21:50:19 -06:00 committed by Markus Armbruster
parent 4d0b268fdb
commit 48825ca419
9 changed files with 70 additions and 49 deletions

View file

@ -23,9 +23,13 @@ alternate AltStrNum
case s: str
case n: number
event EVENT_A None
boxed=False
event EVENT_B None
boxed=False
event EVENT_C q_obj_EVENT_C-arg
boxed=False
event EVENT_D q_obj_EVENT_D-arg
boxed=False
object Empty1
object Empty2
base Empty1
@ -124,6 +128,7 @@ object UserDefZero
object WrapAlternate
member alt: UserDefAlternate optional=False
event __ORG.QEMU_X-EVENT __org.qemu_x-Struct
boxed=False
alternate __org.qemu_x-Alt
tag type
case __org.qemu_x-branch: str
@ -147,11 +152,11 @@ object __org.qemu_x-Union2
tag __org.qemu_x-member1
case __org.qemu_x-value: __org.qemu_x-Struct2
command __org.qemu_x-command q_obj___org.qemu_x-command-arg -> __org.qemu_x-Union1
gen=True success_response=True
gen=True success_response=True boxed=False
command guest-get-time q_obj_guest-get-time-arg -> int
gen=True success_response=True
gen=True success_response=True boxed=False
command guest-sync q_obj_guest-sync-arg -> any
gen=True success_response=True
gen=True success_response=True boxed=False
object q_empty
object q_obj_EVENT_C-arg
member a: int optional=True
@ -212,10 +217,10 @@ object q_obj_user_def_cmd2-arg
member ud1a: UserDefOne optional=False
member ud1b: UserDefOne optional=True
command user_def_cmd None -> None
gen=True success_response=True
gen=True success_response=True boxed=False
command user_def_cmd0 Empty2 -> Empty2
gen=True success_response=True
gen=True success_response=True boxed=False
command user_def_cmd1 q_obj_user_def_cmd1-arg -> None
gen=True success_response=True
gen=True success_response=True boxed=False
command user_def_cmd2 q_obj_user_def_cmd2-arg -> UserDefTwo
gen=True success_response=True
gen=True success_response=True boxed=False