Skip to contentSkip to conversation

qapi: Put type information back into QMP documentation

PATCH Superseded Markus Armbruster 3 participants 137 messages Mar 13, 2017 – Apr 27, 2017 Kbuild Page 2 of 2

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
Reviewed-by on v1 39/47
#110 lore raw

Re: [Qemu-devel] [PATCH for-2.9 39/47] qapi: Drop unused variable events

In reply to Markus Armbruster
Quoted 12 lines · Markus Armbruster

Missed in commit e98859a

---
 scripts/qapi.py | 3 ---
 1 file changed, 3 deletions(-)
scripts/qapi.py +0 -0
index 0da426a..12b1bda 100644

scripts/qapi.py name_case_whitelist = [] · line 52

Quoted 5 lines
scripts/qapi.py +0 -1
@@ -49,7 +49,6 @@ name_case_whitelist = []
 enum_types = []
 struct_types = []
 union_types = []
-events = []
 all_names = {}
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#111 lore raw

PATCH 40/47 qapi: Simplify what gets stored in enum_types

In reply to Markus Armbruster

Don't invent a new dictionary structure just for enum_types, simply store the defining expression, like we do for struct_types and union_types.

---
 scripts/qapi.py | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
scripts/qapi.py +15 -14
index 12b1bda..ffd30d2 100644
@@ -663,16 +663,17 @@ def find_union(name):
     return None
 
 
-def add_enum(name, info, enum_values=None, implicit=False):
+def add_enum(definition, info):
     global enum_types
-    add_name(name, info, 'enum', implicit)
-    enum_types.append({'enum_name': name, 'enum_values': enum_values})
+    name = definition['enum']
+    add_name(name, info, 'enum', 'data' not in definition)
+    enum_types.append(definition)
 
 
 def find_enum(name):
     global enum_types
     for enum in enum_types:
-        if enum['enum_name'] == name:
+        if enum['enum'] == name:
             return enum
     return None
 
@@ -820,15 +821,15 @@ def check_union(expr, info):
         # If the discriminator names an enum type, then all members
         # of 'data' must also be members of the enum type.
         if enum_define:
-            if key not in enum_define['enum_values']:
+            if key not in enum_define['data']:
                 raise QAPISemError(info,
                                    "Discriminator value '%s' is not found in "
                                    "enum '%s'"
-                                   % (key, enum_define['enum_name']))
+                                   % (key, enum_define['enum']))
 
     # If discriminator is user-defined, ensure all values are covered
     if enum_define:
-        for value in enum_define['enum_values']:
+        for value in enum_define['data']:
             if value not in members.keys():
                 raise QAPISemError(info, "Union '%s' data missing '%s' branch"
                                    % (name, value))
@@ -933,7 +934,7 @@ def check_exprs(exprs):
         if 'enum' in expr:
             name = expr['enum']
             check_keys(expr_elem, 'enum', ['data'], ['prefix'])
-            add_enum(name, info, expr['data'])
+            add_enum(expr, info)
         elif 'union' in expr:
             name = expr['union']
             check_keys(expr_elem, 'union', ['data'],
@@ -966,13 +967,13 @@ def check_exprs(exprs):
     # Try again for hidden UnionKind enum
     for expr_elem in exprs:
         expr = expr_elem['expr']
-        if 'union' in expr:
-            if not discriminator_find_enum_define(expr):
-                add_enum('%sKind' % expr['union'], expr_elem['info'],
-                         implicit=True)
+        if 'union' in expr and not discriminator_find_enum_define(expr):
+            name = '%sKind' % expr['union']
         elif 'alternate' in expr:
-            add_enum('%sKind' % expr['alternate'], expr_elem['info'],
-                     implicit=True)
+            name = '%sKind' % expr['alternate']
+        else:
+            continue
+        add_enum({ 'enum': name }, expr_elem['info'])
 
     # Validate that exprs make sense
     for expr_elem in exprs:
Signature · 1 line
2.7.4
Reviewed-by on v1 40/47
#112 lore raw

Re: [Qemu-devel] [PATCH for-2.9 40/47] qapi: Simplify what gets stored in enum_types

Quoted 9 lines · Markus Armbruster

Don't invent a new dictionary structure just for enum_types, simply store the defining expression, like we do for struct_types and union_types.

---
 scripts/qapi.py | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#113 lore raw

PATCH 41/47 qapi: Factor add_name() calls out of the meta conditional

In reply to Markus Armbruster
---
 scripts/qapi.py | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
scripts/qapi.py +9 -15
index ffd30d2..f06e3c4 100644
@@ -635,8 +635,6 @@ def add_name(name, info, meta, implicit=False):
 
 def add_struct(definition, info):
     global struct_types
-    name = definition['struct']
-    add_name(name, info, 'struct')
     struct_types.append(definition)
 
 
@@ -650,8 +648,6 @@ def find_struct(name):
 
 def add_union(definition, info):
     global union_types
-    name = definition['union']
-    add_name(name, info, 'union')
     union_types.append(definition)
 
 
@@ -665,8 +661,6 @@ def find_union(name):
 
 def add_enum(definition, info):
     global enum_types
-    name = definition['enum']
-    add_name(name, info, 'enum', 'data' not in definition)
     enum_types.append(definition)
 
 
@@ -932,34 +926,33 @@ def check_exprs(exprs):
                                "Expression missing documentation comment")
 
         if 'enum' in expr:
-            name = expr['enum']
+            meta = 'enum'
             check_keys(expr_elem, 'enum', ['data'], ['prefix'])
             add_enum(expr, info)
         elif 'union' in expr:
-            name = expr['union']
+            meta = 'union'
             check_keys(expr_elem, 'union', ['data'],
                        ['base', 'discriminator'])
             add_union(expr, info)
         elif 'alternate' in expr:
-            name = expr['alternate']
+            meta = 'alternate'
             check_keys(expr_elem, 'alternate', ['data'])
-            add_name(name, info, 'alternate')
         elif 'struct' in expr:
-            name = expr['struct']
+            meta = 'struct'
             check_keys(expr_elem, 'struct', ['data'], ['base'])
             add_struct(expr, info)
         elif 'command' in expr:
-            name = expr['command']
+            meta = 'command'
             check_keys(expr_elem, 'command', [],
                        ['data', 'returns', 'gen', 'success-response', 'boxed'])
-            add_name(name, info, 'command')
         elif 'event' in expr:
-            name = expr['event']
+            meta = 'event'
             check_keys(expr_elem, 'event', [], ['data', 'boxed'])
-            add_name(name, info, 'event')
         else:
             raise QAPISemError(expr_elem['info'],
                                "Expression is missing metatype")
+        name = expr[meta]
+        add_name(name, info, meta)
         if doc and doc.symbol != name:
             raise QAPISemError(info, "Definition of '%s' follows documentation"
                                " for '%s'" % (name, doc.symbol))
@@ -974,6 +967,7 @@ def check_exprs(exprs):
         else:
             continue
         add_enum({ 'enum': name }, expr_elem['info'])
+        add_name(name, info, 'enum', implicit=True)
 
     # Validate that exprs make sense
     for expr_elem in exprs:
Signature · 1 line
2.7.4
Reviewed-by on v1 41/47
#114 lore raw

Re: [Qemu-devel] [PATCH for-2.9 41/47] qapi: Factor add_name() calls out of the meta conditional

Quoted 5 lines · Markus Armbruster
---
 scripts/qapi.py | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

scripts/qapi.py def find_union(name): · line 669

Quoted 4 lines

def add_enum(definition, info):
global enum_types

scripts/qapi.py +0 -2
-    name = definition['enum']
-    add_name(name, info, 'enum', 'data' not in definition)

Here, we were passing a potential True for the 'implicit' parameter...

scripts/qapi.py def check_exprs(exprs): · line 955

Quoted 2 lines
scripts/qapi.py +2 -0
+        name = expr[meta]
+        add_name(name, info, meta)

...here, we always pass False, but that's okay (an explicit enum always has 'data'),

scripts/qapi.py def check_exprs(exprs): · line 970

Quoted 8 lines
         if doc and doc.symbol != name:
             raise QAPISemError(info, "Definition of '%s' follows documentation"
                                " for '%s'" % (name, doc.symbol))
scripts/qapi.py +1 -0
@@ -974,6 +967,7 @@ def check_exprs(exprs):
         else:
             continue
         add_enum({ 'enum': name }, expr_elem['info'])
+        add_name(name, info, 'enum', implicit=True)

...and here is the only place that was getting implicit=True. Took me a while to see it, but the refactoring is sane.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#115 lore raw

PATCH 42/47 qapi: enum_types is a list used like a dict, make it one

In reply to Markus Armbruster
---
 scripts/qapi.py | 29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)
scripts/qapi.py +6 -23
index f06e3c4..5a3a606 100644
@@ -46,7 +46,7 @@ returns_whitelist = []
 # Whitelist of entities allowed to violate case conventions
 name_case_whitelist = []
 
-enum_types = []
+enum_types = {}
 struct_types = []
 union_types = []
 all_names = {}
@@ -562,7 +562,7 @@ def find_alternate_member_qtype(qapi_type):
         return builtin_types[qapi_type]
     elif find_struct(qapi_type):
         return 'QTYPE_QDICT'
-    elif find_enum(qapi_type):
+    elif qapi_type in enum_types:
         return 'QTYPE_QSTRING'
     elif find_union(qapi_type):
         return 'QTYPE_QDICT'
@@ -586,7 +586,7 @@ def discriminator_find_enum_define(expr):
     if not discriminator_type:
         return None
 
-    return find_enum(discriminator_type)
+    return enum_types.get(discriminator_type)
 
 
 # Names must be letters, numbers, -, and _.  They must start with letter,
@@ -659,23 +659,6 @@ def find_union(name):
     return None
 
 
-def add_enum(definition, info):
-    global enum_types
-    enum_types.append(definition)
-
-
-def find_enum(name):
-    global enum_types
-    for enum in enum_types:
-        if enum['enum'] == name:
-            return enum
-    return None
-
-
-def is_enum(name):
-    return find_enum(name) is not None
-
-
 def check_type(info, source, value, allow_array=False,
                allow_dict=False, allow_optional=False,
                allow_metas=[]):
@@ -794,7 +777,7 @@ def check_union(expr, info):
                                "Discriminator '%s' is not a member of base "
                                "struct '%s'"
                                % (discriminator, base))
-        enum_define = find_enum(discriminator_type)
+        enum_define = enum_types.get(discriminator_type)
         allow_metas = ['struct']
         # Do not allow string discriminator
         if not enum_define:
@@ -928,7 +911,7 @@ def check_exprs(exprs):
         if 'enum' in expr:
             meta = 'enum'
             check_keys(expr_elem, 'enum', ['data'], ['prefix'])
