[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 33/49] qapi2texi: add 'If:' condition to struct m
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v3 33/49] qapi2texi: add 'If:' condition to struct members |
Date: |
Wed, 21 Mar 2018 12:51:55 +0100 |
Signed-off-by: Marc-André Lureau <address@hidden>
---
scripts/qapi/doc.py | 4 +++-
tests/qapi-schema/doc-good.json | 3 ++-
tests/qapi-schema/doc-good.out | 1 +
tests/qapi-schema/doc-good.texi | 2 ++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py
index f629425f53..42e34e1fe3 100755
--- a/scripts/qapi/doc.py
+++ b/scripts/qapi/doc.py
@@ -138,9 +138,11 @@ def texi_member(member, suffix=''):
"""Format a table of members item for an object type member"""
typ = member.type.doc_type()
membertype = ': ' + typ if typ else ''
- return '@item @code{%s%s}%s%s\n' % (
+ return '@item @code{%s%s}%s%s%s\n' % (
member.name, membertype,
' (optional)' if member.optional else '',
+ 'address@hidden:} @code{%s}\n' %
+ ', '.join(member.ifcond) if member.ifcond else '',
suffix)
diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index c7fe08c530..158443b1a3 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -72,7 +72,8 @@
#
# Another paragraph (but no @var: line)
##
-{ 'struct': 'Variant1', 'data': { 'var1': 'str' } }
+{ 'struct': 'Variant1',
+ 'data': { 'var1': { 'type': 'str', 'if': 'defined(IFSTR)' } } }
##
# @Variant2:
diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out
index d27d345de2..9976d29eb0 100644
--- a/tests/qapi-schema/doc-good.out
+++ b/tests/qapi-schema/doc-good.out
@@ -18,6 +18,7 @@ object Base
member base1: Enum optional=False
object Variant1
member var1: str optional=False
+ if ['defined(IFSTR)']
object Variant2
object Object
base Base
diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi
index 2446a1c702..255eed9a30 100644
--- a/tests/qapi-schema/doc-good.texi
+++ b/tests/qapi-schema/doc-good.texi
@@ -120,6 +120,8 @@ Another paragraph (but no @code{var}: line)
@b{Members:}
@table @asis
@item @code{var1: string}
address@hidden:} @code{defined(IFSTR)}
+
Not documented
@end table
--
2.16.2.521.g9aa15f885a
- [Qemu-devel] [PATCH v3 23/49] qapi: rename allow_dict to allow_implicit, (continued)
- [Qemu-devel] [PATCH v3 23/49] qapi: rename allow_dict to allow_implicit, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 25/49] qapi: add 'if' to implicit struct members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 24/49] qapi: add a dictionary form with 'type' key for members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 26/49] qapi: add an error in case a discriminator is conditionnal, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 27/49] qapi: add 'if' on union members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 28/49] qapi: add 'if' to alternate members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 29/49] qapi: add #if conditions to generated code members, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 32/49] qapi2texi: add 'If:' condition to enum values, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 30/49] docs: document schema configuration, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 31/49] qapi2texi: add 'If:' section to generated documentation, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 33/49] qapi2texi: add 'If:' condition to struct members,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v3 35/49] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 34/49] qapi2texi: add condition to variants, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 36/49] qapi: add conditions to SPICE type/commands/events on the schema, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 37/49] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 38/49] build-sys: move qmp-introspect per target, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 39/49] qapi-commands: don't initialize command list in qmp_init_marshall(), Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 40/49] RFC: qapi: learn to split schema by 'top-unit', Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 41/49] qapi: add a top-unit 'target' schema, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 44/49] target.json: add a note about query-cpu* not being s390x-specific, Marc-André Lureau, 2018/03/21
- [Qemu-devel] [PATCH v3 42/49] qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386, Marc-André Lureau, 2018/03/21