qapi script: support enum type as discriminator in union
authorWenchao Xia <wenchaoqemu@gmail.com>
Fri, 7 Mar 2014 01:08:56 +0000 (17:08 -0800)
committerLuiz Capitulino <lcapitulino@redhat.com>
Tue, 11 Mar 2014 13:07:42 +0000 (09:07 -0400)
commitbceae7697ff1711675c26f715b945737bc6849ae
treeb528a35656db4d66e9c5be5be54edc7cbeb79344
parentb0b58195e4a3039b6a473124dc27ed707db50240
qapi script: support enum type as discriminator in union

By default, any union will automatically generate a enum type as
"[UnionName]Kind" in C code, and it is duplicated when the discriminator
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.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
docs/qapi-code-gen.txt
scripts/qapi-types.py
scripts/qapi-visit.py
scripts/qapi.py
tests/Makefile
tests/qapi-schema/flat-union-reverse-define.err [new file with mode: 0644]
tests/qapi-schema/flat-union-reverse-define.exit [new file with mode: 0644]
tests/qapi-schema/flat-union-reverse-define.json [new file with mode: 0644]
tests/qapi-schema/flat-union-reverse-define.out [new file with mode: 0644]