-            add_enum(expr, info)
+            enum_types[expr[meta]] = expr
         elif 'union' in expr:
             meta = 'union'
             check_keys(expr_elem, 'union', ['data'],
@@ -966,7 +949,7 @@ def check_exprs(exprs):
             name = '%sKind' % expr['alternate']
         else:
             continue
-        add_enum({ 'enum': name }, expr_elem['info'])
+        enum_types[name] = { 'enum': name }
         add_name(name, info, 'enum', implicit=True)
 
     # Validate that exprs make sense
Signature · 1 line
2.7.4
Reviewed-by on v1 42/47
#116 lore raw

Re: [Qemu-devel] [PATCH for-2.9 42/47] qapi: enum_types is a list used like a dict, make it one

Quoted 5 lines · Markus Armbruster
---
 scripts/qapi.py | 29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

No idea if python actually behaves more efficiently, but this is a nice algorithmic change:

Quoted 14 lines
scripts/qapi.py +1 -1
index f06e3c4..5a3a606 100644
@@ -46,7 +46,7 @@ returns_whitelist = []
 # Whitelist of entities allowed to violate case conventions
 name_case_whitelist = []
 
-enum_types = []
+enum_types = {}
 struct_types = []
 union_types = []
 all_names = {}

scripts/qapi.py def find_alternate_member_qtype(qapi_type): · line 565

Quoted 5 lines
scripts/qapi.py +1 -1
@@ -562,7 +562,7 @@ def find_alternate_member_qtype(qapi_type):
         return builtin_types[qapi_type]
     elif find_struct(qapi_type):
         return 'QTYPE_QDICT'
-    elif find_enum(qapi_type):
+    elif qapi_type in enum_types:

A good dictionary uses a tree structure for O(log n), or even hash lookup for amortized O(1) behavior here,

scripts/qapi.py def find_union(name): · line 673

Quoted 7 lines
scripts/qapi.py +0 -7
-def find_enum(name):
-    global enum_types
-    for enum in enum_types:
-        if enum['enum'] == name:
-            return enum
-    return None
-

while our lookup was O(n) on paper.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#117 lore raw

PATCH 43/47 qapi: struct_types is a list used like a dict, make it one

In reply to Markus Armbruster
---
 scripts/qapi.py | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
scripts/qapi.py +4 -17
index 5a3a606..ab266db 100644
@@ -47,7 +47,7 @@ returns_whitelist = []
 name_case_whitelist = []
 
 enum_types = {}
-struct_types = []
+struct_types = {}
 union_types = []
 all_names = {}
 
@@ -550,7 +550,7 @@ class QAPISchemaParser(object):
 def find_base_members(base):
     if isinstance(base, dict):
         return base
-    base_struct_define = find_struct(base)
+    base_struct_define = struct_types.get(base)
     if not base_struct_define:
         return None
     return base_struct_define['data']
@@ -560,7 +560,7 @@ def find_base_members(base):
 def find_alternate_member_qtype(qapi_type):
     if qapi_type in builtin_types:
         return builtin_types[qapi_type]
-    elif find_struct(qapi_type):
+    elif qapi_type in struct_types:
         return 'QTYPE_QDICT'
     elif qapi_type in enum_types:
         return 'QTYPE_QSTRING'
@@ -633,19 +633,6 @@ def add_name(name, info, meta, implicit=False):
     all_names[name] = meta
 
 
-def add_struct(definition, info):
-    global struct_types
-    struct_types.append(definition)
-
-
-def find_struct(name):
-    global struct_types
-    for struct in struct_types:
-        if struct['struct'] == name:
-            return struct
-    return None
-
-
 def add_union(definition, info):
     global union_types
     union_types.append(definition)
@@ -923,7 +910,7 @@ def check_exprs(exprs):
         elif 'struct' in expr:
             meta = 'struct'
             check_keys(expr_elem, 'struct', ['data'], ['base'])
-            add_struct(expr, info)
+            struct_types[expr[meta]] = expr
         elif 'command' in expr:
             meta = 'command'
             check_keys(expr_elem, 'command', [],
Signature · 1 line
2.7.4
Reviewed-by on v1 43/47
#118 lore raw

Re: [Qemu-devel] [PATCH for-2.9 43/47] qapi: struct_types is a list used like a dict, make it one

Quoted 5 lines · Markus Armbruster
---
 scripts/qapi.py | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#119 lore raw

PATCH 44/47 qapi: union_types is a list used like a dict, make it one

In reply to Markus Armbruster
---
 scripts/qapi.py | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
scripts/qapi.py +3 -16
index ab266db..870ff4e 100644
@@ -48,7 +48,7 @@ name_case_whitelist = []
 
 enum_types = {}
 struct_types = {}
-union_types = []
+union_types = {}
 all_names = {}
 
 #
@@ -564,7 +564,7 @@ def find_alternate_member_qtype(qapi_type):
         return 'QTYPE_QDICT'
     elif qapi_type in enum_types:
         return 'QTYPE_QSTRING'
-    elif find_union(qapi_type):
+    elif qapi_type in union_types:
         return 'QTYPE_QDICT'
     return None
 
@@ -633,19 +633,6 @@ def add_name(name, info, meta, implicit=False):
     all_names[name] = meta
 
 
-def add_union(definition, info):
-    global union_types
-    union_types.append(definition)
-
-
-def find_union(name):
-    global union_types
-    for union in union_types:
-        if union['union'] == name:
-            return union
-    return None
-
-
 def check_type(info, source, value, allow_array=False,
                allow_dict=False, allow_optional=False,
                allow_metas=[]):
@@ -903,7 +890,7 @@ def check_exprs(exprs):
             meta = 'union'
             check_keys(expr_elem, 'union', ['data'],
                        ['base', 'discriminator'])
-            add_union(expr, info)
+            union_types[expr[meta]] = expr
         elif 'alternate' in expr:
             meta = 'alternate'
             check_keys(expr_elem, 'alternate', ['data'])
Signature · 1 line
2.7.4
Reviewed-by on v1 44/47
#120 lore raw

Re: [Qemu-devel] [PATCH for-2.9 44/47] qapi: union_types is a list used like a dict, make it one

Quoted 5 lines · Markus Armbruster
---
 scripts/qapi.py | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#121 lore raw

PATCH 45/47 qapi: Drop unused .check_clash() parameter schema

In reply to Markus Armbruster
---
 scripts/qapi.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
scripts/qapi.py +5 -5
index 870ff4e..4102011 100644
@@ -1178,7 +1178,7 @@ class QAPISchemaObjectType(QAPISchemaType):
             self.base = schema.lookup_type(self._base_name)
             assert isinstance(self.base, QAPISchemaObjectType)
             self.base.check(schema)
-            self.base.check_clash(schema, self.info, seen)
+            self.base.check_clash(self.info, seen)
         for m in self.local_members:
             m.check(schema)
             m.check_clash(self.info, seen)
@@ -1188,14 +1188,14 @@ class QAPISchemaObjectType(QAPISchemaType):
         if self.variants:
             self.variants.check(schema, seen)
             assert self.variants.tag_member in self.members
-            self.variants.check_clash(schema, self.info, seen)
+            self.variants.check_clash(self.info, seen)
         if self.doc:
             self.doc.check()
 
     # Check that the members of this type do not cause duplicate JSON members,
     # and update seen to track the members seen so far. Report any errors
     # on behalf of info, which is not necessarily self.info
-    def check_clash(self, schema, info, seen):
+    def check_clash(self, info, seen):
         assert not self.variants       # not implemented
         for m in self.members:
             m.check_clash(info, seen)
@@ -1324,12 +1324,12 @@ class QAPISchemaObjectTypeVariants(object):
                 assert isinstance(v.type, QAPISchemaObjectType)
                 v.type.check(schema)
 
-    def check_clash(self, schema, info, seen):
+    def check_clash(self, info, seen):
         for v in self.variants:
             # Reset seen map for each variant, since qapi names from one
             # branch do not affect another branch
             assert isinstance(v.type, QAPISchemaObjectType)
-            v.type.check_clash(schema, info, dict(seen))
+            v.type.check_clash(info, dict(seen))
 
 
 class QAPISchemaObjectTypeVariant(QAPISchemaObjectTypeMember):
Signature · 1 line
2.7.4
Reviewed-by on v1 45/47
#122 lore raw

Re: [Qemu-devel] [PATCH for-2.9 45/47] qapi: Drop unused .check_clash() parameter schema

Quoted 4 lines · Markus Armbruster
---
 scripts/qapi.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

I'm not sure now why the 'schema' parameter was introduced; looks like it was in commit b807a1e and unused there. I think at one point in my multitude of refactoring patches that I was using schema for a name lookup for nicer error reporting, but that idea fell by the wayside over several revisions, and the 'schema' parameter became unused without either of us realizing it.

At any rate, the cleanup is sane.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#123 lore raw

PATCH 46/47 qapi: Make pylint a bit happier

In reply to Markus Armbruster
---
 scripts/qapi-commands.py | 6 +++---
 scripts/qapi-visit.py    | 1 -
 scripts/qapi.py          | 8 ++++----
 3 files changed, 7 insertions(+), 8 deletions(-)
scripts/qapi-commands.py +3 -3
index 0c05449..1943de4 100644
@@ -13,7 +13,6 @@
 # See the COPYING file in the top-level directory.
 
 from qapi import *
-import re
 
 
 def gen_command_decl(name, arg_type, boxed, ret_type):
@@ -84,7 +83,8 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, QObject **ret_out,
 
 
 def gen_marshal_proto(name):
-    return 'void qmp_marshal_%s(QDict *args, QObject **ret, Error **errp)' % c_name(name)
+    return ('void qmp_marshal_%s(QDict *args, QObject **ret, Error **errp)'
+            % c_name(name))
 
 
 def gen_marshal_decl(name):
@@ -198,7 +198,7 @@ def gen_register_command(name, success_response):
         options = 'QCO_NO_SUCCESS_RESP'
 
     ret = mcgen('''
-    qmp_register_command(cmds, "%(name)s", 
+    qmp_register_command(cmds, "%(name)s",
                          qmp_marshal_%(c_name)s, %(opts)s);
 ''',
                 name=name, c_name=c_name(name),
scripts/qapi-visit.py +0 -1
index 3d3936e..5737aef 100644
@@ -13,7 +13,6 @@
 # See the COPYING file in the top-level directory.
 
 from qapi import *
-import re
 
 
 def gen_visit_decl(name, scalar=False):
scripts/qapi.py +4 -4
index 4102011..a4bf1ea 100644
@@ -11,13 +11,13 @@
 # This work is licensed under the terms of the GNU GPL, version 2.
 # See the COPYING file in the top-level directory.
 
-import re
-from ordereddict import OrderedDict
 import errno
 import getopt
 import os
-import sys
+import re
 import string
+import sys
+from ordereddict import OrderedDict
 
 builtin_types = {
     'str':      'QTYPE_QSTRING',
@@ -1582,7 +1582,7 @@ class QAPISchema(object):
         tag_member = None
         if isinstance(base, dict):
             base = (self._make_implicit_object_type(
-                    name, info, doc, 'base', self._make_members(base, info)))
+                name, info, doc, 'base', self._make_members(base, info)))
         if tag_name:
             variants = [self._make_variant(key, value)
                         for (key, value) in data.iteritems()]
Signature · 1 line
2.7.4
Reviewed-by on v1 46/47
#124 lore raw

Re: [Qemu-devel] [PATCH for-2.9 46/47] qapi: Make pylint a bit happier

Quoted 7 lines · Markus Armbruster
---
 scripts/qapi-commands.py | 6 +++---
 scripts/qapi-visit.py    | 1 -
 scripts/qapi.py          | 8 ++++----
 3 files changed, 7 insertions(+), 8 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#125 lore raw

PATCH 47/47 qapi: Fix a misleading parser error message

In reply to Markus Armbruster

When choking on a token where an expression is expected, we report 'Expected "{", "[" or string'. Close, but no cigar. Fix it to Expected '"{", "[", string, boolean or "null"'.

Missed in commit e53188a.

---
 scripts/qapi.py                           | 3 ++-
 tests/qapi-schema/trailing-comma-list.err | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
scripts/qapi.py +2 -1
index a4bf1ea..1dc33c9 100644
@@ -514,7 +514,8 @@ class QAPISchemaParser(object):
             expr = self.val
             self.accept()
         else:
-            raise QAPIParseError(self, 'Expected "{", "[" or string')
+            raise QAPIParseError(self, 'Expected "{", "[", string, '
+                                 'boolean or "null"')
         return expr
 
     def get_doc(self, info):
tests/qapi-schema/trailing-comma-list.err +1 -1
index 24c24b0..212e14a 100644
@@ -1 +1 @@
-tests/qapi-schema/trailing-comma-list.json:2:36: Expected "{", "[" or string
+tests/qapi-schema/trailing-comma-list.json:2:36: Expected "{", "[", string, boolean or "null"
Signature · 1 line
2.7.4
Reviewed-by on v1 47/47
#126 lore raw

Re: [Qemu-devel] [PATCH for-2.9 47/47] qapi: Fix a misleading parser error message

Quoted 5 lines · Markus Armbruster

When choking on a token where an expression is expected, we report 'Expected "{", "[" or string'. Close, but no cigar. Fix it to Expected '"{", "[", string, boolean or "null"'.

Missed in commit e53188a.

Will need adjustment again if we ever start parsing numbers to provide default values. Maybe we'll remember that time around :)

Quoted 6 lines
---
 scripts/qapi.py                           | 3 ++-
 tests/qapi-schema/trailing-comma-list.err | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#127 lore raw
In reply to Markus Armbruster

Hi

Quoted 120 lines · Markus Armbruster

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH 1/2.

Marc-André's work to merge qmp-commands.txt and qmp-events.txt into the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed, it also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

    Subject: [PATCH 0/2] qapi2texi: add type information
    Message-Id: <[email protected]>
    https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds type descriptions in a new formal language to the generated documentation. Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members syntax:

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +' prepended.

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar': type... ] }

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar': type... ]

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':
VncBasicInfo}

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server
''auth'' (optional)
authentication method used for the plain (non-websocket) VNC server

Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

Here's my counter-proposal: instead of inventing a formal language, fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand way. Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain (non-websocket) VNC server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Quoted 3 lines

Since: 1.3

I like both, to me they serve different purposes. I like to have a short overview / signature and then a more detailed documentation for each field.

Additionally, my series fixes a number of bugs and cleans up along the

Quoted 4 lines

way. In particular, it converts qapi2texi.py from parse trees to the visitor interface the other generators use.

Your series failed to apply in patchew, and I can't find the branch in your repo. Could you publish it?

Quoted 5 lines

Future generated documentation work includes eliding types that aren't visible in QMP (like introspection does), and making uses of type names links in HTML.

Yes, links would be really nice.

Thanks

Quoted 347 lines

Markus Armbruster (47):
qapi: Factor QAPISchemaParser._include() out of .__init__()
qapi: Make doc comments optional where we don't need them
qapi: Back out doc comments added just to please qapi.py docs/qapi-code-gen.txt: Drop confusing reference to 'gen'
qapi: Have each QAPI schema declare its returns white-list
qapi: Have each QAPI schema declare its name rule violations
qapi: Clean up build of generated documentation tests/qapi-schema: Cover empty union base
qapi: Fix to reject empty union base gracefully
qapi2texi: Fix up output around #optional
qapi: Avoid unwanted blank lines in QAPIDoc qapi/rocker: Fix up doc comment notes on optional members
qapi: Fix QAPISchemaEnumType.is_implicit() for 'QType'
qapi: Prepare for requiring more complete documentation
qapi: Conjure up QAPIDoc.ArgSection for undocumented members
qapi2texi: Convert to QAPISchemaVisitor
qapi: The #optional tag is redundant, drop
qapi: Use raw strings for regular expressions consistently
qapi: Prefer single-quoted strings more consistently
qapi2texi: Plainer enum value and member name formatting
qapi2texi: Present the table of members more clearly
qapi2texi: Explain enum value undocumentedness more clearly
qapi2texi: Don't hide undocumented members and arguments
qapi2texi: Implement boxed argument documentation
qapi2texi: Include member type in generated documentation
qapi2texi: Generate reference to base type members
qapi2texi: Generate documentation for variant members
qapi2texi: Generate descriptions for simple union tags
qapi2texi: Use category "Object" for all object types tests/qapi-schema: Improve doc / expression mismatch coverage
qapi: Fix detection of doc / expression mismatch
qapi: Move detection of doc / expression name mismatch
qapi: Improve error message on @NAME: in free-form doc
qapi: Move empty doc section checking to doc parser tests/qapi-schema: Rename doc-bad-args to doc-bad-command-arg tests/qapi-schema: Improve coverage of bogus member docs
qapi: Fix detection of bogus member documentation
qapi: Eliminate check_docs() and drop QAPIDoc.expr
qapi: Drop unused variable events
qapi: Simplify what gets stored in enum_types
qapi: Factor add_name() calls out of the meta conditional
qapi: enum_types is a list used like a dict, make it one
qapi: struct_types is a list used like a dict, make it one
qapi: union_types is a list used like a dict, make it one
qapi: Drop unused .check_clash() parameter schema
qapi: Make pylint a bit happier
qapi: Fix a misleading parser error message

 .gitignore                                         |  10 +-
 Makefile                                           |  27 +-
 docs/qapi-code-gen.txt                             |  81 +--
 docs/qemu-qmp-ref.texi                             |   2 +-
 docs/writing-qmp-commands.txt                      |   4 +-
 qapi-schema.json                                   | 403 ++++++-------
 qapi/block-core.json                               | 428 +++++++-------
 qapi/block.json                                    |   8 +-
 qapi/crypto.json                                   |  22 +-
 qapi/event.json                                    |  10 +-
 qapi/introspect.json                               |   6 +-
 qapi/rocker.json                                   |  88 +--
 qapi/trace.json                                    |   6 +-
 qga/qapi-schema.json                               |  55 +-
 rules.mak                                          |   2 +-
 scripts/qapi-commands.py                           |   6 +-
 scripts/qapi-event.py                              |   2 +-
 scripts/qapi-introspect.py                         |   4 +-
 scripts/qapi-types.py                              |   4 +-
 scripts/qapi-visit.py                              |   5 +-
 scripts/qapi.py                                    | 632
++++++++++-----------
 scripts/qapi2texi.py                               | 298 +++++-----
 tests/Makefile.include                             |   9 +-
 tests/qapi-schema/alternate-any.err                |   2 +-
 tests/qapi-schema/alternate-any.json               |   4 -
 tests/qapi-schema/alternate-array.err              |   2 +-
 tests/qapi-schema/alternate-array.json             |   7 -
 tests/qapi-schema/alternate-base.err               |   2 +-
 tests/qapi-schema/alternate-base.json              |   7 -
 tests/qapi-schema/alternate-clash.err              |   2 +-
 tests/qapi-schema/alternate-clash.json             |   4 -
 tests/qapi-schema/alternate-conflict-dict.err      |   2 +-
 tests/qapi-schema/alternate-conflict-dict.json     |  10 -
 tests/qapi-schema/alternate-conflict-string.err    |   2 +-
 tests/qapi-schema/alternate-conflict-string.json   |   7 -
 tests/qapi-schema/alternate-empty.err              |   2 +-
 tests/qapi-schema/alternate-empty.json             |   4 -
 tests/qapi-schema/alternate-nested.err             |   2 +-
 tests/qapi-schema/alternate-nested.json            |   7 -
 tests/qapi-schema/alternate-unknown.err            |   2 +-
 tests/qapi-schema/alternate-unknown.json           |   4 -
 tests/qapi-schema/args-alternate.err               |   2 +-
 tests/qapi-schema/args-alternate.json              |   8 -
 tests/qapi-schema/args-any.err                     |   2 +-
 tests/qapi-schema/args-any.json                    |   4 -
 tests/qapi-schema/args-array-empty.err             |   2 +-
 tests/qapi-schema/args-array-empty.json            |   4 -
 tests/qapi-schema/args-array-unknown.err           |   2 +-
 tests/qapi-schema/args-array-unknown.json          |   4 -
 tests/qapi-schema/args-bad-boxed.err               |   2 +-
 tests/qapi-schema/args-bad-boxed.json              |   4 -
 tests/qapi-schema/args-boxed-anon.err              |   2 +-
 tests/qapi-schema/args-boxed-anon.json             |   4 -
 tests/qapi-schema/args-boxed-empty.err             |   2 +-
 tests/qapi-schema/args-boxed-empty.json            |   8 -
 tests/qapi-schema/args-boxed-string.err            |   2 +-
 tests/qapi-schema/args-boxed-string.json           |   4 -
 tests/qapi-schema/args-int.err                     |   2 +-
 tests/qapi-schema/args-int.json                    |   4 -
 tests/qapi-schema/args-invalid.err                 |   2 +-
 tests/qapi-schema/args-invalid.json                |   3 -
 tests/qapi-schema/args-member-array-bad.err        |   2 +-
 tests/qapi-schema/args-member-array-bad.json       |   4 -
 tests/qapi-schema/args-member-case.err             |   2 +-
 tests/qapi-schema/args-member-case.json            |   4 -
 tests/qapi-schema/args-member-unknown.err          |   2 +-
 tests/qapi-schema/args-member-unknown.json         |   4 -
 tests/qapi-schema/args-name-clash.err              |   2 +-
 tests/qapi-schema/args-name-clash.json             |   4 -
 tests/qapi-schema/args-union.err                   |   2 +-
 tests/qapi-schema/args-union.json                  |   7 -
 tests/qapi-schema/args-unknown.err                 |   2 +-
 tests/qapi-schema/args-unknown.json                |   4 -
 tests/qapi-schema/bad-base.err                     |   2 +-
 tests/qapi-schema/bad-base.json                    |   7 -
 tests/qapi-schema/bad-data.err                     |   2 +-
 tests/qapi-schema/bad-data.json                    |   4 -
 tests/qapi-schema/bad-ident.err                    |   2 +-
 tests/qapi-schema/bad-ident.json                   |   4 -
 tests/qapi-schema/bad-type-bool.err                |   2 +-
 tests/qapi-schema/bad-type-bool.json               |   4 -
 tests/qapi-schema/bad-type-dict.err                |   2 +-
 tests/qapi-schema/bad-type-dict.json               |   4 -
 tests/qapi-schema/base-cycle-direct.err            |   2 +-
 tests/qapi-schema/base-cycle-direct.json           |   4 -
 tests/qapi-schema/base-cycle-indirect.err          |   2 +-
 tests/qapi-schema/base-cycle-indirect.json         |   7 -
 tests/qapi-schema/command-int.err                  |   2 +-
 tests/qapi-schema/command-int.json                 |   4 -
 tests/qapi-schema/comments.json                    |   4 -
 tests/qapi-schema/comments.out                     |   1 -
 tests/qapi-schema/doc-bad-alternate-member.err     |   1 +
 ...optional.exit => doc-bad-alternate-member.exit} |   0
 tests/qapi-schema/doc-bad-alternate-member.json    |   9 +
 ...c-optional.out => doc-bad-alternate-member.out} |   0
 tests/qapi-schema/doc-bad-args.err                 |   1 -
 tests/qapi-schema/doc-bad-command-arg.err          |   1 +
 ...{doc-bad-args.exit => doc-bad-command-arg.exit} |   0
 ...{doc-bad-args.json => doc-bad-command-arg.json} |   0
 .../{doc-bad-args.out => doc-bad-command-arg.out}  |   0
 tests/qapi-schema/doc-bad-expr.err                 |   1 +
 tests/qapi-schema/doc-bad-expr.exit                |   1 +
 tests/qapi-schema/doc-bad-expr.json                |   7 +
 tests/qapi-schema/doc-bad-expr.out                 |   0
 tests/qapi-schema/doc-bad-symbol.err               |   2 +-
 tests/qapi-schema/doc-bad-union-member.err         |   1 +
 tests/qapi-schema/doc-bad-union-member.exit        |   1 +
 tests/qapi-schema/doc-bad-union-member.json        |  19 +
 tests/qapi-schema/doc-bad-union-member.out         |   0
 tests/qapi-schema/doc-empty-section.err            |   2 +-
 tests/qapi-schema/doc-invalid-section.err          |   2 +-
 tests/qapi-schema/doc-missing-expr.err             |   2 +-
 tests/qapi-schema/doc-missing.err                  |   1 +
 tests/qapi-schema/doc-missing.exit                 |   1 +
 tests/qapi-schema/doc-missing.json                 |   5 +
 tests/qapi-schema/doc-missing.out                  |   0
 tests/qapi-schema/doc-no-symbol.err                |   1 +
 tests/qapi-schema/doc-no-symbol.exit               |   1 +
 tests/qapi-schema/doc-no-symbol.json               |   6 +
 tests/qapi-schema/doc-no-symbol.out                |   0
 tests/qapi-schema/doc-optional.err                 |   1 -
 tests/qapi-schema/doc-optional.json                |   7 -
 tests/qapi-schema/double-type.err                  |   2 +-
 tests/qapi-schema/double-type.json                 |   4 -
 tests/qapi-schema/enum-bad-name.err                |   2 +-
 tests/qapi-schema/enum-bad-name.json               |   4 -
 tests/qapi-schema/enum-bad-prefix.err              |   2 +-
 tests/qapi-schema/enum-bad-prefix.json             |   4 -
 tests/qapi-schema/enum-clash-member.err            |   2 +-
 tests/qapi-schema/enum-clash-member.json           |   4 -
 tests/qapi-schema/enum-dict-member.err             |   2 +-
 tests/qapi-schema/enum-dict-member.json            |   4 -
 tests/qapi-schema/enum-member-case.err             |   2 +-
 tests/qapi-schema/enum-member-case.json            |   8 +-
 tests/qapi-schema/enum-missing-data.err            |   2 +-
 tests/qapi-schema/enum-missing-data.json           |   4 -
 tests/qapi-schema/enum-wrong-data.err              |   2 +-
 tests/qapi-schema/enum-wrong-data.json             |   4 -
 tests/qapi-schema/event-boxed-empty.err            |   2 +-
 tests/qapi-schema/event-boxed-empty.json           |   4 -
 tests/qapi-schema/event-case.json                  |   4 -
 tests/qapi-schema/event-case.out                   |   1 -
 tests/qapi-schema/event-nest-struct.err            |   2 +-
 tests/qapi-schema/event-nest-struct.json           |   4 -
 tests/qapi-schema/flat-union-array-branch.err      |   2 +-
 tests/qapi-schema/flat-union-array-branch.json     |  12 -
 tests/qapi-schema/flat-union-bad-base.err          |   2 +-
 tests/qapi-schema/flat-union-bad-base.json         |  13 -
 tests/qapi-schema/flat-union-bad-discriminator.err |   2 +-
 .../qapi-schema/flat-union-bad-discriminator.json  |  16 -
 tests/qapi-schema/flat-union-base-any.err          |   2 +-
 tests/qapi-schema/flat-union-base-any.json         |  13 -
 tests/qapi-schema/flat-union-base-union.err        |   2 +-
 tests/qapi-schema/flat-union-base-union.json       |  16 -
 tests/qapi-schema/flat-union-clash-member.err      |   2 +-
 tests/qapi-schema/flat-union-clash-member.json     |  16 -
 tests/qapi-schema/flat-union-empty.err             |   2 +-
 tests/qapi-schema/flat-union-empty.json            |  10 -
 tests/qapi-schema/flat-union-incomplete-branch.err |   2 +-
 .../qapi-schema/flat-union-incomplete-branch.json  |  10 -
 tests/qapi-schema/flat-union-inline.err            |   2 +-
 tests/qapi-schema/flat-union-inline.json           |  10 -
 tests/qapi-schema/flat-union-int-branch.err        |   2 +-
 tests/qapi-schema/flat-union-int-branch.json       |  13 -
 .../qapi-schema/flat-union-invalid-branch-key.err  |   2 +-
 .../qapi-schema/flat-union-invalid-branch-key.json |  15 -
 .../flat-union-invalid-discriminator.err           |   2 +-
 .../flat-union-invalid-discriminator.json          |  15 -
 tests/qapi-schema/flat-union-no-base.err           |   2 +-
 tests/qapi-schema/flat-union-no-base.json          |  13 -
 .../flat-union-optional-discriminator.err          |   2 +-
 .../flat-union-optional-discriminator.json         |  13 -
 .../flat-union-string-discriminator.err            |   2 +-
 .../flat-union-string-discriminator.json           |  15 -
 tests/qapi-schema/ident-with-escape.json           |   4 -
 tests/qapi-schema/ident-with-escape.out            |   1 -
 tests/qapi-schema/include-relpath-sub.json         |   3 -
 tests/qapi-schema/include-relpath.out              |   1 -
 tests/qapi-schema/include-repetition.out           |   1 -
 tests/qapi-schema/include-simple-sub.json          |   3 -
 tests/qapi-schema/include-simple.out               |   1 -
 tests/qapi-schema/indented-expr.json               |   6 -
 tests/qapi-schema/indented-expr.out                |   2 -
 tests/qapi-schema/missing-type.err                 |   2 +-
 tests/qapi-schema/missing-type.json                |   4 -
 tests/qapi-schema/nested-struct-data.err           |   2 +-
 tests/qapi-schema/nested-struct-data.json          |   4 -
 tests/qapi-schema/qapi-schema-test.json            | 218 +------
 tests/qapi-schema/qapi-schema-test.out             | 130 -----
 tests/qapi-schema/redefined-builtin.err            |   2 +-
 tests/qapi-schema/redefined-builtin.json           |   4 -
 tests/qapi-schema/redefined-command.err            |   2 +-
 tests/qapi-schema/redefined-command.json           |   7 -
 tests/qapi-schema/redefined-event.err              |   2 +-
 tests/qapi-schema/redefined-event.json             |   7 -
 tests/qapi-schema/redefined-type.err               |   2 +-
 tests/qapi-schema/redefined-type.json              |   7 -
 tests/qapi-schema/reserved-command-q.err           |   2 +-
 tests/qapi-schema/reserved-command-q.json          |   7 -
 tests/qapi-schema/reserved-enum-q.err              |   2 +-
 tests/qapi-schema/reserved-enum-q.json             |   4 -
 tests/qapi-schema/reserved-member-has.err          |   2 +-
 tests/qapi-schema/reserved-member-has.json         |   4 -
 tests/qapi-schema/reserved-member-q.err            |   2 +-
 tests/qapi-schema/reserved-member-q.json           |   4 -
 tests/qapi-schema/reserved-member-u.err            |   2 +-
 tests/qapi-schema/reserved-member-u.json           |   4 -
 tests/qapi-schema/reserved-member-underscore.err   |   2 +-
 tests/qapi-schema/reserved-member-underscore.json  |   4 -
 tests/qapi-schema/reserved-type-kind.err           |   2 +-
 tests/qapi-schema/reserved-type-kind.json          |   4 -
 tests/qapi-schema/reserved-type-list.err           |   2 +-
 tests/qapi-schema/reserved-type-list.json          |   4 -
 tests/qapi-schema/returns-alternate.err            |   2 +-
 tests/qapi-schema/returns-alternate.json           |   7 -
 tests/qapi-schema/returns-array-bad.err            |   2 +-
 tests/qapi-schema/returns-array-bad.json           |   4 -
 tests/qapi-schema/returns-dict.err                 |   2 +-
 tests/qapi-schema/returns-dict.json                |   4 -
 tests/qapi-schema/returns-unknown.err              |   2 +-
 tests/qapi-schema/returns-unknown.json             |   4 -
 tests/qapi-schema/returns-whitelist.err            |   2 +-
 tests/qapi-schema/returns-whitelist.json           |  18 +-
 tests/qapi-schema/struct-base-clash-deep.err       |   2 +-
 tests/qapi-schema/struct-base-clash-deep.json      |  10 -
 tests/qapi-schema/struct-base-clash.err            |   2 +-
 tests/qapi-schema/struct-base-clash.json           |   7 -
 tests/qapi-schema/struct-data-invalid.err          |   2 +-
 tests/qapi-schema/struct-data-invalid.json         |   3 -
 tests/qapi-schema/struct-member-invalid.err        |   2 +-
 tests/qapi-schema/struct-member-invalid.json       |   3 -
 tests/qapi-schema/test-qapi.py                     |  14 -
 tests/qapi-schema/trailing-comma-list.err          |   2 +-
 tests/qapi-schema/type-bypass-bad-gen.err          |   2 +-
 tests/qapi-schema/type-bypass-bad-gen.json         |   4 -
 tests/qapi-schema/unicode-str.err                  |   2 +-
 tests/qapi-schema/unicode-str.json                 |   4 -
 tests/qapi-schema/union-base-empty.err             |   1 +
 tests/qapi-schema/union-base-empty.exit            |   1 +
 tests/qapi-schema/union-base-empty.json            |   9 +
 tests/qapi-schema/union-base-empty.out             |   0
 tests/qapi-schema/union-base-no-discriminator.err  |   2 +-
 tests/qapi-schema/union-base-no-discriminator.json |  12 -
 tests/qapi-schema/union-branch-case.err            |   2 +-
 tests/qapi-schema/union-branch-case.json           |   4 -
 tests/qapi-schema/union-clash-branches.err         |   2 +-
 tests/qapi-schema/union-clash-branches.json        |   4 -
 tests/qapi-schema/union-empty.err                  |   2 +-
 tests/qapi-schema/union-empty.json                 |   4 -
 tests/qapi-schema/union-invalid-base.err           |   2 +-
 tests/qapi-schema/union-invalid-base.json          |  10 -
 tests/qapi-schema/union-optional-branch.err        |   2 +-
 tests/qapi-schema/union-optional-branch.json       |   4 -
 tests/qapi-schema/union-unknown.err                |   2 +-
 tests/qapi-schema/union-unknown.json               |   4 -
 tests/qapi-schema/unknown-escape.err               |   2 +-
 tests/qapi-schema/unknown-escape.json              |   4 -
 tests/qapi-schema/unknown-expr-key.err             |   2 +-
 tests/qapi-schema/unknown-expr-key.json            |   4 -
 259 files changed, 1263 insertions(+), 2109 deletions(-)
 create mode 100644 tests/qapi-schema/doc-bad-alternate-member.err
 rename tests/qapi-schema/{doc-optional.exit =>
doc-bad-alternate-member.exit} (100%)
 create mode 100644 tests/qapi-schema/doc-bad-alternate-member.json
 rename tests/qapi-schema/{doc-optional.out =>
doc-bad-alternate-member.out} (100%)
 delete mode 100644 tests/qapi-schema/doc-bad-args.err
 create mode 100644 tests/qapi-schema/doc-bad-command-arg.err
 rename tests/qapi-schema/{doc-bad-args.exit => doc-bad-command-arg.exit}
