From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGqTn-00023d-Ce for qemu-devel@nongnu.org; Fri, 21 Feb 2014 08:49:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGqTi-0004S7-DK for qemu-devel@nongnu.org; Fri, 21 Feb 2014 08:49:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGqTi-0004Px-5a for qemu-devel@nongnu.org; Fri, 21 Feb 2014 08:49:22 -0500 Message-ID: <5307595E.30707@redhat.com> Date: Fri, 21 Feb 2014 06:49:18 -0700 From: Eric Blake MIME-Version: 1.0 References: <1392875695-15627-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1392875695-15627-5-git-send-email-xiawenc@linux.vnet.ibm.com> <87a9dlzvxq.fsf@blackfin.pond.sub.org> <53061EA1.1010508@redhat.com> <87txbsq3jy.fsf@blackfin.pond.sub.org> In-Reply-To: <87txbsq3jy.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AOTLsD78HCTKXLmwm5wL3ri0SnLxpkfIg" Subject: Re: [Qemu-devel] [PATCH V7 04/11] qapi script: check correctness of discriminator values in union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, Wenchao Xia , mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AOTLsD78HCTKXLmwm5wL3ri0SnLxpkfIg Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02/21/2014 01:21 AM, Markus Armbruster wrote: >> I'd still rather make it explicit that we KNOW that this branch of the= >> union has no additional options: >> >> { 'union': 'FooOptions', >> 'base': 'CommonFooOptions', >> 'discriminator': 'type', >> 'data': { 'plain': {}, >> 'bells': 'BellsOptions', >> 'whistles': 'WhistlesOptions' } } >> >> to show that we explicitly thought about all the cases. We don't >> currently have any such unions with an empty branch, but it would be >> worth documenting in the qapi text and explicitly testing that it work= s >> if we intend to support this. >=20 > Fair point. However, it requires 'plain': {} to work, and it doesn't i= n > my testing. > We should extend the generator to permit {} before we insist on unions > covering all discriminator values explicitly. Because if we don't, > people will be compelled to add dummy fields. So far, we have no one that should be omitting a branch. But yes, I agree that we should update the generator to allow an empty branch. In the context of _this_ patch, requiring that all branches are covered doesn't hurt until a future patch actually has to add a dummy field or fix the generator. I don't know if it's something Wenchao would like to add in the next spin, or if we should just live this this patch being a little over-ambitious on what it enforces in the absence of more generic support for an explicit empty branch. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --AOTLsD78HCTKXLmwm5wL3ri0SnLxpkfIg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTB1leAAoJEKeha0olJ0NqQkcH/RsPmWCcCpgr+loxsFdtiwP8 WN8qfPaFuHOFhgAn7cAAnOpu6qY+si8BDf3u1gBQXH6vq+bXhZ5F3NEEcDyHdDHV s8Q9DSxlz4KJWUfEcApxVyRZVGJN4YHFvBnhZwQdpWoi8JygEDHIjj8GCMnQh9pj 3RwrK60vtDSFWa9oUtGj4TKH6e5bsm0SjBcNkCCOMKeyHrwiTGCs+ArxN7jRttEb WlSeqWaVzvDDzjpgcCzAjfsCsSl2iInANkLHZDs7pu7X6CresMuaSBFUktA74LQR VycQg7qgdvbH70h9uxoddsSFixIU7yB2wa5a3DWEXiyeyaePb/2UTtfunhO7iKY= =7Gae -----END PGP SIGNATURE----- --AOTLsD78HCTKXLmwm5wL3ri0SnLxpkfIg--