From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VngQR-0005EO-TH for qemu-devel@nongnu.org; Mon, 02 Dec 2013 22:13:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VngQN-0008Q2-0J for qemu-devel@nongnu.org; Mon, 02 Dec 2013 22:13:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VngQM-0008Nx-N5 for qemu-devel@nongnu.org; Mon, 02 Dec 2013 22:13:22 -0500 Message-ID: <529D4C4F.9070803@redhat.com> Date: Mon, 02 Dec 2013 20:13:19 -0700 From: Eric Blake MIME-Version: 1.0 References: <1385714473-7322-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1385714473-7322-7-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1385714473-7322-7-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pXqvb54smAqk0BVapHaW7TFtCgceLR1s3" Subject: Re: [Qemu-devel] [PATCH V3 6/9] qapi script: support pre-defined enum type as discriminator in union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pXqvb54smAqk0BVapHaW7TFtCgceLR1s3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/29/2013 01:41 AM, Wenchao Xia wrote: > By default, any union will automatically generate a enum type as > "[UnionName]Kind" in C code, and it is duplicated when the discriminato= r > is specified as a pre-defined enum type in schema. After this patch, > the pre-defined enum type will be really used as the switch case > condition in generated C code, if discriminator is an enum field. >=20 > Signed-off-by: Wenchao Xia > --- > Flat union types avoid the nesting on the wire. They are used whenever= a > specific field of the base type is declared as the discriminator ('typ= e' is > -then no longer generated). The discriminator must always be a string f= ield. > +then no longer generated). The discriminator can be a string field or = a > +predfined enum field. If it is a string field, a hidden enum type will= be s/predfined/predefined/ > +generated as "[UNION_NAME]Kind". If it is an enum field, compile time = check s/compile/a compile/ > +will be done to verify the correctness. It is recommended to use enum = field. s/enum/an enum/ Thanks for the added documentation on this round. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --pXqvb54smAqk0BVapHaW7TFtCgceLR1s3 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.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSnUxPAAoJEKeha0olJ0Nq6gcIAKsp9uTTANou2mluPaLrbHGZ DS7B/Jq/dPWojRsWNdAd9IEumwI0Ugpfzg+J4JsdNxgRL2LEniCvmF70Y8I4gDec 4nDTppM51Sr1U9Zn+sHz4HhR8wJ4MhKj6z6xQzAV36I7CaRfXWhkTqNTHWBlvQ4/ KPcaBZNwxuupm4jZ3sZvMmKwbxjAHEA9JQY+ubY4E5nNl11dLJ6vn/4RxpzTxtgQ tKPN1ZcluOtGgcZv9nS2bemkrJfLqr6his0RFYKJTBsa4OjRrFkr8vBITX9g5GL+ yyMIg6sInieuwI7pxpkYEblFxDESt2kuwWHchAACE9ckWn28R+Wd6bIVxkhnPuc= =w/kU -----END PGP SIGNATURE----- --pXqvb54smAqk0BVapHaW7TFtCgceLR1s3--