(100%)
 rename tests/qapi-schema/{doc-bad-args.json => doc-bad-command-arg.json}
(100%)
 rename tests/qapi-schema/{doc-bad-args.out => doc-bad-command-arg.out}
(100%)
 create mode 100644 tests/qapi-schema/doc-bad-expr.err
 create mode 100644 tests/qapi-schema/doc-bad-expr.exit
 create mode 100644 tests/qapi-schema/doc-bad-expr.json
 create mode 100644 tests/qapi-schema/doc-bad-expr.out
 create mode 100644 tests/qapi-schema/doc-bad-union-member.err
 create mode 100644 tests/qapi-schema/doc-bad-union-member.exit
 create mode 100644 tests/qapi-schema/doc-bad-union-member.json
 create mode 100644 tests/qapi-schema/doc-bad-union-member.out
 create mode 100644 tests/qapi-schema/doc-missing.err
 create mode 100644 tests/qapi-schema/doc-missing.exit
 create mode 100644 tests/qapi-schema/doc-missing.json
 create mode 100644 tests/qapi-schema/doc-missing.out
 create mode 100644 tests/qapi-schema/doc-no-symbol.err
 create mode 100644 tests/qapi-schema/doc-no-symbol.exit
 create mode 100644 tests/qapi-schema/doc-no-symbol.json
 create mode 100644 tests/qapi-schema/doc-no-symbol.out
 delete mode 100644 tests/qapi-schema/doc-optional.err
 delete mode 100644 tests/qapi-schema/doc-optional.json
 create mode 100644 tests/qapi-schema/union-base-empty.err
 create mode 100644 tests/qapi-schema/union-base-empty.exit
 create mode 100644 tests/qapi-schema/union-base-empty.json
 create mode 100644 tests/qapi-schema/union-base-empty.out
