From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCofR-000179-Nw for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:46:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCofL-0000wu-Pa for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:46:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCofL-0000wh-K2 for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:46:03 -0400 References: <1463784024-17242-1-git-send-email-eblake@redhat.com> <1463784024-17242-4-git-send-email-eblake@redhat.com> <87porjdht3.fsf@dusky.pond.sub.org> From: Eric Blake Message-ID: <57600A99.7030209@redhat.com> Date: Tue, 14 Jun 2016 07:46:01 -0600 MIME-Version: 1.0 In-Reply-To: <87porjdht3.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8s4drh2JEuBh9U6W6favCL11gh2r2XK8K" Subject: Re: [Qemu-devel] [PATCH v7 03/15] qapi: Require all branches of flat union enum to be covered List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8s4drh2JEuBh9U6W6favCL11gh2r2XK8K Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/14/2016 07:24 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> We were previously enforcing that all flat union branches were >> found in the corresponding enum, but not that all enum values >> were covered by branches. The resulting generated code would >> abort() if the user passes the uncovered enum value. >> >> Signed-off-by: Eric Blake >=20 > I'd let the cases not mentioned default to the empty type (ample > precedence in other languages), but I can live with making the user ask= > for the empty type explicitly. But we should then make that less > cumbersome than now: you have to define an empty struct type, and use > that. Examples of such hoop-jumping: CpuInfoOther, Abort, > NetdevNoneOptions. Later in the series, I do just that, so that we can write 'other':{} instead of 'other':'CpuInfoOther'. What I did not do (but maybe should) is make that short syntax possible on simple unions (so that we could do 'abort':{} rather than 'abort':'Abort') - and merely distinguish that simple unions cannot stick anything within the {}, thus leaving non-empty anonymous branches only for discriminated unions. Can do that as a followup or if this series needs a respin. >=20 > Patch looks good. >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --8s4drh2JEuBh9U6W6favCL11gh2r2XK8K Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXYAqZAAoJEKeha0olJ0NqLj8IAKmy2Pl7bRDFDBARUvuoppdi EeIGc0x79T/kIswdaSokfpwz2XsDrNzNj4ywLWmyiGMtkEpjsfd0vZdlxfFbv6TP UU+JHLAUYO79u39yYUs1vuQES6USCaMoqQj2QgN+3Abh08vRqkLo33zHiM5sGFub 2ZkEugRU5SFHBV9IB6GCImw+AihqlVDqJ5eRxgEnyKHJEr6GnR2aekSmR6527sNL de9XtNKnLSNmIqnrau7hfqSw93P1FBaetASeetNFJUg2vRuzDBH5drgNSuo3N4a2 86cyc8EA8YlLiA/djjp6TB8WVDrlYBuKMdTeH8U7eVQih2WARmGuYu2gzsWrS/w= =DcX+ -----END PGP SIGNATURE----- --8s4drh2JEuBh9U6W6favCL11gh2r2XK8K--