From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf8oj-0005vb-Ee for qemu-devel@nongnu.org; Thu, 24 Sep 2015 11:52:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf8og-0005p1-9F for qemu-devel@nongnu.org; Thu, 24 Sep 2015 11:52:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf8og-0005oS-3B for qemu-devel@nongnu.org; Thu, 24 Sep 2015 11:52:14 -0400 References: <1442872682-6523-1-git-send-email-eblake@redhat.com> <1442872682-6523-5-git-send-email-eblake@redhat.com> <87zj0bgax5.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56041C28.8030108@redhat.com> Date: Thu, 24 Sep 2015 09:52:08 -0600 MIME-Version: 1.0 In-Reply-To: <87zj0bgax5.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wuiH4l8J11aIkfH070u8SxhjWcES3WoNn" Subject: Re: [Qemu-devel] [PATCH v5 04/46] qapi: Add tests for empty unions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcandre.lureau@redhat.com, DirtY.iCE.hu@gmail.com, qemu-devel@nongnu.org, ehabkost@redhat.com, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --wuiH4l8J11aIkfH070u8SxhjWcES3WoNn Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/24/2015 08:16 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> The documentation claims that alternates are useful for >> allowing two types, although nothing enforces this. Meanwhile, >> it is silent on whether empty unions are allowed. In practice, >> the generated code will compile, in part because we have a >> 'void *data' branch; but attempting to visit such a type will >> cause an abort(). Add some tests to expose the problems, and >=20 > There's nothing really wrong with degenerate alternates or unions, but = I > don't want to spend time on making them work. Outlawing them will do. > The commit message could perhaps be rephrased a bit to better convey > that. Sure, that sounds like a better wording to weave in. >=20 > What about empty structs and enums? Empty structs: required support (for example, 'Abort' as a member of 'transaction's union). Empty enums: Documented as not very useful but currently supported, and we already have code that tests that we don't choke on them. >=20 >> adjust existing tests that should be failing for other reasons. >=20 > I had to read this a few times until I understood "should be failing fo= r > other reasons" means something like "are meant to test something else, > but could fail for the wrong reason if we reject degenerate alternates = / > unions". I like it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --wuiH4l8J11aIkfH070u8SxhjWcES3WoNn 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/ iQEcBAEBCAAGBQJWBBwoAAoJEKeha0olJ0Nqik8H/0mIBemaurGN/wVhuINiheov q/HciNfiBfvJ19MjkMgdxUiHno5Tq4jsC1LYwtTssdvicz78KRsyjNDxhP98wX15 32rRi+ZZ1lLKZp7rkGIaBSEN9ThwK6s1FsKRKMaBdsQKyDxHoVVJBTXD/IaKwijT XDA6ika9zFvPtHJ8pgevnr5Thpp7wFIKQeZjgd8ZZCxAEnmw5Lr7q5tGmkC78hYe 3XQrXK1koL4ECmMBBYFHkfLHoALhTm1nK5WOcpzdM2VJ3NNFNtreWDXt8OO1o2fd AlQ5xCpxuldfgWHhd+6cXSL3eVRcEoHfUbROasYB138gjJb2aUFtnUWcZ6sFAsA= =ZRzI -----END PGP SIGNATURE----- --wuiH4l8J11aIkfH070u8SxhjWcES3WoNn--