[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v9 30/37] qapi: Canonicalize missing object to :
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v9 30/37] qapi: Canonicalize missing object to :empty |
Date: |
Tue, 26 Jan 2016 17:29:13 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> Eric Blake <address@hidden> 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 <address@hidden>
>>
>> ---
>> 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.
- [Qemu-devel] [PATCH v9 37/37] qapi: Update docs to match recent generator changes, (continued)
- [Qemu-devel] [PATCH v9 37/37] qapi: Update docs to match recent generator changes, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 22/37] qapi: Add visit_type_null() visitor, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 25/37] spapr_drc: Expose 'null' in qom-get when there is no fdt, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 24/37] qmp: Tighten output visitor rules, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 31/37] qapi-visit: Unify struct and union visit, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 30/37] qapi: Canonicalize missing object to :empty, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 19/37] qmp: Fix reference-counting of qnull on empty output visit, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 28/37] qapi: Fix command with named empty argument type, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 23/37] qmp: Support explicit null during input visit, Eric Blake, 2016/01/19
- [Qemu-devel] [PATCH v9 16/37] qapi: Swap 'name' in visit_* callbacks to match public API, Eric Blake, 2016/01/19