[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 19/22] qapi: add 'If:' condition to struct member
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v8 19/22] qapi: add 'If:' condition to struct members documentation |
Date: |
Thu, 13 Dec 2018 16:37:21 +0400 |
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 | 1 +
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py
index ab36b9dec6..b6f834b917 100755
--- a/scripts/qapi/doc.py
+++ b/scripts/qapi/doc.py
@@ -143,10 +143,10 @@ def texi_member(member, desc, 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%s' % (
+ return '@item @code{%s%s}%s%s\n%s%s' % (
member.name, membertype,
' (optional)' if member.optional else '',
- suffix, desc)
+ suffix, desc, texi_if(member.ifcond, prefix='@*'))
def texi_members(doc, what, base, variants, member_func):
diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 1cd4935710..28992fc615 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 53bd177f7d..4ab55683ce 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 405055b146..f87f9faacb 100644
--- a/tests/qapi-schema/doc-good.texi
+++ b/tests/qapi-schema/doc-good.texi
@@ -119,6 +119,7 @@ Another paragraph (but no @code{var}: line)
@table @asis
@item @code{var1: string}
Not documented
address@hidden@b{If:} @code{defined(IFSTR)}
@end table
@end deftp
--
2.20.0
- [Qemu-devel] [PATCH v8 12/22] qapi: add a dictionary form for TYPE, (continued)
- [Qemu-devel] [PATCH v8 12/22] qapi: add a dictionary form for TYPE, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 14/22] qapi: add an error in case a discriminator is conditional, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 15/22] qapi: add 'if' to union members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 16/22] qapi: add 'if' to alternate members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 17/22] qapi: add #if conditions to generated code members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 18/22] qapi: add 'If:' condition to enum values documentation, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 19/22] qapi: add 'If:' condition to struct members documentation,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v8 20/22] qapi: add condition to variants documentation, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 22/22] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 21/22] qapi: add more conditions to SPICE, Marc-André Lureau, 2018/12/13
- Re: [Qemu-devel] [PATCH v8 00/22] qapi: add #if pre-processor conditions to generated code (part 2), Markus Armbruster, 2018/12/13
- Re: [Qemu-devel] [PATCH v8 00/22] qapi: add #if pre-processor conditions to generated code (part 2), Markus Armbruster, 2018/12/13