From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO6Ub-00017v-7Q for qemu-devel@nongnu.org; Tue, 26 Jan 2016 11:29:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aO6UX-0001En-Ra for qemu-devel@nongnu.org; Tue, 26 Jan 2016 11:29:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO6UX-0001EC-Ly for qemu-devel@nongnu.org; Tue, 26 Jan 2016 11:29:17 -0500 From: Markus Armbruster References: <1453219845-30939-1-git-send-email-eblake@redhat.com> <1453219845-30939-31-git-send-email-eblake@redhat.com> <87bn891nwr.fsf@blackfin.pond.sub.org> Date: Tue, 26 Jan 2016 17:29:13 +0100 In-Reply-To: <87bn891nwr.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Mon, 25 Jan 2016 20:04:20 +0100") Message-ID: <8760yguwx2.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v9 30/37] qapi: Canonicalize missing object to :empty List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, Michael Roth Markus Armbruster writes: > Eric Blake 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 >> >> --- >> 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.