Quoted 5 lines

--
2.7.4

--

Marc-André Lureau

#128 lore raw
Quoted 125 lines · Marc-André Lureau

Hi

Quoted 120 lines · Markus Armbruster

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH 1/2.

Marc-André's work to merge qmp-commands.txt and qmp-events.txt into the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed, it also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

    Subject: [PATCH 0/2] qapi2texi: add type information
    Message-Id: <[email protected]>
    https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds type descriptions in a new formal language to the generated documentation. Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members syntax:

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +' prepended.

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar': type... ] }

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar': type... ]

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':
VncBasicInfo}

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server
''auth'' (optional)
authentication method used for the plain (non-websocket) VNC server

Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

Here's my counter-proposal: instead of inventing a formal language, fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand way. Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain (non-websocket) VNC server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Quoted 5 lines
Quoted 3 lines
     Since: 1.3

I like both, to me they serve different purposes. I like to have a short overview / signature and then a more detailed documentation for each field.

I sympathize with the argument. Unfortunately, the "short" signatures are anything but for real-world QAPI:

-- Flat Union: BlockdevOptions {'driver': BlockdevDriver, ('node-name':
str), ('discard': BlockdevDiscardOptions), ('cache':
BlockdevCacheOptions), ('read-only': bool), ('detect-zeroes':
BlockdevDetectZeroesOptions)} + 'driver' = ['archipelago':
BlockdevOptionsArchipelago, 'blkdebug':
BlockdevOptionsBlkdebug, 'blkverify':
BlockdevOptionsBlkverify, 'bochs':
BlockdevOptionsGenericFormat, 'cloop':
BlockdevOptionsGenericFormat, 'dmg':
BlockdevOptionsGenericFormat, 'file': BlockdevOptionsFile, 'ftp': BlockdevOptionsCurl, 'ftps': BlockdevOptionsCurl, 'gluster': BlockdevOptionsGluster, 'host_cdrom':
BlockdevOptionsFile, 'host_device': BlockdevOptionsFile, 'http': BlockdevOptionsCurl, 'https': BlockdevOptionsCurl, 'iscsi': BlockdevOptionsIscsi, 'luks': BlockdevOptionsLUKS, 'nbd': BlockdevOptionsNbd, 'nfs': BlockdevOptionsNfs, 'null-aio': BlockdevOptionsNull, 'null-co':
BlockdevOptionsNull, 'parallels':
BlockdevOptionsGenericFormat, 'qcow2': BlockdevOptionsQcow2, 'qcow': BlockdevOptionsGenericCOWFormat, 'qed':
BlockdevOptionsGenericCOWFormat, 'quorum':
BlockdevOptionsQuorum, 'raw': BlockdevOptionsRaw, 'rbd':
BlockdevOptionsRbd, 'replication': BlockdevOptionsReplication, 'sheepdog': BlockdevOptionsSheepdog, 'ssh':
BlockdevOptionsSsh, 'vdi': BlockdevOptionsGenericFormat, 'vhdx': BlockdevOptionsGenericFormat, 'vmdk':
BlockdevOptionsGenericCOWFormat, 'vpc':
BlockdevOptionsGenericFormat, 'vvfat': BlockdevOptionsVVFAT]

