Eric Blake <ebl...@redhat.com> writes: > 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 <ebl...@redhat.com> > > --- > v9: change title, s/box/boxed/ > v8: improve commit message, defer some implementation, rebase without > gen_err_check() > v7: rebase to master > v6: rebase to earlier changes [...] > diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py > index e0f926b..60e9877 100644 > --- a/scripts/qapi-introspect.py > +++ b/scripts/qapi-introspect.py > @@ -154,14 +154,14 @@ const char %(c_name)s[] = %(c_string)s; > for m in variants.variants]}) > > def visit_command(self, name, info, arg_type, ret_type, > - gen, success_response): > + gen, success_response, box):
You missed a box here. Can touch up on commit. > arg_type = arg_type or self._schema.the_empty_object_type > ret_type = ret_type or self._schema.the_empty_object_type > self._gen_json(name, 'command', > {'arg-type': self._use_type(arg_type), > 'ret-type': self._use_type(ret_type)}) > > - def visit_event(self, name, info, arg_type): > + def visit_event(self, name, info, arg_type, box): Likewise. > arg_type = arg_type or self._schema.the_empty_object_type > self._gen_json(name, 'event', {'arg-type': self._use_type(arg_type)}) > [...]