@@ -925,10 +925,6 @@ def check_exprs(exprs):
if 'include' in expr:
continue
- if not doc and doc_required:
- raise QAPISemError(info,
- "definition missing documentation comment")
-
if 'enum' in expr:
meta = 'enum'
elif 'union' in expr:
@@ -949,9 +945,14 @@ def check_exprs(exprs):
info.set_defn(meta, name)
check_defn_name_str(name, info, meta)
- if doc and doc.symbol != name:
- raise QAPISemError(
- info, "documentation comment is for '%s'" % doc.symbol)
+ if doc:
+ if doc.symbol != name:
+ raise QAPISemError(
+ info, "documentation comment is for '%s'" % doc.symbol)
+ doc.check_expr(expr)
+ elif doc_required:
+ raise QAPISemError(info,
+ "documentation comment required")
if meta == 'enum':
check_keys(expr, info, meta,
@@ -996,9 +997,6 @@ def check_exprs(exprs):
check_if(expr, info)
check_flags(expr, info)
- if doc:
- doc.check_expr(expr)
-
return exprs
@@ -1 +1,2 @@
-tests/qapi-schema/doc-missing.json:5: definition missing documentation comment
+tests/qapi-schema/doc-missing.json: In command 'undocumented':
+tests/qapi-schema/doc-missing.json:5: documentation comment required
Have check_exprs() check this later, so the error message gains an "in definition line". Tweak the error message. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- scripts/qapi/common.py | 18 ++++++++---------- tests/qapi-schema/doc-missing.err | 3 ++- 2 files changed, 10 insertions(+), 11 deletions(-)