[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 22/27] docs: document schema configuration
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v6 22/27] docs: document schema configuration |
Date: |
Fri, 6 Jul 2018 12:57:48 +0200 |
Signed-off-by: Marc-André Lureau <address@hidden>
---
docs/devel/qapi-code-gen.txt | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index c2e11465f0..799aef7728 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -752,6 +752,25 @@ gets its generated code guarded like this:
#endif /* defined(HAVE_BAR) */
#endif /* defined(CONFIG_FOO) */
+Where a member can be defined with a single string value for its type,
+it is also possible to supply a dictionary instead with both 'type'
+and 'if' keys.
+
+Example: a conditional 'bar' member
+
+{ 'struct': 'IfStruct', 'data':
+ { 'foo': 'int',
+ 'bar': { 'type': 'int', 'if': 'defined(IFCOND)'} } }
+
+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.
--
2.18.0.rc1
- [Qemu-devel] [PATCH v6 15/27] qapi: rename allow_dict to allow_implicit, (continued)
- [Qemu-devel] [PATCH v6 15/27] qapi: rename allow_dict to allow_implicit, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 16/27] qapi: add a dictionary form with 'type' key for members, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 18/27] qapi: add an error in case a discriminator is conditionnal, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 17/27] qapi: add 'if' to implicit struct members, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 19/27] qapi: add 'if' on union members, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 20/27] qapi: add 'if' to alternate members, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 21/27] qapi: add #if conditions to generated code members, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 23/27] qapi: add 'If:' condition to enum values documentation, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 24/27] qapi: add 'If:' condition to struct members documentation, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 26/27] qapi: add more conditions to SPICE, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 22/27] docs: document schema configuration,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v6 25/27] qapi: add condition to variants documentation, Marc-André Lureau, 2018/07/06
- [Qemu-devel] [PATCH v6 27/27] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2018/07/06