Options for creating a block device. Many options are available for all block devices, independent of the block driver:
''driver''
block driver name
''node-name'' (optional)
the node name of the new node (Since 2.0). This option is required on the top level of blockdev-add.
''discard'' (optional)
discard-related options (default: ignore)
''cache'' (optional)
cache-related options
''read-only'' (optional)
whether the block device should be read-only (default: false)
''detect-zeroes'' (optional)
detect and optimize zero writes (Since 2.1) (default: off)
Remaining options are determined by the block driver.

Since: 1.7

Quoted 7 lines
Quoted 5 lines

Additionally, my series fixes a number of bugs and cleans up along the way. In particular, it converts qapi2texi.py from parse trees to the visitor interface the other generators use.

Your series failed to apply in patchew, and I can't find the branch in your repo. Could you publish it?

Done: branch qapi-doc at http://repo.or.cz/w/qemu/armbru.git

Quoted 6 lines
Quoted 5 lines

Future generated documentation work includes eliding types that aren't visible in QMP (like introspection does), and making uses of type names links in HTML.

Yes, links would be really nice.

Your work brought them into reach, let's grab them :)

#129 lore raw

Hi

Quoted 130 lines · Markus Armbruster
Quoted 128 lines · Marc-André Lureau

Hi

Quoted 123 lines · Markus Armbruster

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH 1/2.

Marc-André's work to merge qmp-commands.txt and qmp-events.txt into the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed, it also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

    Subject: [PATCH 0/2] qapi2texi: add type information
    Message-Id: <[email protected]>
    https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds type descriptions in a new formal language to the generated documentation. Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members syntax:

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +' prepended.

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar': type... ] }

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar': type... ]

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':
VncBasicInfo}

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server
''auth'' (optional)
authentication method used for the plain (non-websocket) VNC server

Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

Here's my counter-proposal: instead of inventing a formal language, fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand way. Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain (non-websocket) VNC server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Since: 1.3

Quoted 7 lines
Quoted 2 lines

I like both, to me they serve different purposes. I like to have a short overview / signature and then a more detailed documentation for each

field.

I sympathize with the argument. Unfortunately, the "short" signatures are anything but for real-world QAPI:

That's a worse case, a regular case is more readable. And it is still useful anyway since the common members would be listed first.

Quoted 53 lines

-- Flat Union: BlockdevOptions {'driver': BlockdevDriver, ('node-name':
str), ('discard': BlockdevDiscardOptions), ('cache':
BlockdevCacheOptions), ('read-only': bool), ('detect-zeroes':
BlockdevDetectZeroesOptions)} + 'driver' = ['archipelago':
BlockdevOptionsArchipelago, 'blkdebug':
BlockdevOptionsBlkdebug, 'blkverify':
BlockdevOptionsBlkverify, 'bochs':
BlockdevOptionsGenericFormat, 'cloop':
BlockdevOptionsGenericFormat, 'dmg':
BlockdevOptionsGenericFormat, 'file': BlockdevOptionsFile, 'ftp': BlockdevOptionsCurl, 'ftps': BlockdevOptionsCurl, 'gluster': BlockdevOptionsGluster, 'host_cdrom':
BlockdevOptionsFile, 'host_device': BlockdevOptionsFile, 'http': BlockdevOptionsCurl, 'https': BlockdevOptionsCurl, 'iscsi': BlockdevOptionsIscsi, 'luks': BlockdevOptionsLUKS, 'nbd': BlockdevOptionsNbd, 'nfs': BlockdevOptionsNfs, 'null-aio': BlockdevOptionsNull, 'null-co':
BlockdevOptionsNull, 'parallels':
BlockdevOptionsGenericFormat, 'qcow2': BlockdevOptionsQcow2, 'qcow': BlockdevOptionsGenericCOWFormat, 'qed':
BlockdevOptionsGenericCOWFormat, 'quorum':
BlockdevOptionsQuorum, 'raw': BlockdevOptionsRaw, 'rbd':
BlockdevOptionsRbd, 'replication': BlockdevOptionsReplication, 'sheepdog': BlockdevOptionsSheepdog, 'ssh':
BlockdevOptionsSsh, 'vdi': BlockdevOptionsGenericFormat, 'vhdx': BlockdevOptionsGenericFormat, 'vmdk':
BlockdevOptionsGenericCOWFormat, 'vpc':
BlockdevOptionsGenericFormat, 'vvfat': BlockdevOptionsVVFAT]

Options for creating a block device. Many options are available for all block devices, independent of the block driver:
''driver''
block driver name
''node-name'' (optional)
the node name of the new node (Since 2.0). This option is required on the top level of blockdev-add.
''discard'' (optional)
discard-related options (default: ignore)
''cache'' (optional)
cache-related options
''read-only'' (optional)
whether the block device should be read-only (default: false)
''detect-zeroes'' (optional)
detect and optimize zero writes (Since 2.1) (default: off)
Remaining options are determined by the block driver.

Since: 1.7

Quoted 5 lines
Quoted 5 lines

Additionally, my series fixes a number of bugs and cleans up along the way. In particular, it converts qapi2texi.py from parse trees to the visitor interface the other generators use.

Quoted 7 lines
Quoted 1 line

Your series failed to apply in patchew, and I can't find the branch in

your

Quoted 1 line

repo. Could you publish it?

Done: branch qapi-doc at http://repo.or.cz/w/qemu/armbru.git

thanks

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

Future generated documentation work includes eliding types that aren't visible in QMP (like introspection does), and making uses of type names links in HTML.

Yes, links would be really nice.

Your work brought them into reach, let's grab them :)

Signature · 1 line
Marc-André Lureau
#130 lore raw
Quoted 136 lines · Marc-André Lureau

Hi

Quoted 132 lines · Markus Armbruster
Quoted 130 lines · Marc-André Lureau

Hi

Quoted 120 lines · Markus Armbruster

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH 1/2.

Marc-André's work to merge qmp-commands.txt and qmp-events.txt into the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed, it also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

    Subject: [PATCH 0/2] qapi2texi: add type information
    Message-Id: <[email protected]>
    https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds type descriptions in a new formal language to the generated documentation. Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members syntax:

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +' prepended.

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar': type... ] }

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar': type... ]

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':
VncBasicInfo}

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server
''auth'' (optional)
authentication method used for the plain (non-websocket) VNC server

Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

Here's my counter-proposal: instead of inventing a formal language, fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand way. Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain (non-websocket) VNC server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Quoted 3 lines

Since: 1.3

I like both, to me they serve different purposes. I like to have a short overview / signature and then a more detailed documentation for each

Quoted 7 lines
Quoted 5 lines

field.

I sympathize with the argument. Unfortunately, the "short" signatures are anything but for real-world QAPI:

That's a worse case, a regular case is more readable.

There are readable cases, but there are plenty of cases that plainly aren't.

102 out of 472 signatures don't count because they're empty.

Roughly half the non-empty signatures fit on a single line. That's short.

A bit under a third take two lines. I guess that's still short enough.

More than one in six signatures is three lines or more.

Quoted 2 lines

And it is still
useful anyway since the common members would be listed first.

Whatever comes first in signatures comes first in the table of members, too. The names are easier to spot there, because they're all on the left.

Compare

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

to

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Since: 1.3

In my opinion, the three lines of signature add nothing but noise to the six lines of member table.

#131 lore raw

Hi

Quoted 203 lines · Markus Armbruster
Quoted 3 lines · Marc-André Lureau

Hi

On Mon, Mar 13, 2017 at 4:14 PM Markus Armbruster <[email protected]>

Quoted 10 lines · wrote:
Quoted 10 lines
Quoted 7 lines · Marc-André Lureau

Hi

On Mon, Mar 13, 2017 at 10:23 AM Markus Armbruster <[email protected]

Quoted 1 line · wrote:

I'm proposing this is 2.9 because it fixes a documentation

regression.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH 1/2.

Marc-André's work to merge qmp-commands.txt and qmp-events.txt into the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed, it also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Subject: [PATCH 0/2] qapi2texi: add type information
Message-Id: <[email protected]>

https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds type descriptions in a new formal language to the generated documentation. Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members syntax:

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +' prepended.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar': type...

] }

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar': type... ]

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':

          VncBasicInfo}
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes

place,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server ''auth'' (optional)
authentication method used for the plain (non-websocket)

VNC

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
          server

     Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' =

['inet':

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named

file

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
     descriptor

     Since: 1.3

Here's my counter-proposal: instead of inventing a formal language, fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand way. Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes

place,

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain (non-websocket)

VNC

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a named

file

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
     Since: 1.3

I like both, to me they serve different purposes. I like to have a

short

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

overview / signature and then a more detailed documentation for each

field.

I sympathize with the argument. Unfortunately, the "short" signatures are anything but for real-world QAPI:

That's a worse case, a regular case is more readable.

There are readable cases, but there are plenty of cases that plainly aren't.

102 out of 472 signatures don't count because they're empty.

Roughly half the non-empty signatures fit on a single line. That's short.

A bit under a third take two lines. I guess that's still short enough.

More than one in six signatures is three lines or more.

Quoted 2 lines

And it is still
useful anyway since the common members would be listed first.

Whatever comes first in signatures comes first in the table of members, too. The names are easier to spot there, because they're all on the left.

Compare

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

to

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Quoted 5 lines

Since: 1.3

In my opinion, the three lines of signature add nothing but noise to the six lines of member table.

It is more natural and faster to read to me for commands and events for example. The verbose description is mixing description and sometime even providing redundant information (ex: keys: array of KeyValue, An array of 'KeyValue' elements...), slowing reading even more. Often you don't need to read the documentation / description, you want to quickly check the return type, and remind you the arguments.

struct/objects are more commonly declared with a line per member, so it doesn't bother me as much.

I would appreciate if can have the declarative form for commands and events at least. Other types are usually more complex or long, so that may clear your concerns for the long declarations.

Signature · 1 line
Marc-André Lureau
#132 lore raw
Quoted 197 lines · Marc-André Lureau

Hi

Quoted 193 lines · Markus Armbruster
Quoted 137 lines · Marc-André Lureau

Hi

Quoted 133 lines · Markus Armbruster
Quoted 131 lines · Marc-André Lureau

Hi

On Mon, Mar 13, 2017 at 10:23 AM Markus Armbruster <[email protected]

Quoted 120 lines · wrote:

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH 1/2.

Marc-André's work to merge qmp-commands.txt and qmp-events.txt into the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed, it also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

    Subject: [PATCH 0/2] qapi2texi: add type information
    Message-Id: <[email protected]>
    https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds type descriptions in a new formal language to the generated documentation. Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members syntax:

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +' prepended.

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar': type... ] }

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar': type... ]

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':
VncBasicInfo}

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server
''auth'' (optional)
authentication method used for the plain (non-websocket) VNC server

Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

