From nobody Mon Nov 25 13:14:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1714993640; cv=none; d=zohomail.com; s=zohoarc; b=QwJ4I9BChFnGfCH4WN4Xb0X32Rm2grt+he2/RXqaBb2311Vhi8mfirDVurDBbnEMF9NWY9GhsB0JDjZTmvz1XsQvkkblnYeu6HlNA7Gd3zBPw1kLWgjyjdbrZFDZmB1HfWFfIV6gPax5zOwJMe/MFuz3jTnDIqPtn/Bj18XTsCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993640; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HXdJA2BHeqHIiC0EhCGjai0a7ae19Qf0y5BbHTMjxDU=; b=C2mgmMl/+03QdzBNF/Xt5h5zcNdNckUiAwjAEaIpD3f0ncigKZ8RnNaIkjUdJZjjSqDSeQbIt5AdvMhEnZP6LUUWRRNa+R+FgVB00XeAkNgwtnIGT++ELnfbZR7sjfTkvwK683HV6QSiN2RbIVkJSE0JmPmPb6HF7YL5p0/OHcc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1714993640033453.7191771091425; Mon, 6 May 2024 04:07:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7r-00036s-Lw; Mon, 06 May 2024 07:03:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7f-0002on-Ew for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7X-0003eh-4Q for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:07 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-IQb2DXQAOEWhUQLVOe_OXQ-1; Mon, 06 May 2024 07:02:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 774AB1049C93; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58075200B09C; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 47A6421E5D28; Mon, 6 May 2024 13:02:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714993378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HXdJA2BHeqHIiC0EhCGjai0a7ae19Qf0y5BbHTMjxDU=; b=c9ZdTfLC/s/pIp3qGBcZW26GAb4pFzaNi9OWASkEmya+CsjxTYB+kSzO6Vwxc91bYJFap7 baM8/IsODAC01szduQkakYQ8poiJeY412mSkta7uEgtz2M6sxaAfiUTsA0bE9bprwVQqAd PB1GJ0xTh69uSBEdH4VVU5kM0t1CiJU= X-MC-Unique: IQb2DXQAOEWhUQLVOe_OXQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 3/7] qapi: make returns sections special WIP Date: Mon, 6 May 2024 13:02:46 +0200 Message-ID: <20240506110254.3965097-7-armbru@redhat.com> In-Reply-To: <20240506110254.3965097-1-armbru@redhat.com> References: <20240506110254.3965097-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.581, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1714993641642100003 Content-Type: text/plain; charset="utf-8" returns moves in generated output --- docs/sphinx/qapidoc.py | 8 ++++++++ scripts/qapi/parser.py | 4 ++-- tests/qapi-schema/doc-good.out | 4 ++-- tests/qapi-schema/doc-good.txt | 12 ++++++------ tests/qapi-schema/test-qapi.py | 2 ++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index f19f5ded78..24bf1d9a90 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -250,6 +250,13 @@ def _nodes_for_features(self, doc): section +=3D dlnode return [section] =20 + def _nodes_for_returns(self, doc, ret_type): + if doc.returns: + section =3D self._make_section('Returns') + self._parse_text_into_node(doc.returns.text, section) + return [section] + return [] + def _nodes_for_since(self, doc): if doc.since: # TODO emphasis @@ -343,6 +350,7 @@ def visit_command(self, name, info, ifcond, features, a= rg_type, self._add_doc('Command', self._nodes_for_arguments(doc, arg_type if boxed else Non= e) + + self._nodes_for_returns(doc, ret_type) + self._nodes_for_features(doc) + self._nodes_for_sections(doc) + self._nodes_for_if_section(ifcond) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 0237d13da9..e8a482c37d 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -646,7 +646,7 @@ def __init__(self, info: QAPISourceInfo, symbol: Option= al[str] =3D None): self.errors: Optional[QAPIDoc.Section] =3D None # "Since" section self.since: Optional[QAPIDoc.Section] =3D None - # sections other than .body, .args, .features, .since + # sections other than .body, .args, .features, .returns, .since self.sections: List[QAPIDoc.Section] =3D [] =20 def end(self) -> None: @@ -683,7 +683,7 @@ def new_tagged_section(self, info: QAPISourceInfo, tag:= str) -> None: raise QAPISemError( info, "duplicated '%s' section" % tag) self.since =3D section - if tag !=3D 'Since': + if tag not in ('Returns', 'Since'): self.sections.append(section) self.all_sections.append(section) =20 diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 716a9a4102..f2be711a2c 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -165,14 +165,14 @@ description starts on the same line remainder indented differently arg=3Darg3 =20 + section=3DReturns +@Object feature=3Dcmd-feat1 a feature feature=3Dcmd-feat2 another feature section=3DNote @arg3 is undocumented - section=3DReturns -@Object section=3DErrors some section=3DTODO diff --git a/tests/qapi-schema/doc-good.txt b/tests/qapi-schema/doc-good.txt index 56d50d4992..fd88301431 100644 --- a/tests/qapi-schema/doc-good.txt +++ b/tests/qapi-schema/doc-good.txt @@ -184,6 +184,12 @@ Arguments Not documented =20 =20 +Returns +~~~~~~~ + +"Object" + + Features ~~~~~~~~ =20 @@ -200,12 +206,6 @@ Note "arg3" is undocumented =20 =20 -Returns -~~~~~~~ - -"Object" - - Errors ~~~~~~ =20 diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 642daa29a4..1628efe0f3 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -127,6 +127,8 @@ def test_frontend(fname): print(' body=3D\n%s' % doc.body.text) for arg, section in doc.args.items(): print(' arg=3D%s\n%s' % (arg, section.text)) + if doc.returns: + print(' section=3D%s\n%s' % (doc.returns.tag, doc.returns.t= ext)) for feat, section in doc.features.items(): print(' feature=3D%s\n%s' % (feat, section.text)) for section in doc.sections: --=20 2.44.0