From: Markus Armbruster Date: Fri, 16 Feb 2024 14:58:37 +0000 (+0100) Subject: qapi: Merge adjacent untagged sections X-Git-Tag: v9.0.0-rc0~50^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b82a7440c22056745a925d0b1c070e18534aa0e;p=thirdparty%2Fqemu.git qapi: Merge adjacent untagged sections The parser mostly doesn't create adjacent untagged sections, and merging the ones it does create is hardly worth the bother. I'm doing it to avoid behavioral change in the next commit. Signed-off-by: Markus Armbruster Message-ID: <20240216145841.2099240-14-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé --- diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index de2ce3ec2cf..48cc9a63674 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -719,6 +719,9 @@ class QAPIDoc: self._start_symbol_section(self.features, name) def _start_section(self, tag: Optional[str] = None) -> None: + if not tag and not self._section.tag: + # extend current section + return if tag in ('Returns', 'Since') and self.has_section(tag): raise QAPIParseError(self._parser, "duplicated '%s' section" % tag) diff --git a/tests/qapi-schema/doc-empty-features.out b/tests/qapi-schema/doc-empty-features.out index 0f85623dde4..473f59552dc 100644 --- a/tests/qapi-schema/doc-empty-features.out +++ b/tests/qapi-schema/doc-empty-features.out @@ -14,6 +14,4 @@ command foo None -> None gen=True success_response=True boxed=False oob=False preconfig=False doc symbol=foo body= - - section=None not a description