Here's my counter-proposal: instead of inventing a formal language, fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand way. Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain (non-websocket) VNC server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Quoted 3 lines

Since: 1.3

I like both, to me they serve different purposes. I like to have a short overview / signature and then a more detailed documentation for each

Quoted 7 lines
Quoted 5 lines

field.

I sympathize with the argument. Unfortunately, the "short" signatures are anything but for real-world QAPI:

That's a worse case, a regular case is more readable.

There are readable cases, but there are plenty of cases that plainly aren't.

102 out of 472 signatures don't count because they're empty.

Roughly half the non-empty signatures fit on a single line. That's short.

A bit under a third take two lines. I guess that's still short enough.

More than one in six signatures is three lines or more.

Quoted 2 lines

And it is still
useful anyway since the common members would be listed first.

Whatever comes first in signatures comes first in the table of members, too. The names are easier to spot there, because they're all on the left.

Compare

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

to

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Since: 1.3

Quoted 8 lines
Quoted 3 lines

In my opinion, the three lines of signature add nothing but noise to the six lines of member table.

It is more natural and faster to read to me for commands and events for example. The verbose description is mixing description and sometime even providing redundant information (ex: keys: array of KeyValue, An array of 'KeyValue' elements...), slowing reading even more.

Doc comments that merely restate the type should be cleaned up.

Quoted 3 lines

Often you don't need to
read the documentation / description, you want to quickly check the return type, and remind you the arguments.

Point taken.

A formal description of unbounded (and often excessive) length can't serve that purpose, though.

A sufficiently condensed summaries just might. Perhaps names only, no types. Certainly no more than a few.

For instance, having

-- Command: block-job-set-speed device speed

instead of just

-- Command: block-job-set-speed

feels okay; the additional two words are technically redundant, but they might occasionally serve someone as a reminder, and they're not distracting.

But I feel

-- Command: blockdev-mirror [job-id] device target [replaces] sync
[speed] [granularity] [buf-size] [on-source-error] [on-target-error] [filter-node-name]

is pushing it.

So this begs the question which ones to omit when there are more than a few. I'm afraid asking a stupid computer program to pick out "important" arguments is asking for too much. For high-quality summaries, we'd have to pick ourselves.

Moreover, what to do for truly complex commands like blockdev-add? Simply omitting all variant members is one option:

-- Command: blockdev-add driver [node-name] [discard] [cache]

          [read-only] [detect-zeroes] ...

But what may work for blockdev-add need not work for other complex commands.

Quoted 6 lines

struct/objects are more commonly declared with a line per member, so it doesn't bother me as much.

I would appreciate if can have the declarative form for commands and events at least. Other types are usually more complex or long, so that may clear your concerns for the long declarations.

The worst offenders are actually commands such as blockdev-add and block_set_io_throttle, unless we give up on the "reminder" mission for them and merely add a reference to their (named) argument type.

#133 lore raw

Hi

Quoted 232 lines · Markus Armbruster
Quoted 3 lines · Marc-André Lureau

Hi

On Mon, Mar 13, 2017 at 5:12 PM Markus Armbruster <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 3 lines · Marc-André Lureau

Hi

On Mon, Mar 13, 2017 at 4:14 PM Markus Armbruster <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines · Marc-André Lureau

Hi

On Mon, Mar 13, 2017 at 10:23 AM Markus Armbruster <

[email protected]

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line · wrote:

I'm proposing this is 2.9 because it fixes a documentation

regression.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

It affects only documentation; generated C code is unchanged

except

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH

1/2.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Marc-André's work to merge qmp-commands.txt and qmp-events.txt

into

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed,

it

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

Subject: [PATCH 0/2] qapi2texi: add type information
Message-Id: <

[email protected]>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds

type

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

descriptions in a new formal language to the generated

documentation.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members

syntax:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +'

prepended.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar':

type... ] }

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar':

type... ]

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':

          VncBasicInfo}
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes

place,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server ''auth'' (optional)
authentication method used for the plain

(non-websocket) VNC

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
          server

     Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' =

['inet':

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a

named file

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
     descriptor

     Since: 1.3

Here's my counter-proposal: instead of inventing a formal

language,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand

way.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes

place,

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain

(non-websocket) VNC

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a

named file

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
     Since: 1.3

I like both, to me they serve different purposes. I like to have a

short

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

overview / signature and then a more detailed documentation for

each

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

field.

I sympathize with the argument. Unfortunately, the "short"

signatures

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 2 lines

are anything but for real-world QAPI:

That's a worse case, a regular case is more readable.

There are readable cases, but there are plenty of cases that plainly aren't.

102 out of 472 signatures don't count because they're empty.

Roughly half the non-empty signatures fit on a single line. That's

short.

Quoted 44 lines
Quoted 43 lines

A bit under a third take two lines. I guess that's still short enough.

More than one in six signatures is three lines or more.

Quoted 2 lines

And it is still
useful anyway since the common members would be listed first.

Whatever comes first in signatures comes first in the table of members, too. The names are easier to spot there, because they're all on the left.

Compare

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

to

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Since: 1.3

In my opinion, the three lines of signature add nothing but noise to the six lines of member table.

Quoted 9 lines
Quoted 3 lines

It is more natural and faster to read to me for commands and events for example. The verbose description is mixing description and sometime even providing redundant information (ex: keys: array of KeyValue, An array

of

Quoted 1 line

'KeyValue' elements...), slowing reading even more.

Doc comments that merely restate the type should be cleaned up.

It's not just that, it's also the verbosity of the description that clutters the information you need.

Quoted 11 lines

Often you don't need
to

Quoted 1 line

read the documentation / description, you want to quickly check the

return

Quoted 1 line

type, and remind you the arguments.

Point taken.

A formal description of unbounded (and often excessive) length can't serve that purpose, though.

In which case we are screwed anyway in any form

Quoted 8 lines

A sufficiently condensed summaries just might. Perhaps names only, no types. Certainly no more than a few.

For instance, having

-- Command: block-job-set-speed device speed

Quoted 8 lines

instead of just

-- Command: block-job-set-speed

feels okay; the additional two words are technically redundant, but they might occasionally serve someone as a reminder, and they're not distracting.

In my generated pdf, using my type proposal (I use it daily), I have:

block-job-set-speed (’device’: str , ’speed’: int )

Which I find useful. I am going to lack it, and in fact I'll probably maintain my own version of the document if we don't have that declaration form. At least for a while, until I get used to your type version eventually).

It feels like bikeshedding at this point, and you are the maintainer, so I'll probably stop arguing, but it doesn't mean I am satisfied with your proposal.

Quoted 34 lines

But I feel

-- Command: blockdev-mirror [job-id] device target [replaces] sync
[speed] [granularity] [buf-size] [on-source-error] [on-target-error] [filter-node-name]

is pushing it.

So this begs the question which ones to omit when there are more than a few. I'm afraid asking a stupid computer program to pick out "important" arguments is asking for too much. For high-quality summaries, we'd have to pick ourselves.

Moreover, what to do for truly complex commands like blockdev-add? Simply omitting all variant members is one option:

-- Command: blockdev-add driver [node-name] [discard] [cache]

          [read-only] [detect-zeroes] ...

But what may work for blockdev-add need not work for other complex commands.

Quoted 4 lines

struct/objects are more commonly declared with a line per member, so it doesn't bother me as much.

I would appreciate if can have the declarative form for commands and

events

Quoted 2 lines

at least. Other types are usually more complex or long, so that may clear your concerns for the long declarations.

The worst offenders are actually commands such as blockdev-add and block_set_io_throttle, unless we give up on the "reminder" mission for them and merely add a reference to their (named) argument type.

Signature · 1 line
Marc-André Lureau
#134 lore raw
In reply to Markus Armbruster

Hi

Quoted 170 lines · Markus Armbruster

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Based on my qapi-next branch, which contains Marc-André's PATCH 1/2.

Marc-André's work to merge qmp-commands.txt and qmp-events.txt into the QAPI schema and generate their replacements from the schema (commit b6af8ea..56e8bdd) was a big step forward. As committed, it also was a step back: the documentation lost information on JSON types, because I didn't like Marc-André's patch to add it. He reposted it for further review afterwards:

    Subject: [PATCH 0/2] qapi2texi: add type information
    Message-Id: <[email protected]>
    https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05432.html

His PATCH 1/2 is a straightforward cleanup. His PATCH 2/2 adds type descriptions in a new formal language to the generated documentation. Quoting the commit message:

Array types have the following syntax: type[]. Ex: str[].

- Struct, commands and events use the following members syntax:

{ 'member': type, ('foo': str), ... }

Optional members are under parentheses.

A structure with a base type will have 'BaseStruct +' prepended.

- Alternates use the following syntax:

[ 'foo': type, 'bar': type, ... ]

- Simple unions use the following syntax:

{ 'type': str, 'data': 'type' = [ 'foo': type, 'bar': type... ] }

- Flat unions use the following syntax:

BaseStruct + 'discriminator' = [ 'foo': type, 'bar': type... ]

End quote. Looks like this in generated documentation:

-- Event: VNC_CONNECTED {'server': VncServerInfo, 'client':
VncBasicInfo}

Emitted when a VNC client establishes a connection ''server''
server information
''client''
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Struct: VncServerInfo VncBasicInfo + {('auth': str)}

The network connection information for server
''auth'' (optional)
authentication method used for the plain (non-websocket) VNC server

Since: 2.1

-- Simple Union: SocketAddress { 'type': str, 'data': 'type' = ['inet':
InetSocketAddress, 'unix': UnixSocketAddress, 'vsock':
VsockSocketAddress, 'fd': String] }

Captures the address of a socket, which could also be a named file descriptor

Since: 1.3

Here's my counter-proposal: instead of inventing a formal language, fix the natural language documentation to actually mention *all* members, and add type information in a plain, easy-to-understand way. Looks like this:

-- Event: VNC_CONNECTED

Emitted when a VNC client establishes a connection

Arguments:
'server: VncServerInfo'
server information
'client: VncBasicInfo'
client information

Note: This event is emitted before any authentication takes place, thus the authentication ID is not provided
[...]

-- Object: VncServerInfo

The network connection information for server

Members:
'auth: string' (optional)
authentication method used for the plain (non-websocket) VNC server
The members of 'VncBasicInfo'

Since: 2.1

-- Object: SocketAddress

Captures the address of a socket, which could also be a named file descriptor

Members:
'type'
One of "inet", "unix", "vsock", "fd"
'data: InetSocketAddress' when 'type' is "inet" 'data: UnixSocketAddress' when 'type' is "unix" 'data: VsockSocketAddress' when 'type' is "vsock" 'data: String' when 'type' is "fd"

Since: 1.3

Additionally, my series fixes a number of bugs and cleans up along the way. In particular, it converts qapi2texi.py from parse trees to the visitor interface the other generators use.

Future generated documentation work includes eliding types that aren't visible in QMP (like introspection does), and making uses of type names links in HTML.

