[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for 2.9 35/49] qapi: Improve error message on @NAME:
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL for 2.9 35/49] qapi: Improve error message on @NAME: in free-form doc |
Date: |
Thu, 16 Mar 2017 07:27:51 +0100 |
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
---
scripts/qapi.py | 17 ++++++-----------
tests/qapi-schema/doc-invalid-section.err | 2 +-
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 9a1d830..4edcea1 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -219,6 +219,11 @@ class QAPIDoc(object):
if (in_arg or not self.section.name
or not self.section.name.startswith('Example')):
line = line.strip()
+ match = re.match(r'(@\S+:)', line)
+ if match:
+ raise QAPIParseError(self.parser,
+ "'%s' not allowed in free-form documentation"
+ % match.group(1))
# TODO Drop this once the dust has settled
if (isinstance(self.section, QAPIDoc.ArgSection)
and '#optional' in line):
@@ -975,14 +980,6 @@ def check_exprs(exprs):
return exprs
-def check_freeform_doc(doc):
- body = str(doc.body)
- if re.search(r'@\S+:', body, re.MULTILINE):
- raise QAPISemError(doc.info,
- "Free-form documentation block must not contain"
- " @NAME: sections")
-
-
def check_definition_doc(doc, expr, info):
for i in ('enum', 'union', 'alternate', 'struct', 'command', 'event'):
if i in expr:
@@ -1021,9 +1018,7 @@ def check_docs(docs):
raise QAPISemError(doc.info,
"Empty doc section '%s'" % section.name)
- if not doc.expr:
- check_freeform_doc(doc)
- else:
+ if doc.expr:
check_definition_doc(doc, doc.expr, doc.info)
return docs
diff --git a/tests/qapi-schema/doc-invalid-section.err
b/tests/qapi-schema/doc-invalid-section.err
index 85bb67b..bda93b4 100644
--- a/tests/qapi-schema/doc-invalid-section.err
+++ b/tests/qapi-schema/doc-invalid-section.err
@@ -1 +1 @@
-tests/qapi-schema/doc-invalid-section.json:3: Free-form documentation block
must not contain @NAME: sections
+tests/qapi-schema/doc-invalid-section.json:5:1: '@note:' not allowed in
free-form documentation
--
2.7.4
- [Qemu-devel] [PULL for 2.9 21/49] qapi: Prefer single-quoted strings more consistently, (continued)
- [Qemu-devel] [PULL for 2.9 21/49] qapi: Prefer single-quoted strings more consistently, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 29/49] qapi2texi: Generate documentation for variant members, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 18/49] qapi2texi: Convert to QAPISchemaVisitor, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 48/49] qapi: Make pylint a bit happier, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 15/49] qapi: Fix QAPISchemaEnumType.is_implicit() for 'QType', Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 13/49] qapi: Avoid unwanted blank lines in QAPIDoc, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 25/49] qapi2texi: Don't hide undocumented members and arguments, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 30/49] qapi2texi: Generate descriptions for simple union tags, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 41/49] qapi: Drop unused variable events, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 31/49] qapi2texi: Use category "Object" for all object types, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 35/49] qapi: Improve error message on @NAME: in free-form doc,
Markus Armbruster <=
- [Qemu-devel] [PULL for 2.9 22/49] qapi2texi: Plainer enum value and member name formatting, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 33/49] qapi: Fix detection of doc / expression mismatch, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 23/49] qapi2texi: Present the table of members more clearly, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 36/49] qapi: Move empty doc section checking to doc parser, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 42/49] qapi: Simplify what gets stored in enum_types, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 34/49] qapi: Move detection of doc / expression name mismatch, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 46/49] qapi: union_types is a list used like a dict, make it one, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 45/49] qapi: struct_types is a list used like a dict, make it one, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 38/49] tests/qapi-schema: Improve coverage of bogus member docs, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 16/49] qapi: Prepare for requiring more complete documentation, Markus Armbruster, 2017/03/16