Markus Armbruster <arm...@redhat.com> writes: > Eric Blake <ebl...@redhat.com> writes: > >> Now that we elide unnecessary visits of empty types, we can >> start using the special ':empty' type in more places. By using >> the empty type as the base class of every explicit struct or >> union, and as the default data for any command or event, we can >> simplify later logic in qapi-{visit,commands,event} by merely >> checking whether the type is empty, without also having to worry >> whether a type was even supplied. >> >> Note that gen_object() in qapi-types still has to check for a >> base, because it is also called for alternates (which have no >> base). > > What about the one in gen_visit_struct()? > > if (base and not base.is_empty()) or members: > ret += mcgen(''' > visit_type_%(c_name)s_fields(v, obj, &err); > ''', > c_name=c_name(name)) > >> No change to generated code. >> >> Signed-off-by: Eric Blake <ebl...@redhat.com> >> >> --- >> v9: squash in more related changes >> v8: rebase to earlier changes >> v7: rebase to earlier changes >> v6: new patch >> --- >> scripts/qapi-commands.py | 17 +++++++------ >> scripts/qapi-event.py | 5 ++-- >> scripts/qapi-types.py | 4 +-- >> scripts/qapi-visit.py | 12 +++++---- >> scripts/qapi.py | 25 +++++++++--------- >> tests/qapi-schema/event-case.out | 2 +- >> tests/qapi-schema/flat-union-empty.out | 1 + >> tests/qapi-schema/ident-with-escape.out | 1 + >> tests/qapi-schema/indented-expr.out | 4 +-- >> tests/qapi-schema/qapi-schema-test.out | 45 >> ++++++++++++++++++++++++++++++--- >> tests/qapi-schema/union-clash-data.out | 2 ++ >> tests/qapi-schema/union-empty.out | 1 + >> 12 files changed, 83 insertions(+), 36 deletions(-)
Missing: update to qapi-introspect.py. At least the expressions like arg_type or self._schema.the_empty_object_type need updating. I got stuck in reviewing PATCH 31. The result is probably fine, but the patch itself is impenetrable for me. I'm playing with the code to see whether I can turn that into a constructive remark.