Markus Armbruster (47):
qapi: Factor QAPISchemaParser._include() out of .__init__()
qapi: Make doc comments optional where we don't need them
qapi: Back out doc comments added just to please qapi.py docs/qapi-code-gen.txt: Drop confusing reference to 'gen'
qapi: Have each QAPI schema declare its returns white-list
qapi: Have each QAPI schema declare its name rule violations
qapi: Clean up build of generated documentation tests/qapi-schema: Cover empty union base
qapi: Fix to reject empty union base gracefully
qapi2texi: Fix up output around #optional
qapi: Avoid unwanted blank lines in QAPIDoc qapi/rocker: Fix up doc comment notes on optional members
qapi: Fix QAPISchemaEnumType.is_implicit() for 'QType'
qapi: Prepare for requiring more complete documentation
qapi: Conjure up QAPIDoc.ArgSection for undocumented members
qapi2texi: Convert to QAPISchemaVisitor
qapi: The #optional tag is redundant, drop
qapi: Use raw strings for regular expressions consistently
qapi: Prefer single-quoted strings more consistently
qapi2texi: Plainer enum value and member name formatting
qapi2texi: Present the table of members more clearly
qapi2texi: Explain enum value undocumentedness more clearly
qapi2texi: Don't hide undocumented members and arguments
qapi2texi: Implement boxed argument documentation
qapi2texi: Include member type in generated documentation
qapi2texi: Generate reference to base type members
qapi2texi: Generate documentation for variant members
qapi2texi: Generate descriptions for simple union tags
qapi2texi: Use category "Object" for all object types tests/qapi-schema: Improve doc / expression mismatch coverage
qapi: Fix detection of doc / expression mismatch
qapi: Move detection of doc / expression name mismatch
qapi: Improve error message on @NAME: in free-form doc
qapi: Move empty doc section checking to doc parser tests/qapi-schema: Rename doc-bad-args to doc-bad-command-arg tests/qapi-schema: Improve coverage of bogus member docs
qapi: Fix detection of bogus member documentation
qapi: Eliminate check_docs() and drop QAPIDoc.expr
qapi: Drop unused variable events

Quoted 10 lines

qapi: Simplify what gets stored in enum_types
qapi: Factor add_name() calls out of the meta conditional
qapi: enum_types is a list used like a dict, make it one
qapi: struct_types is a list used like a dict, make it one
qapi: union_types is a list used like a dict, make it one
qapi: Drop unused .check_clash() parameter schema
qapi: Make pylint a bit happier
qapi: Fix a misleading parser error message

Except the few comments and questions I left, the series looks good to me. I don't think we need to rush it in the 2.9 release though, but I will let the maintainers decide how to deal with the planning and rules.

Quoted 298 lines
 .gitignore                                         |  10 +-
 Makefile                                           |  27 +-
 docs/qapi-code-gen.txt                             |  81 +--
 docs/qemu-qmp-ref.texi                             |   2 +-
 docs/writing-qmp-commands.txt                      |   4 +-
 qapi-schema.json                                   | 403 ++++++-------
 qapi/block-core.json                               | 428 +++++++-------
 qapi/block.json                                    |   8 +-
 qapi/crypto.json                                   |  22 +-
 qapi/event.json                                    |  10 +-
 qapi/introspect.json                               |   6 +-
 qapi/rocker.json                                   |  88 +--
 qapi/trace.json                                    |   6 +-
 qga/qapi-schema.json                               |  55 +-
 rules.mak                                          |   2 +-
 scripts/qapi-commands.py                           |   6 +-
 scripts/qapi-event.py                              |   2 +-
 scripts/qapi-introspect.py                         |   4 +-
 scripts/qapi-types.py                              |   4 +-
 scripts/qapi-visit.py                              |   5 +-
 scripts/qapi.py                                    | 632
++++++++++-----------
 scripts/qapi2texi.py                               | 298 +++++-----
 tests/Makefile.include                             |   9 +-
 tests/qapi-schema/alternate-any.err                |   2 +-
 tests/qapi-schema/alternate-any.json               |   4 -
 tests/qapi-schema/alternate-array.err              |   2 +-
 tests/qapi-schema/alternate-array.json             |   7 -
 tests/qapi-schema/alternate-base.err               |   2 +-
 tests/qapi-schema/alternate-base.json              |   7 -
 tests/qapi-schema/alternate-clash.err              |   2 +-
 tests/qapi-schema/alternate-clash.json             |   4 -
 tests/qapi-schema/alternate-conflict-dict.err      |   2 +-
 tests/qapi-schema/alternate-conflict-dict.json     |  10 -
 tests/qapi-schema/alternate-conflict-string.err    |   2 +-
 tests/qapi-schema/alternate-conflict-string.json   |   7 -
 tests/qapi-schema/alternate-empty.err              |   2 +-
 tests/qapi-schema/alternate-empty.json             |   4 -
 tests/qapi-schema/alternate-nested.err             |   2 +-
 tests/qapi-schema/alternate-nested.json            |   7 -
 tests/qapi-schema/alternate-unknown.err            |   2 +-
 tests/qapi-schema/alternate-unknown.json           |   4 -
 tests/qapi-schema/args-alternate.err               |   2 +-
 tests/qapi-schema/args-alternate.json              |   8 -
 tests/qapi-schema/args-any.err                     |   2 +-
 tests/qapi-schema/args-any.json                    |   4 -
 tests/qapi-schema/args-array-empty.err             |   2 +-
 tests/qapi-schema/args-array-empty.json            |   4 -
 tests/qapi-schema/args-array-unknown.err           |   2 +-
 tests/qapi-schema/args-array-unknown.json          |   4 -
 tests/qapi-schema/args-bad-boxed.err               |   2 +-
 tests/qapi-schema/args-bad-boxed.json              |   4 -
 tests/qapi-schema/args-boxed-anon.err              |   2 +-
 tests/qapi-schema/args-boxed-anon.json             |   4 -
 tests/qapi-schema/args-boxed-empty.err             |   2 +-
 tests/qapi-schema/args-boxed-empty.json            |   8 -
 tests/qapi-schema/args-boxed-string.err            |   2 +-
 tests/qapi-schema/args-boxed-string.json           |   4 -
 tests/qapi-schema/args-int.err                     |   2 +-
 tests/qapi-schema/args-int.json                    |   4 -
 tests/qapi-schema/args-invalid.err                 |   2 +-
 tests/qapi-schema/args-invalid.json                |   3 -
 tests/qapi-schema/args-member-array-bad.err        |   2 +-
 tests/qapi-schema/args-member-array-bad.json       |   4 -
 tests/qapi-schema/args-member-case.err             |   2 +-
 tests/qapi-schema/args-member-case.json            |   4 -
 tests/qapi-schema/args-member-unknown.err          |   2 +-
 tests/qapi-schema/args-member-unknown.json         |   4 -
 tests/qapi-schema/args-name-clash.err              |   2 +-
 tests/qapi-schema/args-name-clash.json             |   4 -
 tests/qapi-schema/args-union.err                   |   2 +-
 tests/qapi-schema/args-union.json                  |   7 -
 tests/qapi-schema/args-unknown.err                 |   2 +-
 tests/qapi-schema/args-unknown.json                |   4 -
 tests/qapi-schema/bad-base.err                     |   2 +-
 tests/qapi-schema/bad-base.json                    |   7 -
 tests/qapi-schema/bad-data.err                     |   2 +-
 tests/qapi-schema/bad-data.json                    |   4 -
 tests/qapi-schema/bad-ident.err                    |   2 +-
 tests/qapi-schema/bad-ident.json                   |   4 -
 tests/qapi-schema/bad-type-bool.err                |   2 +-
 tests/qapi-schema/bad-type-bool.json               |   4 -
 tests/qapi-schema/bad-type-dict.err                |   2 +-
 tests/qapi-schema/bad-type-dict.json               |   4 -
 tests/qapi-schema/base-cycle-direct.err            |   2 +-
 tests/qapi-schema/base-cycle-direct.json           |   4 -
 tests/qapi-schema/base-cycle-indirect.err          |   2 +-
 tests/qapi-schema/base-cycle-indirect.json         |   7 -
 tests/qapi-schema/command-int.err                  |   2 +-
 tests/qapi-schema/command-int.json                 |   4 -
 tests/qapi-schema/comments.json                    |   4 -
 tests/qapi-schema/comments.out                     |   1 -
 tests/qapi-schema/doc-bad-alternate-member.err     |   1 +
 ...optional.exit => doc-bad-alternate-member.exit} |   0
 tests/qapi-schema/doc-bad-alternate-member.json    |   9 +
 ...c-optional.out => doc-bad-alternate-member.out} |   0
 tests/qapi-schema/doc-bad-args.err                 |   1 -
 tests/qapi-schema/doc-bad-command-arg.err          |   1 +
 ...{doc-bad-args.exit => doc-bad-command-arg.exit} |   0
 ...{doc-bad-args.json => doc-bad-command-arg.json} |   0
 .../{doc-bad-args.out => doc-bad-command-arg.out}  |   0
 tests/qapi-schema/doc-bad-expr.err                 |   1 +
 tests/qapi-schema/doc-bad-expr.exit                |   1 +
 tests/qapi-schema/doc-bad-expr.json                |   7 +
 tests/qapi-schema/doc-bad-expr.out                 |   0
 tests/qapi-schema/doc-bad-symbol.err               |   2 +-
 tests/qapi-schema/doc-bad-union-member.err         |   1 +
 tests/qapi-schema/doc-bad-union-member.exit        |   1 +
 tests/qapi-schema/doc-bad-union-member.json        |  19 +
 tests/qapi-schema/doc-bad-union-member.out         |   0
 tests/qapi-schema/doc-empty-section.err            |   2 +-
 tests/qapi-schema/doc-invalid-section.err          |   2 +-
 tests/qapi-schema/doc-missing-expr.err             |   2 +-
 tests/qapi-schema/doc-missing.err                  |   1 +
 tests/qapi-schema/doc-missing.exit                 |   1 +
 tests/qapi-schema/doc-missing.json                 |   5 +
 tests/qapi-schema/doc-missing.out                  |   0
 tests/qapi-schema/doc-no-symbol.err                |   1 +
 tests/qapi-schema/doc-no-symbol.exit               |   1 +
 tests/qapi-schema/doc-no-symbol.json               |   6 +
 tests/qapi-schema/doc-no-symbol.out                |   0
 tests/qapi-schema/doc-optional.err                 |   1 -
 tests/qapi-schema/doc-optional.json                |   7 -
 tests/qapi-schema/double-type.err                  |   2 +-
 tests/qapi-schema/double-type.json                 |   4 -
 tests/qapi-schema/enum-bad-name.err                |   2 +-
 tests/qapi-schema/enum-bad-name.json               |   4 -
 tests/qapi-schema/enum-bad-prefix.err              |   2 +-
 tests/qapi-schema/enum-bad-prefix.json             |   4 -
 tests/qapi-schema/enum-clash-member.err            |   2 +-
 tests/qapi-schema/enum-clash-member.json           |   4 -
 tests/qapi-schema/enum-dict-member.err             |   2 +-
 tests/qapi-schema/enum-dict-member.json            |   4 -
 tests/qapi-schema/enum-member-case.err             |   2 +-
 tests/qapi-schema/enum-member-case.json            |   8 +-
 tests/qapi-schema/enum-missing-data.err            |   2 +-
 tests/qapi-schema/enum-missing-data.json           |   4 -
 tests/qapi-schema/enum-wrong-data.err              |   2 +-
 tests/qapi-schema/enum-wrong-data.json             |   4 -
 tests/qapi-schema/event-boxed-empty.err            |   2 +-
 tests/qapi-schema/event-boxed-empty.json           |   4 -
 tests/qapi-schema/event-case.json                  |   4 -
 tests/qapi-schema/event-case.out                   |   1 -
 tests/qapi-schema/event-nest-struct.err            |   2 +-
 tests/qapi-schema/event-nest-struct.json           |   4 -
 tests/qapi-schema/flat-union-array-branch.err      |   2 +-
 tests/qapi-schema/flat-union-array-branch.json     |  12 -
 tests/qapi-schema/flat-union-bad-base.err          |   2 +-
 tests/qapi-schema/flat-union-bad-base.json         |  13 -
 tests/qapi-schema/flat-union-bad-discriminator.err |   2 +-
 .../qapi-schema/flat-union-bad-discriminator.json  |  16 -
 tests/qapi-schema/flat-union-base-any.err          |   2 +-
 tests/qapi-schema/flat-union-base-any.json         |  13 -
 tests/qapi-schema/flat-union-base-union.err        |   2 +-
 tests/qapi-schema/flat-union-base-union.json       |  16 -
 tests/qapi-schema/flat-union-clash-member.err      |   2 +-
 tests/qapi-schema/flat-union-clash-member.json     |  16 -
 tests/qapi-schema/flat-union-empty.err             |   2 +-
 tests/qapi-schema/flat-union-empty.json            |  10 -
 tests/qapi-schema/flat-union-incomplete-branch.err |   2 +-
 .../qapi-schema/flat-union-incomplete-branch.json  |  10 -
 tests/qapi-schema/flat-union-inline.err            |   2 +-
 tests/qapi-schema/flat-union-inline.json           |  10 -
 tests/qapi-schema/flat-union-int-branch.err        |   2 +-
 tests/qapi-schema/flat-union-int-branch.json       |  13 -
 .../qapi-schema/flat-union-invalid-branch-key.err  |   2 +-
 .../qapi-schema/flat-union-invalid-branch-key.json |  15 -
 .../flat-union-invalid-discriminator.err           |   2 +-
 .../flat-union-invalid-discriminator.json          |  15 -
 tests/qapi-schema/flat-union-no-base.err           |   2 +-
 tests/qapi-schema/flat-union-no-base.json          |  13 -
 .../flat-union-optional-discriminator.err          |   2 +-
 .../flat-union-optional-discriminator.json         |  13 -
 .../flat-union-string-discriminator.err            |   2 +-
 .../flat-union-string-discriminator.json           |  15 -
 tests/qapi-schema/ident-with-escape.json           |   4 -
 tests/qapi-schema/ident-with-escape.out            |   1 -
 tests/qapi-schema/include-relpath-sub.json         |   3 -
 tests/qapi-schema/include-relpath.out              |   1 -
 tests/qapi-schema/include-repetition.out           |   1 -
 tests/qapi-schema/include-simple-sub.json          |   3 -
 tests/qapi-schema/include-simple.out               |   1 -
 tests/qapi-schema/indented-expr.json               |   6 -
 tests/qapi-schema/indented-expr.out                |   2 -
 tests/qapi-schema/missing-type.err                 |   2 +-
 tests/qapi-schema/missing-type.json                |   4 -
 tests/qapi-schema/nested-struct-data.err           |   2 +-
 tests/qapi-schema/nested-struct-data.json          |   4 -
 tests/qapi-schema/qapi-schema-test.json            | 218 +------
 tests/qapi-schema/qapi-schema-test.out             | 130 -----
 tests/qapi-schema/redefined-builtin.err            |   2 +-
 tests/qapi-schema/redefined-builtin.json           |   4 -
 tests/qapi-schema/redefined-command.err            |   2 +-
 tests/qapi-schema/redefined-command.json           |   7 -
 tests/qapi-schema/redefined-event.err              |   2 +-
 tests/qapi-schema/redefined-event.json             |   7 -
 tests/qapi-schema/redefined-type.err               |   2 +-
 tests/qapi-schema/redefined-type.json              |   7 -
 tests/qapi-schema/reserved-command-q.err           |   2 +-
 tests/qapi-schema/reserved-command-q.json          |   7 -
 tests/qapi-schema/reserved-enum-q.err              |   2 +-
 tests/qapi-schema/reserved-enum-q.json             |   4 -
 tests/qapi-schema/reserved-member-has.err          |   2 +-
 tests/qapi-schema/reserved-member-has.json         |   4 -
 tests/qapi-schema/reserved-member-q.err            |   2 +-
 tests/qapi-schema/reserved-member-q.json           |   4 -
 tests/qapi-schema/reserved-member-u.err            |   2 +-
 tests/qapi-schema/reserved-member-u.json           |   4 -
 tests/qapi-schema/reserved-member-underscore.err   |   2 +-
 tests/qapi-schema/reserved-member-underscore.json  |   4 -
 tests/qapi-schema/reserved-type-kind.err           |   2 +-
 tests/qapi-schema/reserved-type-kind.json          |   4 -
 tests/qapi-schema/reserved-type-list.err           |   2 +-
 tests/qapi-schema/reserved-type-list.json          |   4 -
 tests/qapi-schema/returns-alternate.err            |   2 +-
 tests/qapi-schema/returns-alternate.json           |   7 -
 tests/qapi-schema/returns-array-bad.err            |   2 +-
 tests/qapi-schema/returns-array-bad.json           |   4 -
 tests/qapi-schema/returns-dict.err                 |   2 +-
 tests/qapi-schema/returns-dict.json                |   4 -
 tests/qapi-schema/returns-unknown.err              |   2 +-
 tests/qapi-schema/returns-unknown.json             |   4 -
 tests/qapi-schema/returns-whitelist.err            |   2 +-
 tests/qapi-schema/returns-whitelist.json           |  18 +-
 tests/qapi-schema/struct-base-clash-deep.err       |   2 +-
 tests/qapi-schema/struct-base-clash-deep.json      |  10 -
 tests/qapi-schema/struct-base-clash.err            |   2 +-
 tests/qapi-schema/struct-base-clash.json           |   7 -
 tests/qapi-schema/struct-data-invalid.err          |   2 +-
 tests/qapi-schema/struct-data-invalid.json         |   3 -
 tests/qapi-schema/struct-member-invalid.err        |   2 +-
 tests/qapi-schema/struct-member-invalid.json       |   3 -
 tests/qapi-schema/test-qapi.py                     |  14 -
 tests/qapi-schema/trailing-comma-list.err          |   2 +-
 tests/qapi-schema/type-bypass-bad-gen.err          |   2 +-
 tests/qapi-schema/type-bypass-bad-gen.json         |   4 -
 tests/qapi-schema/unicode-str.err                  |   2 +-
 tests/qapi-schema/unicode-str.json                 |   4 -
 tests/qapi-schema/union-base-empty.err             |   1 +
 tests/qapi-schema/union-base-empty.exit            |   1 +
 tests/qapi-schema/union-base-empty.json            |   9 +
 tests/qapi-schema/union-base-empty.out             |   0
 tests/qapi-schema/union-base-no-discriminator.err  |   2 +-
 tests/qapi-schema/union-base-no-discriminator.json |  12 -
 tests/qapi-schema/union-branch-case.err            |   2 +-
 tests/qapi-schema/union-branch-case.json           |   4 -
 tests/qapi-schema/union-clash-branches.err         |   2 +-
 tests/qapi-schema/union-clash-branches.json        |   4 -
 tests/qapi-schema/union-empty.err                  |   2 +-
 tests/qapi-schema/union-empty.json                 |   4 -
 tests/qapi-schema/union-invalid-base.err           |   2 +-
 tests/qapi-schema/union-invalid-base.json          |  10 -
 tests/qapi-schema/union-optional-branch.err        |   2 +-
 tests/qapi-schema/union-optional-branch.json       |   4 -
 tests/qapi-schema/union-unknown.err                |   2 +-
 tests/qapi-schema/union-unknown.json               |   4 -
 tests/qapi-schema/unknown-escape.err               |   2 +-
 tests/qapi-schema/unknown-escape.json              |   4 -
 tests/qapi-schema/unknown-expr-key.err             |   2 +-
 tests/qapi-schema/unknown-expr-key.json            |   4 -
 259 files changed, 1263 insertions(+), 2109 deletions(-)
 create mode 100644 tests/qapi-schema/doc-bad-alternate-member.err
 rename tests/qapi-schema/{doc-optional.exit =>
doc-bad-alternate-member.exit} (100%)
 create mode 100644 tests/qapi-schema/doc-bad-alternate-member.json
 rename tests/qapi-schema/{doc-optional.out =>
doc-bad-alternate-member.out} (100%)
 delete mode 100644 tests/qapi-schema/doc-bad-args.err
 create mode 100644 tests/qapi-schema/doc-bad-command-arg.err
 rename tests/qapi-schema/{doc-bad-args.exit => doc-bad-command-arg.exit}
