diff options
author | Wenchao Xia <wenchaoqemu@gmail.com> | 2014-03-04 18:44:39 -0800 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-03-11 09:07:42 -0400 |
commit | 5223070c47c6fc35ee000b2392ae76d9fab54f16 (patch) | |
tree | 52a971bbbc5db95b1ebaa064483eeb6ee54ecaeb /docs | |
parent | 59ca664ef86c8a9078157336b566e832fc5466e2 (diff) | |
download | qemu-5223070c47c6fc35ee000b2392ae76d9fab54f16.zip qemu-5223070c47c6fc35ee000b2392ae76d9fab54f16.tar.gz qemu-5223070c47c6fc35ee000b2392ae76d9fab54f16.tar.bz2 |
qapi script: do not allow string discriminator
Since enum based discriminators provide better type-safety and
ensure that future qapi additions do not forget to adjust dependent
unions, forbid using string as discriminator from now on.
Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/qapi-code-gen.txt | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt index a2e7921..d78921f 100644 --- a/docs/qapi-code-gen.txt +++ b/docs/qapi-code-gen.txt @@ -123,10 +123,7 @@ And it looks like this on the wire: 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 ('type' is -then no longer generated). The discriminator can be a string field or a -predefined enum field. If it is a string field, a hidden enum type will be -generated as "[UNION_NAME]Kind". If it is an enum field, a compile time check -will be done to verify the correctness. It is recommended to use an enum field. +then no longer generated). The discriminator must be of enumeration type. The above example can then be modified as follows: { 'enum': 'BlockdevDriver', 'data': [ 'raw', 'qcow2' ] } |