Received: from eggs.gnu.org ([2001:4830:134:3::10]:51714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn3iK-0001DM-6w for qemu-devel@nongnu.org; Tue, 28 Apr 2015 07:30:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yn3iG-0003sY-3G for qemu-devel@nongnu.org; Tue, 28 Apr 2015 07:30:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn3iF-0003qu-Ro for qemu-devel@nongnu.org; Tue, 28 Apr 2015 07:30:04 -0400 From: Markus Armbruster References: <1428206887-7921-1-git-send-email-eblake@redhat.com> <1428206887-7921-25-git-send-email-eblake@redhat.com> Date: Tue, 28 Apr 2015 13:30:00 +0200 In-Reply-To: <1428206887-7921-25-git-send-email-eblake@redhat.com> (Eric Blake's message of "Sat, 4 Apr 2015 22:07:55 -0600") Message-ID: <87383ksd6v.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v6 24/36] qapi: More rigourous checking of types List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, berto@igalia.co, qemu-devel@nongnu.org Eric Blake writes: > Now that we know every expression is valid with regards to > its keys, we can add further tests that those keys refer to > valid types. With this patch, all uses of a type (the 'data': > of command, type, union, alternate, and event; the 'returns': > of command; the 'base': of type and union) must resolve to an > appropriate subset of metatypes declared by the current qapi > parse; this includes recursing into each member of a data > dictionary. Dealing with '**' and nested anonymous structs > will be done in later patches. > > Update the testsuite to match improved output. > > Signed-off-by: Eric Blake [...] > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 686bc86..9f64a0d 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py [...] > @@ -352,6 +414,11 @@ def check_union(expr, expr_info): > > # Check every branch > for (key, value) in members.items(): > + # Each value must name a known type; futhermore, in flat unions, furthermore > + # branches must be a struct > + check_type(expr_info, "Member '%s' of union '%s'" % (key, name), > + value, allow_array=True, allow_metas=allow_metas) > + > # If the discriminator names an enum type, then all members > # of 'data' must also be members of the enum type. > if enum_define: [...] Regardless, Reviewed-by: Markus Armbruster