(100%)
 rename tests/qapi-schema/{doc-bad-args.json => doc-bad-command-arg.json}
(100%)
 rename tests/qapi-schema/{doc-bad-args.out => doc-bad-command-arg.out}
(100%)
 create mode 100644 tests/qapi-schema/doc-bad-expr.err
 create mode 100644 tests/qapi-schema/doc-bad-expr.exit
 create mode 100644 tests/qapi-schema/doc-bad-expr.json
 create mode 100644 tests/qapi-schema/doc-bad-expr.out
 create mode 100644 tests/qapi-schema/doc-bad-union-member.err
 create mode 100644 tests/qapi-schema/doc-bad-union-member.exit
 create mode 100644 tests/qapi-schema/doc-bad-union-member.json
 create mode 100644 tests/qapi-schema/doc-bad-union-member.out
 create mode 100644 tests/qapi-schema/doc-missing.err
 create mode 100644 tests/qapi-schema/doc-missing.exit
 create mode 100644 tests/qapi-schema/doc-missing.json
 create mode 100644 tests/qapi-schema/doc-missing.out
 create mode 100644 tests/qapi-schema/doc-no-symbol.err
 create mode 100644 tests/qapi-schema/doc-no-symbol.exit
 create mode 100644 tests/qapi-schema/doc-no-symbol.json
 create mode 100644 tests/qapi-schema/doc-no-symbol.out
 delete mode 100644 tests/qapi-schema/doc-optional.err
 delete mode 100644 tests/qapi-schema/doc-optional.json
 create mode 100644 tests/qapi-schema/union-base-empty.err
 create mode 100644 tests/qapi-schema/union-base-empty.exit
 create mode 100644 tests/qapi-schema/union-base-empty.json
 create mode 100644 tests/qapi-schema/union-base-empty.out
Quoted 5 lines

--
2.7.4

--

Marc-André Lureau

#135 lore raw
Quoted 8 lines · Marc-André Lureau

Hi

Quoted 3 lines · Markus Armbruster

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

[...]

Quoted 3 lines

Except the few comments and questions I left, the series looks good to me. I don't think we need to rush it in the 2.9 release though, but I will let the maintainers decide how to deal with the planning and rules.

Letting documentation quality regress in 2.9 wouldn't be the end of the world, but this series is as safe as they get, despite its size.

Thanks for your review!

#136 lore raw
In reply to Markus Armbruster
Quoted 5 lines · Markus Armbruster

I'm proposing this is 2.9 because it fixes a documentation regression. It affects only documentation; generated C code is unchanged except for the removal of trailing space in PATCH 46.

Quoted 7 lines

Additionally, my series fixes a number of bugs and cleans up along the way. In particular, it converts qapi2texi.py from parse trees to the visitor interface the other generators use.

Future generated documentation work includes eliding types that aren't visible in QMP (like introspection does), and making uses of type names links in HTML.

Reporting here, so it doesn't get lost in IRC. Other potential future
work: fix this poor error message:

GEN docs/qemu-qmp-qapi.texi
Traceback (most recent call last):
File "/home/eblake/qemu/scripts/qapi2texi.py", line 300, in <module>
main(sys.argv)
File "/home/eblake/qemu/scripts/qapi2texi.py", line 296, in main
print texi_schema(schema)
File "/home/eblake/qemu/scripts/qapi2texi.py", line 279, in texi_schema
gen.symbol(doc, schema.lookup_entity(doc.symbol))
File "/home/eblake/qemu/scripts/qapi2texi.py", line 263, in symbol
entity.visit(self)
File "/home/eblake/qemu/scripts/qapi.py", line 1448, in visit
visitor.visit_event(self.name, self.info, self.arg_type, self.boxed)
File "/home/eblake/qemu/scripts/qapi2texi.py", line 259, in visit_event
body=texi_entity(doc, 'Arguments'))
File "/home/eblake/qemu/scripts/qapi2texi.py", line 200, in texi_entity
+ texi_sections(doc))
File "/home/eblake/qemu/scripts/qapi2texi.py", line 160, in texi_members

    items += member_func(section.member) + desc + '\n'

File "/home/eblake/qemu/scripts/qapi2texi.py", line 138, in texi_member
typ = member.type.doc_type()
AttributeError: 'NoneType' object has no attribute 'type' Makefile:706: recipe for target 'docs/qemu-qmp-qapi.texi' failed
make: *** [docs/qemu-qmp-qapi.texi] Error 1
make: *** Deleting file 'docs/qemu-qmp-qapi.texi'

caused by this small change (documenting an event member, but omitting 'data' for the event itself):

qapi/event.json +2 -0
index 6d22b02..8978b33 100644
@@ -68,6 +68,8 @@
 #
 # Emitted when the virtual machine is stopped
 #
+# @bogus: new field
+#
 # Since: 0.12.0
 #
 # Example:
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org