summary refs log tree commit diff stats
path: root/docs/devel/qapi-code-gen.txt
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-12-13 16:37:11 +0400
committerMarkus Armbruster <armbru@redhat.com>2018-12-13 19:20:11 +0100
commit6cc32b0e14b3f91e15a9511d90b222abc1df391d (patch)
tree3b8cbbcd19be7c206ae11dd861328ce58dfd6034 /docs/devel/qapi-code-gen.txt
parentea738b21685814dc54352858afabc2ff33ade53e (diff)
downloadfocaccia-qemu-6cc32b0e14b3f91e15a9511d90b222abc1df391d.tar.gz
focaccia-qemu-6cc32b0e14b3f91e15a9511d90b222abc1df391d.zip
qapi: add 'if' to enum members
QAPISchemaMember gains .ifcond for enum members: inherited classes,
such as QAPISchemaObjectTypeMember, will thus have an ifcond member
after this (those different types will also use the .ifcond to store
the condition and generate conditional code in the following patches).

The generated code remains unconditional for now. Later patches
generate the conditionals.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-10-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'docs/devel/qapi-code-gen.txt')
-rw-r--r--docs/devel/qapi-code-gen.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index 2c8b392b20..7ba9066eac 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -752,6 +752,15 @@ gets its generated code guarded like this:
  #endif /* defined(HAVE_BAR) */
  #endif /* defined(CONFIG_FOO) */
 
+An enum value can be replaced by a dictionary with a 'name' and a 'if'
+key.
+
+Example: a conditional 'bar' enum member.
+
+{ 'enum': 'IfEnum', 'data':
+  [ 'foo',
+    { 'name' : 'bar', 'if': 'defined(IFCOND)' } ] }
+
 Please note that you are responsible to ensure that the C code will
 compile with an arbitrary combination of conditions, since the
 generators are unable to check it at this point.