From nobody Mon Nov 25 11:20:19 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=1714993451; cv=none; d=zohomail.com; s=zohoarc; b=PqBO2MsjllqhglBv5elkQatGLrGMQ3D+U7qXqNchhBT4SaZPCsLjtHip5+5C0UMqc0MU1hdbRfAd4+yGRYcFij/iwrDz2i9eg2KaOBt1lBVoD73VYcfAF4k8NeLhCDFskuzU+cEd7JuOmhylqKykVhMgvl1QJFIO7f8BrFnbu6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993451; 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=5JZJZ30hoscIH0XNsfxJED2r8MoVXpLdGJjt1EwEL8U=; b=oKNe6yyZV/ApqQmsxeeThwO5/6/9LQ+3wcatoD92gSbVzzD6kZONX8yeYMco87zNwC3AB2l/P1IV1rOmwvQ+AzJyIjySCzqeViKUF+ThxpkVaAj+f5+puDXnqrEaZEmTrOU0AXagKhSpqNIWpTK9CD4ZfnJD0U5ZhDAX4stn7vI= 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 1714993451037655.2201167853101; Mon, 6 May 2024 04:04:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7n-00031T-7y; Mon, 06 May 2024 07:03:15 -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 1s3w7c-0002nZ-No for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7X-0003eM-3Z for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:04 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-80-G7oR9L_aOzWqLiVx15g5VQ-1; Mon, 06 May 2024 07:02:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 797C138000AF; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 273272024511; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3989F21E669D; 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=1714993377; 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=5JZJZ30hoscIH0XNsfxJED2r8MoVXpLdGJjt1EwEL8U=; b=gVpOlkObevYITTEo+uQMi2s6mjjEpVRDlNzKt7/0njpdzRzvd90QKfhM29lUqefemN5lFB D2wsllPt301BFFaOqhL/ka9bGjYYp/hfuzyidmF0KFJomXfehEGC6qKcJOLt4Y6/UNodBt ZjJcbpbKlEvaH3DJs76olG5a6SctwnA= X-MC-Unique: G7oR9L_aOzWqLiVx15g5VQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PULL 1/7] qapi: New QAPISchemaBranches, QAPISchemaAlternatives Date: Mon, 6 May 2024 13:02:41 +0200 Message-ID: <20240506110254.3965097-2-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.4 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.133.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: 1714993451544100001 Content-Type: text/plain; charset="utf-8" QAPISchemaVariants represents either a union type's branches, or an alternate type's alternatives. Much of its code is conditional on which one it actually is. Create QAPISchemaBranches for branches, and QAPISchemaAlternatives for alternatives, both subtypes of QAPISchemaVariants. Replace QAPISchemaVariants by one of them where possible. Keep it only where we actually deal with either of them. QAPISchemaVariants.__init__() takes @tag_name and @tag_member, where exactly one must be None: @tag_name for alternatives, @tag_member for branches. Let QAPISchemaBranches.__init__() take just @tag_name, and QAPISchemaAlternatives.__init__() take just @tag_member. A later patch will move the conditional code to the subtypes. Signed-off-by: Markus Armbruster --- scripts/qapi/introspect.py | 7 ++++--- scripts/qapi/schema.py | 32 ++++++++++++++++++++++++-------- scripts/qapi/types.py | 6 ++++-- scripts/qapi/visit.py | 11 ++++++----- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 4679b1bc2c..b866517942 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -26,6 +26,8 @@ from .gen import QAPISchemaMonolithicCVisitor from .schema import ( QAPISchema, + QAPISchemaAlternatives, + QAPISchemaBranches, QAPISchemaArrayType, QAPISchemaBuiltinType, QAPISchemaEntity, @@ -36,7 +38,6 @@ QAPISchemaObjectTypeMember, QAPISchemaType, QAPISchemaVariant, - QAPISchemaVariants, ) from .source import QAPISourceInfo =20 @@ -335,7 +336,7 @@ def visit_object_type_flat(self, name: str, info: Optio= nal[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaVariants]) -> = None: + variants: Optional[QAPISchemaBranches]) -> = None: obj: SchemaInfoObject =3D { 'members': [self._gen_object_member(m) for m in members] } @@ -347,7 +348,7 @@ def visit_object_type_flat(self, name: str, info: Optio= nal[QAPISourceInfo], def visit_alternate_type(self, name: str, info: Optional[QAPISourceInf= o], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaVariants) -> None: + variants: QAPISchemaAlternatives) -> None: self._gen_tree( name, 'alternate', {'members': [Annotated({'type': self._use_type(m.type)}, diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 5924947fc3..5cdedfc2c8 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -215,7 +215,7 @@ def visit_object_type( features: List[QAPISchemaFeature], base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaVariants], + variants: Optional[QAPISchemaBranches], ) -> None: pass =20 @@ -226,7 +226,7 @@ def visit_object_type_flat( ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaVariants], + variants: Optional[QAPISchemaBranches], ) -> None: pass =20 @@ -236,7 +236,7 @@ def visit_alternate_type( info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaVariants, + variants: QAPISchemaAlternatives, ) -> None: pass =20 @@ -524,7 +524,7 @@ def __init__( features: Optional[List[QAPISchemaFeature]], base: Optional[str], local_members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaVariants], + variants: Optional[QAPISchemaBranches], ): # struct has local_members, optional base, and no variants # union has base, variants, and no local_members @@ -651,7 +651,7 @@ def __init__( doc: Optional[QAPIDoc], ifcond: Optional[QAPISchemaIfCond], features: List[QAPISchemaFeature], - variants: QAPISchemaVariants, + variants: QAPISchemaAlternatives, ): super().__init__(name, info, doc, ifcond, features) assert variants.tag_member @@ -833,6 +833,22 @@ def check_clash( v.type.check_clash(info, dict(seen)) =20 =20 +class QAPISchemaBranches(QAPISchemaVariants): + def __init__(self, + info: QAPISourceInfo, + variants: List[QAPISchemaVariant], + tag_name: str): + super().__init__(tag_name, info, None, variants) + + +class QAPISchemaAlternatives(QAPISchemaVariants): + def __init__(self, + info: QAPISourceInfo, + variants: List[QAPISchemaVariant], + tag_member: QAPISchemaObjectTypeMember): + super().__init__(None, info, tag_member, variants) + + class QAPISchemaMember: """ Represents object members, enum members and features """ role =3D 'member' @@ -1388,8 +1404,8 @@ def _def_union_type(self, expr: QAPIExpression) -> No= ne: self._def_definition( QAPISchemaObjectType(name, info, expr.doc, ifcond, features, base, members, - QAPISchemaVariants( - tag_name, info, None, variants))) + QAPISchemaBranches( + info, variants, tag_name))) =20 def _def_alternate_type(self, expr: QAPIExpression) -> None: name =3D expr['alternate'] @@ -1407,7 +1423,7 @@ def _def_alternate_type(self, expr: QAPIExpression) -= > None: self._def_definition( QAPISchemaAlternateType( name, info, expr.doc, ifcond, features, - QAPISchemaVariants(None, info, tag_member, variants))) + QAPISchemaAlternatives(info, variants, tag_member))) =20 def _def_command(self, expr: QAPIExpression) -> None: name =3D expr['command'] diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index c39d054d2c..23cdf3e83e 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -23,6 +23,8 @@ ) from .schema import ( QAPISchema, + QAPISchemaAlternatives, + QAPISchemaBranches, QAPISchemaEnumMember, QAPISchemaFeature, QAPISchemaIfCond, @@ -348,7 +350,7 @@ def visit_object_type(self, features: List[QAPISchemaFeature], base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaVariants]) -> None: + variants: Optional[QAPISchemaBranches]) -> None: # Nothing to do for the special empty builtin if name =3D=3D 'q_empty': return @@ -369,7 +371,7 @@ def visit_alternate_type(self, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaVariants) -> None: + variants: QAPISchemaAlternatives) -> None: with ifcontext(ifcond, self._genh): self._genh.preamble_add(gen_fwd_object_or_array(name)) self._genh.add(gen_object(name, ifcond, None, diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index a21b7b1468..990685498f 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -28,6 +28,8 @@ ) from .schema import ( QAPISchema, + QAPISchemaAlternatives, + QAPISchemaBranches, QAPISchemaEnumMember, QAPISchemaEnumType, QAPISchemaFeature, @@ -35,7 +37,6 @@ QAPISchemaObjectType, QAPISchemaObjectTypeMember, QAPISchemaType, - QAPISchemaVariants, ) from .source import QAPISourceInfo =20 @@ -63,7 +64,7 @@ def gen_visit_members_decl(name: str) -> str: def gen_visit_object_members(name: str, base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaVariants]) -> st= r: + variants: Optional[QAPISchemaBranches]) -> st= r: ret =3D mcgen(''' =20 bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **er= rp) @@ -222,7 +223,7 @@ def gen_visit_enum(name: str) -> str: c_name=3Dc_name(name)) =20 =20 -def gen_visit_alternate(name: str, variants: QAPISchemaVariants) -> str: +def gen_visit_alternate(name: str, variants: QAPISchemaAlternatives) -> st= r: ret =3D mcgen(''' =20 bool visit_type_%(c_name)s(Visitor *v, const char *name, @@ -393,7 +394,7 @@ def visit_object_type(self, features: List[QAPISchemaFeature], base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaVariants]) -> None: + variants: Optional[QAPISchemaBranches]) -> None: # Nothing to do for the special empty builtin if name =3D=3D 'q_empty': return @@ -413,7 +414,7 @@ def visit_alternate_type(self, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaVariants) -> None: + variants: QAPISchemaAlternatives) -> None: with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_visit_decl(name)) self._genc.add(gen_visit_alternate(name, variants)) --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993486; cv=none; d=zohomail.com; s=zohoarc; b=UmcmNVwBWJdmDjhwp4+TUhiOoj/skU+xEZf13Jpe/MFM3j+gvBbbpIkRzKUpMYDPhY/MSb80uvIIh8B6PRaMXPqUp74d/kg4nrlpRV36+VSW8ECZ0CO1Z74zFlt2jTfW4o0RtJPACMuMquWyO4UUlicHyynaPvpH63YFhIhsmTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993486; 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=6eEWV2K0C1KrW1v+KAMV4hsT6507/sgqEaxxVW9IdH0=; b=d4a8bf2egnpOV+HvyZ129O/i5wgvEkHleWW+HyUibL0MLi7OHJk65fr+mzadaZaN0GI477TPIfjO41zBuGwc5VpC2jVWTnytfnuaKZlAbWOPrBY/qy9zOwvyahFblWruorFmIesRn9K5t0VFZZaaJgaKvGbOmbBFwm+O62898Is= 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 1714993486206839.3982128863936; Mon, 6 May 2024 04:04:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7i-0002or-IR; Mon, 06 May 2024 07:03:10 -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 1s3w7a-0002lI-Po for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7X-0003eK-3Z for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:02 -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-80-zn8WYcdUMkKNhvanyTCQ3Q-1; Mon, 06 May 2024 07:02:55 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 7992180021A; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2728D1C060D0; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3C22C21E65ED; 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=1714993377; 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=6eEWV2K0C1KrW1v+KAMV4hsT6507/sgqEaxxVW9IdH0=; b=RLfFpRMk2jW6PZ1IrLtPAzxNAYm7npAzqw0ygIScUFVxTDVhjMz04Ht4WXk/jpH/SGT0Ac DOSOxK7AGKrE00ZeWeKc6Tjgykx4HRVawoyEo7qxYZsik9up2UWfMGR1rZu095tCAs6d7X v4gAW5rvj1pd3BMsCYm/dbuO9ZGmQbM= X-MC-Unique: zn8WYcdUMkKNhvanyTCQ3Q-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 1/7] qapi: make since sections special WIP Date: Mon, 6 May 2024 13:02:42 +0200 Message-ID: <20240506110254.3965097-3-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.7 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.133.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: 1714993487581100002 Content-Type: text/plain; charset="utf-8" since moves to end in generated output --- docs/sphinx/qapidoc.py | 22 +++++++++++++++++----- scripts/qapi/parser.py | 5 +++-- tests/qapi-schema/test-qapi.py | 2 ++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index 8d428c64b0..ac81003f0e 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_since(self, doc): + if doc.since: + section =3D self._make_section('Since') + self._parse_text_into_node(doc.since.text, section) + return [section] + return [] + def _nodes_for_example(self, exampletext): """Return list of doctree nodes for a code example snippet""" return [nodes.literal_block(exampletext, exampletext)] @@ -305,7 +312,8 @@ def visit_enum_type(self, name, info, ifcond, features,= members, prefix): self._nodes_for_enum_values(doc) + self._nodes_for_features(doc) + self._nodes_for_sections(doc) - + self._nodes_for_if_section(ifcond)) + + self._nodes_for_if_section(ifcond) + + self._nodes_for_since(doc)) =20 def visit_object_type(self, name, info, ifcond, features, base, members, variants): @@ -316,7 +324,8 @@ def visit_object_type(self, name, info, ifcond, feature= s, self._nodes_for_members(doc, 'Members', base, varian= ts) + self._nodes_for_features(doc) + self._nodes_for_sections(doc) - + self._nodes_for_if_section(ifcond)) + + self._nodes_for_if_section(ifcond) + + self._nodes_for_since(doc)) =20 def visit_alternate_type(self, name, info, ifcond, features, variants): doc =3D self._cur_doc @@ -324,7 +333,8 @@ def visit_alternate_type(self, name, info, ifcond, feat= ures, variants): self._nodes_for_members(doc, 'Members') + self._nodes_for_features(doc) + self._nodes_for_sections(doc) - + self._nodes_for_if_section(ifcond)) + + self._nodes_for_if_section(ifcond) + + self._nodes_for_since(doc)) =20 def visit_command(self, name, info, ifcond, features, arg_type, ret_type, gen, success_response, boxed, allow_oob, @@ -335,7 +345,8 @@ def visit_command(self, name, info, ifcond, features, a= rg_type, arg_type if boxed else Non= e) + self._nodes_for_features(doc) + self._nodes_for_sections(doc) - + self._nodes_for_if_section(ifcond)) + + self._nodes_for_if_section(ifcond) + + self._nodes_for_since(doc)) =20 def visit_event(self, name, info, ifcond, features, arg_type, boxed): doc =3D self._cur_doc @@ -344,7 +355,8 @@ def visit_event(self, name, info, ifcond, features, arg= _type, boxed): arg_type if boxed else Non= e) + self._nodes_for_features(doc) + self._nodes_for_sections(doc) - + self._nodes_for_if_section(ifcond)) + + self._nodes_for_if_section(ifcond) + + self._nodes_for_since(doc)) =20 def symbol(self, doc, entity): """Add documentation for one symbol to the document tree diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 7b13a583ac..0237d13da9 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 + # sections other than .body, .args, .features, .since self.sections: List[QAPIDoc.Section] =3D [] =20 def end(self) -> None: @@ -683,7 +683,8 @@ def new_tagged_section(self, info: QAPISourceInfo, tag:= str) -> None: raise QAPISemError( info, "duplicated '%s' section" % tag) self.since =3D section - self.sections.append(section) + if tag !=3D 'Since': + self.sections.append(section) self.all_sections.append(section) =20 def _new_description(self, info: QAPISourceInfo, name: str, diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 40095431ae..642daa29a4 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -131,6 +131,8 @@ def test_frontend(fname): print(' feature=3D%s\n%s' % (feat, section.text)) for section in doc.sections: print(' section=3D%s\n%s' % (section.tag, section.text)) + if doc.since: + print(' section=3D%s\n%s' % (doc.since.tag, doc.since.text)) =20 =20 def open_test_result(dir_name, file_name, update): --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993656; cv=none; d=zohomail.com; s=zohoarc; b=MmOUkbmiS+3uQMO/WtBb+36GDWAIKuu3oIs+OPH22Kv/0a9tUaCLfpeU2SsbokHtVnpuVhh0eULayEOxuIoJ8bcXTEF0tquB/cUbJI37HGIDqp2IFeZfj/htAMaI6cBYsi1H+DhFgQ8g6ufjWCLJ/9pTWqtV9EKWWUspp6q0N8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993656; 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=0HyK5KN6GldWKkRkTEG+2uybFCTYX4jopamCnwdYdr0=; b=hfjR8rAfYbrZqSKQRnQlixjhVV+mu0fLMtBdWTTehaIdidwPZIfbbyJJ4cczLbL4YqTL0jyODA50q40loPcXRMazE5YGyiwwOmamWF1/zFS1AZUyw2iHZLWQwfMjyalCCnWMr5dBOzlUh1dDTofCeh1wHCN3evJ6NxR/piP+hhI= 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 1714993656581754.0404849597938; Mon, 6 May 2024 04:07:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7s-000370-KR; Mon, 06 May 2024 07:03:20 -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 1s3w7l-0002zJ-Tx for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:13 -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 1s3w7Y-0003fB-Oi for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:13 -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-635-uAe7wgmWMdyVaUXAycijLg-1; Mon, 06 May 2024 07:02:55 -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 7844718065AE; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27141200B2C4; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3F2F821E657E; 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=1714993379; 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=0HyK5KN6GldWKkRkTEG+2uybFCTYX4jopamCnwdYdr0=; b=b8W/GiQa9rYEm8RVzcVVX05QfRpGONZULnDZB6tKIiVY2aWiqe82fccdfkyDg51K9Q7xM3 0a8iWJ2a7+EaE5a6kReIvxQBPnimqWtv/IUwE2bgxXlTjbftlt1yqaCSskSk/ILRkGZWrc yrSPikSp/qHS+hk11ZprP8QpQ77FZ9M= X-MC-Unique: uAe7wgmWMdyVaUXAycijLg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PULL 2/7] qapi: Rename visitor parameter @variants to @branches Date: Mon, 6 May 2024 13:02:43 +0200 Message-ID: <20240506110254.3965097-4-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: 1714993657684100003 Content-Type: text/plain; charset="utf-8" The previous commit narrowed the type of .visit_object_type() parameter @variants from QAPISchemaVariants to QAPISchemaBranches. Rename it to @branches. Same for .visit_object_type_flat(). A few of these pass @branches to helper functions: QAPISchemaGenRSTVisitor.visit_object_type() to ._nodes_for_members() and ._nodes_for_variant_when(), and QAPISchemaGenVisitVisitor.visit_object_type() to gen_visit_object_members(). Rename the helpers' @variants parameters to @branches as well. Signed-off-by: Markus Armbruster --- docs/sphinx/qapidoc.py | 18 +++++++++--------- scripts/qapi/introspect.py | 8 ++++---- scripts/qapi/schema.py | 4 ++-- scripts/qapi/types.py | 4 ++-- scripts/qapi/visit.py | 12 ++++++------ tests/qapi-schema/test-qapi.py | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index 8d428c64b0..71362ba929 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -145,22 +145,22 @@ def _nodes_for_one_member(self, member): term.extend(self._nodes_for_ifcond(member.ifcond)) return term =20 - def _nodes_for_variant_when(self, variants, variant): + def _nodes_for_variant_when(self, branches, variant): """Return list of Text, literal nodes for variant 'when' clause =20 Return a list of doctree nodes which give text like 'when tagname is variant (If: ...)' suitable for use in - the 'variants' part of a definition list. + the 'branches' part of a definition list. """ term =3D [nodes.Text(' when '), - nodes.literal('', variants.tag_member.name), + nodes.literal('', branches.tag_member.name), nodes.Text(' is '), nodes.literal('', '"%s"' % variant.name)] if variant.ifcond.is_present(): term.extend(self._nodes_for_ifcond(variant.ifcond)) return term =20 - def _nodes_for_members(self, doc, what, base=3DNone, variants=3DNone): + def _nodes_for_members(self, doc, what, base=3DNone, branches=3DNone): """Return list of doctree nodes for the table of members""" dlnode =3D nodes.definition_list() for section in doc.args.values(): @@ -178,14 +178,14 @@ def _nodes_for_members(self, doc, what, base=3DNone, = variants=3DNone): nodes.literal('', base.doc_type()= )], None) =20 - if variants: - for v in variants.variants: + if branches: + for v in branches.variants: if v.type.name =3D=3D 'q_empty': continue assert not v.type.is_implicit() term =3D [nodes.Text('The members of '), nodes.literal('', v.type.doc_type())] - term.extend(self._nodes_for_variant_when(variants, v)) + term.extend(self._nodes_for_variant_when(branches, v)) dlnode +=3D self._make_dlitem(term, None) =20 if not dlnode.children: @@ -308,12 +308,12 @@ def visit_enum_type(self, name, info, ifcond, feature= s, members, prefix): + self._nodes_for_if_section(ifcond)) =20 def visit_object_type(self, name, info, ifcond, features, - base, members, variants): + base, members, branches): doc =3D self._cur_doc if base and base.is_implicit(): base =3D None self._add_doc('Object', - self._nodes_for_members(doc, 'Members', base, varian= ts) + self._nodes_for_members(doc, 'Members', base, branch= es) + self._nodes_for_features(doc) + self._nodes_for_sections(doc) + self._nodes_for_if_section(ifcond)) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index b866517942..7852591490 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -336,13 +336,13 @@ def visit_object_type_flat(self, name: str, info: Opt= ional[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaBranches]) -> = None: + branches: Optional[QAPISchemaBranches]) -> = None: obj: SchemaInfoObject =3D { 'members': [self._gen_object_member(m) for m in members] } - if variants: - obj['tag'] =3D variants.tag_member.name - obj['variants'] =3D [self._gen_variant(v) for v in variants.va= riants] + if branches: + obj['tag'] =3D branches.tag_member.name + obj['variants'] =3D [self._gen_variant(v) for v in branches.va= riants] self._gen_tree(name, 'object', obj, ifcond, features) =20 def visit_alternate_type(self, name: str, info: Optional[QAPISourceInf= o], diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 5cdedfc2c8..65c82dd4f1 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -215,7 +215,7 @@ def visit_object_type( features: List[QAPISchemaFeature], base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaBranches], + branches: Optional[QAPISchemaBranches], ) -> None: pass =20 @@ -226,7 +226,7 @@ def visit_object_type_flat( ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaBranches], + branches: Optional[QAPISchemaBranches], ) -> None: pass =20 diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 23cdf3e83e..0abb78f3a8 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -350,13 +350,13 @@ def visit_object_type(self, features: List[QAPISchemaFeature], base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaBranches]) -> None: + branches: Optional[QAPISchemaBranches]) -> None: # Nothing to do for the special empty builtin if name =3D=3D 'q_empty': return with ifcontext(ifcond, self._genh): self._genh.preamble_add(gen_fwd_object_or_array(name)) - self._genh.add(gen_object(name, ifcond, base, members, variants)) + self._genh.add(gen_object(name, ifcond, base, members, branches)) with ifcontext(ifcond, self._genh, self._genc): if base and not base.is_implicit(): self._genh.add(gen_upcast(name, base)) diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 990685498f..fbae5f3e4e 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -64,7 +64,7 @@ def gen_visit_members_decl(name: str) -> str: def gen_visit_object_members(name: str, base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaBranches]) -> st= r: + branches: Optional[QAPISchemaBranches]) -> st= r: ret =3D mcgen(''' =20 bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **er= rp) @@ -132,8 +132,8 @@ def gen_visit_object_members(name: str, ''') ret +=3D memb.ifcond.gen_endif() =20 - if variants: - tag_member =3D variants.tag_member + if branches: + tag_member =3D branches.tag_member assert isinstance(tag_member.type, QAPISchemaEnumType) =20 ret +=3D mcgen(''' @@ -141,7 +141,7 @@ def gen_visit_object_members(name: str, ''', c_name=3Dc_name(tag_member.name)) =20 - for var in variants.variants: + for var in branches.variants: case_str =3D c_enum_const(tag_member.type.name, var.name, tag_member.type.prefix) ret +=3D var.ifcond.gen_if() @@ -394,14 +394,14 @@ def visit_object_type(self, features: List[QAPISchemaFeature], base: Optional[QAPISchemaObjectType], members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaBranches]) -> None: + branches: Optional[QAPISchemaBranches]) -> None: # Nothing to do for the special empty builtin if name =3D=3D 'q_empty': return with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_visit_members_decl(name)) self._genc.add(gen_visit_object_members(name, base, - members, variants)) + members, branches)) # TODO Worth changing the visitor signature, so we could # directly use rather than repeat type.is_implicit()? if not name.startswith('q_'): diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 40095431ae..7c67ad8d9b 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -48,7 +48,7 @@ def visit_array_type(self, name, info, ifcond, element_ty= pe): self._print_if(ifcond) =20 def visit_object_type(self, name, info, ifcond, features, - base, members, variants): + base, members, branches): print('object %s' % name) if base: print(' base %s' % base.name) @@ -57,7 +57,7 @@ def visit_object_type(self, name, info, ifcond, features, % (m.name, m.type.name, m.optional)) self._print_if(m.ifcond, 8) self._print_features(m.features, indent=3D8) - self._print_variants(variants) + self._print_variants(branches) self._print_if(ifcond) self._print_features(features) =20 --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993651; cv=none; d=zohomail.com; s=zohoarc; b=e9wkMy6ZFXGESCz05Yy9wTimwELRxJ6NZ6bJIUMF+wa0Bmk2FV8kwkNIql/lIuIlvbzexWRKyoQZbziRlYVjtXIYy3IDonzFPN3uZZzJ7vM1TzWAepz+ToBQ/TlaJBisD5t98xyO6nobk4Sj4dE6fjOR/L4ByOEFKLRfV/zSDKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993651; 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=CST8hJi+JjS3q3FB4kEBCJTRkwPPNE8vTTYwVXxChSI=; b=cQwPMoGFYNji1tWWOQGwbIju6mngmLdu7GBZ2hxAFCMl25iQnwymTeAJhEYN0AcJlMwT4B5NE+uX5yZUsAxlk6yoP91MUgweM30qFrVp285KG3ZpRTG76pRn25j6pnSJlpsCGawFwD7ohcjEHdOckoupGlwLx6+unzs97HRyBiE= 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 1714993651776212.27547739203544; Mon, 6 May 2024 04:07:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7l-0002xo-8K; Mon, 06 May 2024 07:03:13 -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-0002oU-0N for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:09 -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-0003f7-Lo for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:06 -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-49-AkeHUL-kN5CdO1Kjl6AW5Q-1; Mon, 06 May 2024 07:02:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 5EE3C80BB33; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27419EC683; Mon, 6 May 2024 11:02:55 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 41F3621E64D0; 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=1714993379; 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=CST8hJi+JjS3q3FB4kEBCJTRkwPPNE8vTTYwVXxChSI=; b=S8/x6wdGScAlwYR2TWjfskEZ/UvB+l5uwyxhyJsb/LYgI745ZkANLKndT2PXjBDc1X25eP I+4JZewszX1MQEqbJfDQYETjHfG+Zr6jwVXyCP2Q2GUVq68cFuKY5htX1O/PGE3tY0UKQV wMK9PWm4b00w8OF1DyIcUSJeQVR/tSk= X-MC-Unique: AkeHUL-kN5CdO1Kjl6AW5Q-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 2/7] sphinx/qapidoc: Tweak "Since" section formatting WIP Date: Mon, 6 May 2024 13:02:44 +0200 Message-ID: <20240506110254.3965097-5-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.5 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: 1714993653607100007 Content-Type: text/plain; charset="utf-8" --- docs/sphinx/qapidoc.py | 6 +++--- tests/qapi-schema/doc-good.txt | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index ac81003f0e..f19f5ded78 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -252,9 +252,9 @@ def _nodes_for_features(self, doc): =20 def _nodes_for_since(self, doc): if doc.since: - section =3D self._make_section('Since') - self._parse_text_into_node(doc.since.text, section) - return [section] + # TODO emphasis + return [nodes.paragraph( + '', '', nodes.Text('Since: ' + doc.since.text))] return [] =20 def _nodes_for_example(self, exampletext): diff --git a/tests/qapi-schema/doc-good.txt b/tests/qapi-schema/doc-good.txt index 847db70412..56d50d4992 100644 --- a/tests/qapi-schema/doc-good.txt +++ b/tests/qapi-schema/doc-good.txt @@ -235,11 +235,7 @@ Examples - *verbatim* - {braces} =20 - -Since -~~~~~ - -2.10 +Since: 2.10 =20 =20 "cmd-boxed" (Command) --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993535; cv=none; d=zohomail.com; s=zohoarc; b=AzuX7PBoDNH0Oq/XOr8WLsDi17MTALABcbFV0n0jZwOcx1bIxOzTtj7pSciZrrK0+mSrr99xHjwHb1zncHV2nrlaAGfAot3seshQALFlfIxJiiCTPvM1kBg0j/zHGp4YSMwrQKa7b4oAoMG8I7ubKm+72A4W6WPsBL0liLkGGIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993535; 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=nyVLHeduWKWXEcXc63nmjHd8vIqUBrwtESlJ8J+9mrE=; b=bStCRdTkmc/xsAtkyHzGKDQ7sbseE3C9QUhhyoUZhuUnlv4sf9dGS6l5QFykdMLy2vSz+DAg3s3K+nMiyD1Rd1e/LcX/zSMlUZ7G8fHgOodkEEZaTtV/BAfsDsHKOA9iPXzQXJNGiBK+9aPDMZ0RaFrMVM9WFdWJ6lbGC3KyC5I= 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 1714993535905781.6554562440467; Mon, 6 May 2024 04:05:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7m-0002zK-0Z; Mon, 06 May 2024 07:03:14 -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 1s3w7a-0002lJ-T9 for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:03 -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-0003el-72 for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:02 -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-111-TFMCNSlzOlOcjxevfjiX3w-1; Mon, 06 May 2024 07:02:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 92B2918065AD; 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 58036C13FA1; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 44D0521E6142; 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=nyVLHeduWKWXEcXc63nmjHd8vIqUBrwtESlJ8J+9mrE=; b=jKcSxXcgQwSHvoGDOS5shKzkhoiFKhbjjqZSpO2dLRAxnUuY2dsyiXS/HKg1bPuGTvBufg wmqOiyD32U6uXguTf7BdH6/tWvN/tBT0j53nnr5F8E9yQmhPGfHRY7mPhWz6C6dR0SWRNU Fkalgsm8VuZL00ZP3gyzMncBGcSE8TY= X-MC-Unique: TFMCNSlzOlOcjxevfjiX3w-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PULL 3/7] qapi: Rename visitor parameter @variants to @alternatives Date: Mon, 6 May 2024 13:02:45 +0200 Message-ID: <20240506110254.3965097-6-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.8 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: 1714993537850100006 Content-Type: text/plain; charset="utf-8" A previous commit narrowed the type of .visit_alternate_type() parameter @variants from QAPISchemaVariants to QAPISchemaAlternatives. Rename it to @alternatives. One of them passes @alternatives to helper function gen_visit_alternate(). Rename its @variants parameter to @alternatives as well. Signed-off-by: Markus Armbruster --- docs/sphinx/qapidoc.py | 3 ++- scripts/qapi/introspect.py | 4 ++-- scripts/qapi/schema.py | 2 +- scripts/qapi/types.py | 4 ++-- scripts/qapi/visit.py | 9 +++++---- tests/qapi-schema/test-qapi.py | 5 +++-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index 71362ba929..f270b494f0 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -318,7 +318,8 @@ def visit_object_type(self, name, info, ifcond, feature= s, + self._nodes_for_sections(doc) + self._nodes_for_if_section(ifcond)) =20 - def visit_alternate_type(self, name, info, ifcond, features, variants): + def visit_alternate_type(self, name, info, ifcond, features, + alternatives): doc =3D self._cur_doc self._add_doc('Alternate', self._nodes_for_members(doc, 'Members') diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 7852591490..86c075a6ad 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -348,12 +348,12 @@ def visit_object_type_flat(self, name: str, info: Opt= ional[QAPISourceInfo], def visit_alternate_type(self, name: str, info: Optional[QAPISourceInf= o], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaAlternatives) -> None: + alternatives: QAPISchemaAlternatives) -> None: self._gen_tree( name, 'alternate', {'members': [Annotated({'type': self._use_type(m.type)}, m.ifcond) - for m in variants.variants]}, + for m in alternatives.variants]}, ifcond, features ) =20 diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 65c82dd4f1..2b67992aee 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -236,7 +236,7 @@ def visit_alternate_type( info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaAlternatives, + alternatives: QAPISchemaAlternatives, ) -> None: pass =20 diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 0abb78f3a8..69f5f6ffd0 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -371,11 +371,11 @@ def visit_alternate_type(self, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaAlternatives) -> None: + alternatives: QAPISchemaAlternatives) -> None: with ifcontext(ifcond, self._genh): self._genh.preamble_add(gen_fwd_object_or_array(name)) self._genh.add(gen_object(name, ifcond, None, - [variants.tag_member], variants)) + [alternatives.tag_member], alternatives)) with ifcontext(ifcond, self._genh, self._genc): self._gen_type_cleanup(name) =20 diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index fbae5f3e4e..e766acaac9 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -223,7 +223,8 @@ def gen_visit_enum(name: str) -> str: c_name=3Dc_name(name)) =20 =20 -def gen_visit_alternate(name: str, variants: QAPISchemaAlternatives) -> st= r: +def gen_visit_alternate(name: str, + alternatives: QAPISchemaAlternatives) -> str: ret =3D mcgen(''' =20 bool visit_type_%(c_name)s(Visitor *v, const char *name, @@ -245,7 +246,7 @@ def gen_visit_alternate(name: str, variants: QAPISchema= Alternatives) -> str: ''', c_name=3Dc_name(name)) =20 - for var in variants.variants: + for var in alternatives.variants: ret +=3D var.ifcond.gen_if() ret +=3D mcgen(''' case %(case)s: @@ -414,10 +415,10 @@ def visit_alternate_type(self, info: Optional[QAPISourceInfo], ifcond: QAPISchemaIfCond, features: List[QAPISchemaFeature], - variants: QAPISchemaAlternatives) -> None: + alternatives: QAPISchemaAlternatives) -> None: with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_visit_decl(name)) - self._genc.add(gen_visit_alternate(name, variants)) + self._genc.add(gen_visit_alternate(name, alternatives)) =20 =20 def gen_visit(schema: QAPISchema, diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 7c67ad8d9b..7e3f9f4aa1 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -61,9 +61,10 @@ def visit_object_type(self, name, info, ifcond, features, self._print_if(ifcond) self._print_features(features) =20 - def visit_alternate_type(self, name, info, ifcond, features, variants): + def visit_alternate_type(self, name, info, ifcond, features, + alternatives): print('alternate %s' % name) - self._print_variants(variants) + self._print_variants(alternatives) self._print_if(ifcond) self._print_features(features) =20 --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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 From nobody Mon Nov 25 11:20:19 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=1714993451; cv=none; d=zohomail.com; s=zohoarc; b=QIYmffykHiB0iiTOewyJnhkYbeX1Yrbji5TqxBx7uv/m1PeHpuw7a7yb/kRCOy2ZdJ6+J4yzQ8L/HkgdAxwR5hwPIeheIGhqawHWf3LeQw+3IV0tXACAgfEOsw59MxX7lEbt5I8aB8XMjn2JTaWxeoxS/8vocZpqyuYmGsnk1ks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993451; 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=RQjvMBOGkZJAZ6BlA2e5WXO5nMwzNQx1Bsbo/JjuGDE=; b=MK6e8JOTQh/sB4F91CS2AU7IgGQY7GGFYsPAyAbJKdBXcRLnVrHWrVWAo5HkJaoo7UP6wtnjIawu9ErAIwVhHsD/nhsRWAmom4sN9+y0l/y+AAdN+TDbp5hVGOiQXGYZTZT/3R+teu1entUu8BHO3h2AOHrUek07oeibRgnD7I8= 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 1714993451092988.8871008722798; Mon, 6 May 2024 04:04:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7i-0002oV-DT; Mon, 06 May 2024 07:03:10 -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 1s3w7a-0002lH-GW for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7X-0003ev-6x for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:02 -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-92-mUvFnuv8N3WVHTzmyL9Eyw-1; Mon, 06 May 2024 07:02:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 C2D5818065B3; 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 A322A49102; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4D53921E5D2A; 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=RQjvMBOGkZJAZ6BlA2e5WXO5nMwzNQx1Bsbo/JjuGDE=; b=OcvAlFW9/87UvLDaWvgABTuyA5bcworkHuAMvZ0i6omaZSSO5nJZxK4d00+CHX7TopGV7m 3F+Ywhkg5x5g1WNq7PJ8wyvtM5MRcQk8nLC/i+23uKiVbSGI++6/SdGv1xBsfJSR9hSWXG Y9crC+RlhDMK1ymTmJloBtfZJcjvZr8= X-MC-Unique: mUvFnuv8N3WVHTzmyL9Eyw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 4/7] qapidoc: Generate default Returns WIP Date: Mon, 6 May 2024 13:02:48 +0200 Message-ID: <20240506110254.3965097-9-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.1 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.133.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: 1714993453773100001 Content-Type: text/plain; charset="utf-8" Affected: x-debug-query-block-graph query-tpm query-dirty-rate query-vcpu-dirty-limit query-vm-generation-id query-memory-size-summary query-memory-devices query-acpi-ospm-status query-stats-schemas --- docs/sphinx/qapidoc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index 24bf1d9a90..35627ca741 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -251,9 +251,14 @@ def _nodes_for_features(self, doc): return [section] =20 def _nodes_for_returns(self, doc, ret_type): - if doc.returns: + assert not doc.returns or ret_type + if ret_type: section =3D self._make_section('Returns') - self._parse_text_into_node(doc.returns.text, section) + if doc.returns: + self._parse_text_into_node(doc.returns.text, section) + else: + section +=3D nodes.paragraph( + '', '', nodes.Text(ret_type.doc_type())) return [section] return [] =20 --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993533; cv=none; d=zohomail.com; s=zohoarc; b=kap7JCGeZAN85uA3qYW6g34GTN1sxwxS9YSQ1fmidCXvejHoDKKU1Du8uIreFOb3FkpnZSahrQz1VX47c2z/pFBXZKbI6Z/Gr2CHhq+71Z7R4TPDs2sYpb9gHoB2beNmG5knvxoiXkv1Rzr99NLusKAmSp1x6fdDHEGX0lUQlQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993533; 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=J8RSpZZLrRS8WOQQUR42C1CPkY6YivCRHFnCrRmGr9E=; b=TFsVG/SVN8da7cDmsoHHmaUTETEyHUF9H5D6k8IWjFCcAHBr7NeEK6V8g1zoiHqg9SkDLv4GEFGLfHBo4LyH9Dsq1cIDqpZthDDofRcg2cNTyZUAiiklWGzWjQgcxU8ZkAnt2mOKslEmjcMtoE+0/KSi+Wve5We54YJfrZ8iaWw= 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 1714993533725766.4490421580856; Mon, 6 May 2024 04:05:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7p-00034M-1R; Mon, 06 May 2024 07:03:17 -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 1s3w7h-0002p1-8A 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 1s3w7a-0003ff-0G for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:08 -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-531-ogNOqIK0OZuLcqG4sVsRLQ-1; Mon, 06 May 2024 07:02:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 96B0718065AE; 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 5864CEC683; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4A80021E5D29; 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=1714993380; 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=J8RSpZZLrRS8WOQQUR42C1CPkY6YivCRHFnCrRmGr9E=; b=DiHgB3oYDhGmADNBtiCB2sh4KRtpDR2YYUQKE9jd9h4UC8t3zILNLFPBmtmx8cUG5VBVQl uAfPSDBeQ3LMFfhk2PazE/akahcP7i5sPABKhk0VL4wBD5PjtLZqK3It4QE+I8JUmP1Uks KBAOoJTImp6gHpYlJOmF7buooDYEdy0= X-MC-Unique: ogNOqIK0OZuLcqG4sVsRLQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PULL 4/7] qapi: Rename QAPISchemaObjectType.variants to .branches Date: Mon, 6 May 2024 13:02:47 +0200 Message-ID: <20240506110254.3965097-8-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.5 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: 1714993536028100003 Content-Type: text/plain; charset="utf-8" A previous commit narrowed the type of QAPISchemaObjectType.variants from QAPISchemaVariants to QAPISchemaBranches. Rename it to .branches. Same for .__init__() parameter @variants. Signed-off-by: Markus Armbruster --- scripts/qapi/commands.py | 2 +- scripts/qapi/events.py | 2 +- scripts/qapi/gen.py | 2 +- scripts/qapi/schema.py | 36 ++++++++++++++++++------------------ scripts/qapi/types.py | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index d1fdf4182c..79951a841f 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -64,7 +64,7 @@ def gen_call(name: str, assert arg_type argstr =3D '&arg, ' elif arg_type: - assert not arg_type.variants + assert not arg_type.branches for memb in arg_type.members: assert not memb.ifcond.is_present() if memb.need_has(): diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 3cf01e96b6..d1f639981a 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -51,7 +51,7 @@ def gen_param_var(typ: QAPISchemaObjectType) -> str: =20 Initialize it with the function arguments defined in `gen_event_send`. """ - assert not typ.variants + assert not typ.branches ret =3D mcgen(''' %(c_name)s param =3D { ''', diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 5412716617..6a8abe0041 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -118,7 +118,7 @@ def build_params(arg_type: Optional[QAPISchemaObjectTyp= e], ret +=3D '%s arg' % arg_type.c_param_type() sep =3D ', ' elif arg_type: - assert not arg_type.variants + assert not arg_type.branches for memb in arg_type.members: assert not memb.ifcond.is_present() ret +=3D sep diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 2b67992aee..c9ff794d0c 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -524,20 +524,20 @@ def __init__( features: Optional[List[QAPISchemaFeature]], base: Optional[str], local_members: List[QAPISchemaObjectTypeMember], - variants: Optional[QAPISchemaBranches], + branches: Optional[QAPISchemaBranches], ): - # struct has local_members, optional base, and no variants - # union has base, variants, and no local_members + # struct has local_members, optional base, and no branches + # union has base, branches, and no local_members super().__init__(name, info, doc, ifcond, features) - self.meta =3D 'union' if variants else 'struct' + self.meta =3D 'union' if branches else 'struct' for m in local_members: m.set_defined_in(name) - if variants is not None: - variants.set_defined_in(name) + if branches is not None: + branches.set_defined_in(name) self._base_name =3D base self.base =3D None self.local_members =3D local_members - self.variants =3D variants + self.branches =3D branches self.members: List[QAPISchemaObjectTypeMember] self._check_complete =3D False =20 @@ -561,7 +561,7 @@ def check(self, schema: QAPISchema) -> None: self.base =3D schema.resolve_type(self._base_name, self.info, "'base'") if (not isinstance(self.base, QAPISchemaObjectType) - or self.base.variants): + or self.base.branches): raise QAPISemError( self.info, "'base' requires a struct type, %s isn't" @@ -577,9 +577,9 @@ def check(self, schema: QAPISchema) -> None: # Cast down to the subtype. members =3D cast(List[QAPISchemaObjectTypeMember], list(seen.value= s())) =20 - if self.variants: - self.variants.check(schema, seen) - self.variants.check_clash(self.info, seen) + if self.branches: + self.branches.check(schema, seen) + self.branches.check_clash(self.info, seen) =20 self.members =3D members self._check_complete =3D True # mark completed @@ -595,8 +595,8 @@ def check_clash( assert self._checked for m in self.members: m.check_clash(info, seen) - if self.variants: - self.variants.check_clash(info, seen) + if self.branches: + self.branches.check_clash(info, seen) =20 def connect_doc(self, doc: Optional[QAPIDoc] =3D None) -> None: super().connect_doc(doc) @@ -612,7 +612,7 @@ def is_implicit(self) -> bool: return self.name.startswith('q_') =20 def is_empty(self) -> bool: - return not self.members and not self.variants + return not self.members and not self.branches =20 def has_conditional_members(self) -> bool: return any(m.ifcond.is_present() for m in self.members) @@ -635,10 +635,10 @@ def visit(self, visitor: QAPISchemaVisitor) -> None: super().visit(visitor) visitor.visit_object_type( self.name, self.info, self.ifcond, self.features, - self.base, self.local_members, self.variants) + self.base, self.local_members, self.branches) visitor.visit_object_type_flat( self.name, self.info, self.ifcond, self.features, - self.members, self.variants) + self.members, self.branches) =20 =20 class QAPISchemaAlternateType(QAPISchemaType): @@ -1035,7 +1035,7 @@ def check(self, schema: QAPISchema) -> None: "command's 'data' cannot take %s" % arg_type.describe()) self.arg_type =3D arg_type - if self.arg_type.variants and not self.boxed: + if self.arg_type.branches and not self.boxed: raise QAPISemError( self.info, "command's 'data' can take %s only with 'boxed': true" @@ -1103,7 +1103,7 @@ def check(self, schema: QAPISchema) -> None: "event's 'data' cannot take %s" % typ.describe()) self.arg_type =3D typ - if self.arg_type.variants and not self.boxed: + if self.arg_type.branches and not self.boxed: raise QAPISemError( self.info, "event's 'data' can take %s only with 'boxed': true" diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 69f5f6ffd0..0dd0b00ada 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -171,7 +171,7 @@ def gen_object(name: str, ifcond: QAPISchemaIfCond, if not isinstance(obj, QAPISchemaObjectType): continue ret +=3D gen_object(obj.name, obj.ifcond, obj.base, - obj.local_members, obj.variants) + obj.local_members, obj.branches) =20 ret +=3D mcgen(''' =20 --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993563; cv=none; d=zohomail.com; s=zohoarc; b=Vu9erM0g3CYgVUoPL7FJVtoqF2OxnGGxIDSEJaePO+lTDsDjSnMY+8BhPDIDUNspgvhdyPtBhtqnFvIizWaQjxxO3xdq8HNEy4fi7Bm7USD34kFgWZebXDi0NCGWfFDRYYq/sZnJMVpLg1w16rPSW+R9bg/gOswds3NEO4/sPVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993563; 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=et+/ntzRn8KKOw7HyPbGWlfdTlKfnZsjoA4xRTtetQg=; b=OkBPYR0VMwvxbonrKz3D1frnWwRwh3+Em+MfxfdPhM8lIqQPQraJCvS+IuPIE6ce2WVAv60F+V2XFEocg4ZwlNr1AeUlRw5CQSz0O0iftOr7nEZzN8az6DbBk6jerhRMSpSlvy6dAGlu9oNkH/mIacC0sYJLTITuQYkZ3cdLOcY= 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 1714993563236761.0972316696057; Mon, 6 May 2024 04:06:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7i-0002ps-TM; Mon, 06 May 2024 07:03:11 -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 1s3w7d-0002nb-BJ for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7X-0003en-3Z for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:05 -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-558-crcPYp2FMLaeCxuZVTs6yQ-1; Mon, 06 May 2024 07:02:57 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 AE13080B70A; 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 57DDA492BC7; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5060321E5D2B; 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=et+/ntzRn8KKOw7HyPbGWlfdTlKfnZsjoA4xRTtetQg=; b=ffRJwpzijaIozsgXXoswl4ChBAn8F7K00yhSax8+uTFBq548Q1hs0BrMNBkRLVCkMC4W2h lsulV2YH51Wz6yO0cCW6Dmnpb9t8KvkxGDhxfpWAGGlHyG6BvgB0EkdFq5uPV3KDU/8m2M UbRMCz2PtaNZqBQ7vM9uW8uXLf9ASbk= X-MC-Unique: crcPYp2FMLaeCxuZVTs6yQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 5/7] qapi: Drop "Returns" section where default is fine WIP Date: Mon, 6 May 2024 13:02:49 +0200 Message-ID: <20240506110254.3965097-10-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.10 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.133.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: 1714993565416100006 Content-Type: text/plain; charset="utf-8" --- qapi/audio.json | 2 -- qapi/block-core.json | 21 ++++----------------- qapi/block-export.json | 2 +- qapi/block.json | 3 --- qapi/char.json | 10 +--------- qapi/control.json | 5 ----- qapi/cryptodev.json | 2 -- qapi/dump.json | 5 ----- qapi/job.json | 2 -- qapi/machine-target.json | 6 ++---- qapi/machine.json | 36 ------------------------------------ qapi/migration.json | 12 ------------ qapi/misc-target.json | 16 ---------------- qapi/misc.json | 16 ++-------------- qapi/pci.json | 2 +- qapi/qdev.json | 3 --- qapi/qom.json | 8 -------- qapi/replay.json | 2 -- qapi/rocker.json | 8 -------- qapi/run-state.json | 2 -- qapi/stats.json | 2 +- qapi/tpm.json | 4 ---- qapi/trace.json | 5 ++--- qapi/ui.json | 10 ---------- qapi/virtio.json | 10 ---------- qapi/yank.json | 2 -- 26 files changed, 14 insertions(+), 182 deletions(-) diff --git a/qapi/audio.json b/qapi/audio.json index 519697c0cd..bf11ca6d0a 100644 --- a/qapi/audio.json +++ b/qapi/audio.json @@ -515,8 +515,6 @@ # # Returns information about audiodev configuration # -# Returns: array of @Audiodev -# # Since: 8.0 ## { 'command': 'query-audiodevs', diff --git a/qapi/block-core.json b/qapi/block-core.json index 746d1694c2..fab1a45365 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -757,10 +757,8 @@ ## # @query-block: # -# Get a list of BlockInfo for all virtual block devices. -# -# Returns: a list of @BlockInfo describing each virtual block device. -# Filter nodes that were created implicitly are skipped over. +# Get a list of BlockInfo for all virtual block devices. Filter nodes +# that were created implicitly are skipped over. # # Since: 0.14 # @@ -1164,8 +1162,6 @@ # that were created implicitly are skipped over in this mode. # (Since 2.3) # -# Returns: A list of @BlockStats for each virtual block devices. -# # Since: 0.14 # # Example: @@ -1434,9 +1430,8 @@ ## # @query-block-jobs: # -# Return information about long-running block device operations. -# -# Returns: a list of @BlockJobInfo for each active block job +# Return information about active, long-running block device +# operations ("block jobs"). # # Since: 1.1 ## @@ -1941,8 +1936,6 @@ # @flat: Omit the nested data about backing image ("backing-image" # key) if true. Default is false (Since 5.0) # -# Returns: the list of BlockDeviceInfo -# # Since: 2.0 # # Example: @@ -2456,9 +2449,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: -# BlockDirtyBitmapSha256 -# # Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found or if hashing has failed, GenericError @@ -6100,9 +6090,6 @@ # # @name: optional the snapshot's name to be deleted # -# Returns: -# SnapshotInfo -# # Errors: # - If @device is not a valid block device, GenericError # - If snapshot not found, GenericError diff --git a/qapi/block-export.json b/qapi/block-export.json index 3919a2d5b9..89a277db80 100644 --- a/qapi/block-export.json +++ b/qapi/block-export.json @@ -464,7 +464,7 @@ ## # @query-block-exports: # -# Returns: A list of BlockExportInfo describing all block exports +# Query block export information. # # Since: 5.2 ## diff --git a/qapi/block.json b/qapi/block.json index 5de99fe09d..97e2ccc4f1 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -86,9 +86,6 @@ # Returns a list of information about each persistent reservation # manager. # -# Returns: a list of @PRManagerInfo for each persistent reservation -# manager -# # Since: 3.0 ## { 'command': 'query-pr-managers', 'returns': ['PRManagerInfo'], diff --git a/qapi/char.json b/qapi/char.json index 777dde55d9..87e1523946 100644 --- a/qapi/char.json +++ b/qapi/char.json @@ -36,8 +36,6 @@ # # Returns information about current character devices. # -# Returns: a list of @ChardevInfo -# # Since: 0.14 # # Example: @@ -82,8 +80,6 @@ # # Returns information about character device backends. # -# Returns: a list of @ChardevBackendInfo -# # Since: 2.0 # # Example: @@ -173,7 +169,7 @@ # - The return value is always Unicode regardless of format, like # any other string. # -# Returns: data read from the device +# Returns: data read from the device (string) # # Since: 1.4 # @@ -695,8 +691,6 @@ # # @backend: backend type and parameters # -# Returns: ChardevReturn. -# # Since: 1.4 # # Examples: @@ -731,8 +725,6 @@ # # @backend: new backend type and parameters # -# Returns: ChardevReturn. -# # Since: 2.10 # # Examples: diff --git a/qapi/control.json b/qapi/control.json index 6bdbf077c2..39510430fc 100644 --- a/qapi/control.json +++ b/qapi/control.json @@ -93,9 +93,6 @@ # # Returns the current version of QEMU. # -# Returns: A @VersionInfo object describing the current version of -# QEMU. -# # Since: 0.14 # # Example: @@ -131,8 +128,6 @@ # # Return a list of supported QMP commands by this server # -# Returns: A list of @CommandInfo for all supported commands -# # Since: 0.14 # # Example: diff --git a/qapi/cryptodev.json b/qapi/cryptodev.json index 68289f4984..6707aa506f 100644 --- a/qapi/cryptodev.json +++ b/qapi/cryptodev.json @@ -89,8 +89,6 @@ # # Returns information about current crypto devices. # -# Returns: a list of @QCryptodevInfo -# # Since: 8.0 ## { 'command': 'query-cryptodev', 'returns': ['QCryptodevInfo']} diff --git a/qapi/dump.json b/qapi/dump.json index 2fa9504d86..ec18387c71 100644 --- a/qapi/dump.json +++ b/qapi/dump.json @@ -146,8 +146,6 @@ # # Query latest dump status. # -# Returns: A @DumpStatus object showing the dump status. -# # Since: 2.6 # # Example: @@ -197,9 +195,6 @@ # # Returns the available formats for dump-guest-memory # -# Returns: A @DumpGuestMemoryCapability object listing available -# formats for dump-guest-memory -# # Since: 2.0 # # Example: diff --git a/qapi/job.json b/qapi/job.json index b3957207a4..4f22edde56 100644 --- a/qapi/job.json +++ b/qapi/job.json @@ -269,8 +269,6 @@ # # Return information about jobs. # -# Returns: a list with a @JobInfo for each active job -# # Since: 3.0 ## { 'command': 'query-jobs', 'returns': ['JobInfo'] } diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 29e695aa06..4ef7ef7b43 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -380,8 +380,6 @@ # # Return a list of supported virtual CPU definitions # -# Returns: a list of CpuDefinitionInfo -# # Since: 1.2 ## { 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], @@ -499,12 +497,12 @@ ## # @query-s390x-cpu-polarization: # +# Return the machine's CPU polarization. +# # Features: # # @unstable: This command is experimental. # -# Returns: the machine's CPU polarization -# # Since: 8.2 ## { 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationIn= fo', diff --git a/qapi/machine.json b/qapi/machine.json index bce6e1bbc4..b8f4c83914 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -100,8 +100,6 @@ # # Returns information about all virtual CPUs. # -# Returns: list of @CpuInfoFast -# # Since: 2.12 # # Example: @@ -217,8 +215,6 @@ # # @unstable: Argument @compat-props is experimental. # -# Returns: a list of MachineInfo -# # Since: 1.2 # # Example: @@ -267,8 +263,6 @@ # # Return information on the current virtual machine. # -# Returns: CurrentMachineParams -# # Since: 4.0 ## { 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' } @@ -290,8 +284,6 @@ # # Return information about the target for this QEMU # -# Returns: TargetInfo -# # Since: 1.2 ## { 'command': 'query-target', 'returns': 'TargetInfo' } @@ -315,8 +307,6 @@ # # Query the guest UUID information. # -# Returns: The @UuidInfo for the guest -# # Since: 0.14 # # Example: @@ -468,8 +458,6 @@ # # Returns information about KVM acceleration # -# Returns: @KvmInfo -# # Since: 0.14 # # Example: @@ -924,8 +912,6 @@ # # Returns information for all memory backends. # -# Returns: a list of @Memdev. -# # Since: 2.1 # # Example: @@ -1042,8 +1028,6 @@ # # TODO: Better documentation; currently there is none. # -# Returns: a list of HotpluggableCPU objects. -# # Since: 2.7 # # Examples: @@ -1155,9 +1139,6 @@ # # Return information about the balloon device. # -# Returns: -# @BalloonInfo -# # Errors: # - If the balloon driver is enabled but not functional because # the KVM kernel module cannot support it, KVMMissingCap @@ -1221,9 +1202,6 @@ # Returns the hv-balloon driver data contained in the last received # "STATUS" message from the guest. # -# Returns: -# @HvBalloonInfo -# # Errors: # - If no hv-balloon device is present, guest memory status # reporting is not enabled or no guest memory status report @@ -1729,8 +1707,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: interrupt statistics -# # Since: 6.2 ## { 'command': 'x-query-irq', @@ -1746,8 +1722,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: TCG compiler statistics -# # Since: 6.2 ## { 'command': 'x-query-jit', @@ -1764,8 +1738,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: topology information -# # Since: 6.2 ## { 'command': 'x-query-numa', @@ -1781,8 +1753,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: TCG opcode counters -# # Since: 6.2 ## { 'command': 'x-query-opcount', @@ -1799,8 +1769,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: system ramblock information -# # Since: 6.2 ## { 'command': 'x-query-ramblock', @@ -1816,8 +1784,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: registered ROMs -# # Since: 6.2 ## { 'command': 'x-query-roms', @@ -1833,8 +1799,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: USB device information -# # Since: 6.2 ## { 'command': 'x-query-usb', diff --git a/qapi/migration.json b/qapi/migration.json index 8c65b90328..e22645253c 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -305,8 +305,6 @@ # status and if block migration is active another one with block # migration status. # -# Returns: @MigrationInfo -# # Since: 0.14 # # Examples: @@ -597,8 +595,6 @@ # # Returns information about the current migration capabilities status # -# Returns: @MigrationCapabilityStatus -# # Since: 1.2 # # Example: @@ -1412,8 +1408,6 @@ # # Returns information about the current migration parameters # -# Returns: @MigrationParameters -# # Since: 2.4 # # Example: @@ -1997,8 +1991,6 @@ # # Query replication status while the vm is running. # -# Returns: A @ReplicationStatus object showing the status. -# # Example: # # -> { "execute": "query-xen-replication-status" } @@ -2051,8 +2043,6 @@ # # Query COLO status while the vm is running. # -# Returns: A @COLOStatus object showing the status. -# # Example: # # -> { "execute": "query-colo-status" } @@ -2419,8 +2409,6 @@ # # Returns information of migration threads # -# Returns: @MigrationThreadInfo -# # Since: 7.2 ## { 'command': 'query-migrationthreads', diff --git a/qapi/misc-target.json b/qapi/misc-target.json index 4e0a6492a9..9edb7c1ade 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -85,8 +85,6 @@ # # Returns information about SEV # -# Returns: @SevInfo -# # Since: 2.12 # # Example: @@ -116,8 +114,6 @@ # # Query the SEV guest launch information. # -# Returns: The @SevLaunchMeasureInfo for the guest -# # Since: 2.12 # # Example: @@ -161,8 +157,6 @@ # This command is used to get the SEV capabilities, and is supported # on AMD X86 platforms only. # -# Returns: SevCapability objects. -# # Since: 2.12 # # Example: @@ -215,8 +209,6 @@ # @mnonce: a random 16 bytes value encoded in base64 (it will be # included in report) # -# Returns: SevAttestationReport objects. -# # Since: 6.1 # # Example: @@ -280,8 +272,6 @@ # This command is ARM-only. It will return a list of GICCapability # objects that describe its capability bits. # -# Returns: a list of GICCapability objects. -# # Since: 2.6 # # Example: @@ -338,8 +328,6 @@ # # Returns information about SGX # -# Returns: @SGXInfo -# # Since: 6.2 # # Example: @@ -357,8 +345,6 @@ # # Returns information from host SGX capabilities # -# Returns: @SGXInfo -# # Since: 6.2 # # Example: @@ -432,8 +418,6 @@ # # Query the Xen event channels opened by the guest. # -# Returns: list of open event channel ports. -# # Since: 8.0 # # Example: diff --git a/qapi/misc.json b/qapi/misc.json index ec30e5c570..ab2d234973 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -56,8 +56,6 @@ # # Return the name information of a guest. # -# Returns: @NameInfo of the guest -# # Since: 0.14 # # Example: @@ -101,14 +99,12 @@ ## # @query-iothreads: # -# Returns a list of information about each iothread. +# Returns information about each iothread. # # Note: this list excludes the QEMU main loop thread, which is not # declared using the -object iothread command-line option. It is # always the main thread of the process. # -# Returns: a list of @IOThreadInfo for each iothread -# # Since: 2.0 # # Example: @@ -331,9 +327,6 @@ # # @opaque: A free-form string that can be used to describe the fd. # -# Returns: -# @AddfdInfo -# # Errors: # - If file descriptor was not received, GenericError # - If @fdset-id is a negative value, GenericError @@ -415,8 +408,6 @@ # # Return information describing all fd sets. # -# Returns: A list of @FdsetInfo -# # Since: 1.2 # # Note: The list of fd sets is shared by all monitor connections. @@ -514,10 +505,7 @@ # # Query command line option schema. # -# @option: option name -# -# Returns: list of @CommandLineOptionInfo for all options (or for the -# given @option). +# @option: limit query to just @option # # Errors: # - if the given @option doesn't exist diff --git a/qapi/pci.json b/qapi/pci.json index 08bf695863..6355411373 100644 --- a/qapi/pci.json +++ b/qapi/pci.json @@ -178,7 +178,7 @@ # Returns: a list of @PciInfo for each PCI bus. Each bus is # represented by a json-object, which has a key with a json-array # of all PCI devices attached to it. Each device is represented -# by a json-object. +# by a json-object. TODO check # # Since: 0.14 # diff --git a/qapi/qdev.json b/qapi/qdev.json index facaa0bc6a..798dc831d5 100644 --- a/qapi/qdev.json +++ b/qapi/qdev.json @@ -17,9 +17,6 @@ # # @typename: the type name of a device # -# Returns: a list of ObjectPropertyInfo describing a devices -# properties -# # Note: objects can create properties at runtime, for example to # describe links between different devices and/or objects. These # properties are not included in the output of this command. diff --git a/qapi/qom.json b/qapi/qom.json index 38dde6d785..d1dc216474 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -54,9 +54,6 @@ # @path: the path within the object model. See @qom-get for a # description of this parameter. # -# Returns: a list of @ObjectPropertyInfo that describe the properties -# of the object. -# # Since: 1.2 # # Example: @@ -178,9 +175,6 @@ # # @abstract: if true, include abstract types in the results # -# Returns: a list of @ObjectTypeInfo or an empty list if no results -# are found -# # Since: 1.1 ## { 'command': 'qom-list-types', @@ -199,8 +193,6 @@ # describe links between different devices and/or objects. These # properties are not included in the output of this command. # -# Returns: a list of ObjectPropertyInfo describing object properties -# # Since: 2.12 ## { 'command': 'qom-list-properties', diff --git a/qapi/replay.json b/qapi/replay.json index d3559f9c8f..e66823bf03 100644 --- a/qapi/replay.json +++ b/qapi/replay.json @@ -50,8 +50,6 @@ # instruction count which may be used for @replay-break and # @replay-seek commands. # -# Returns: record/replay information. -# # Since: 5.2 # # Example: diff --git a/qapi/rocker.json b/qapi/rocker.json index 5635cf174f..03c42713b4 100644 --- a/qapi/rocker.json +++ b/qapi/rocker.json @@ -26,8 +26,6 @@ # # Return rocker switch information. # -# Returns: @Rocker information -# # Since: 2.4 # # Example: @@ -94,8 +92,6 @@ # # Return rocker switch port information. # -# Returns: a list of @RockerPort information -# # Since: 2.4 # # Example: @@ -236,8 +232,6 @@ # @tbl-id: flow table ID. If tbl-id is not specified, returns flow # information for all tables. # -# Returns: rocker OF-DPA flow information -# # Since: 2.4 # # Example: @@ -311,8 +305,6 @@ # @type: group type. If type is not specified, returns group # information for all group types. # -# Returns: rocker OF-DPA group information -# # Since: 2.4 # # Example: diff --git a/qapi/run-state.json b/qapi/run-state.json index f8773f23b2..37c30ee3a2 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -119,8 +119,6 @@ # # Query the run status of the VM # -# Returns: @StatusInfo reflecting the VM -# # Since: 0.14 # # Example: diff --git a/qapi/stats.json b/qapi/stats.json index 578b52c7ef..0753c11aa2 100644 --- a/qapi/stats.json +++ b/qapi/stats.json @@ -187,7 +187,7 @@ # to return statistics about. # # Returns: a list of StatsResult, one for each provider and object -# (e.g., for each vCPU). +# (e.g., for each vCPU). TODO check # # Since: 7.1 ## diff --git a/qapi/tpm.json b/qapi/tpm.json index 1577b5c259..6002a17f0e 100644 --- a/qapi/tpm.json +++ b/qapi/tpm.json @@ -27,8 +27,6 @@ # # Return a list of supported TPM models # -# Returns: a list of TpmModel -# # Since: 1.5 # # Example: @@ -58,8 +56,6 @@ # # Return a list of supported TPM types # -# Returns: a list of TpmType -# # Since: 1.5 # # Example: diff --git a/qapi/trace.json b/qapi/trace.json index 043d12f83e..27a98fc9d9 100644 --- a/qapi/trace.json +++ b/qapi/trace.json @@ -52,7 +52,8 @@ # # Query the state of events. # -# @name: Event name pattern (case-sensitive glob). +# @name: Limit the query to events with a name matching @name +# (case-sensitive glob). # # @vcpu: The vCPU to query (since 2.7). # @@ -60,8 +61,6 @@ # # @deprecated: Member @vcpu is deprecated, and always ignored. # -# Returns: a list of @TraceEventInfo for the matching events -# # Since: 2.2 # # Example: diff --git a/qapi/ui.json b/qapi/ui.json index f610bce118..2b7f0b8401 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -327,8 +327,6 @@ # # Returns information about the current SPICE server # -# Returns: @SpiceInfo -# # Since: 0.14 # # Example: @@ -658,8 +656,6 @@ # # Returns information about the current VNC server # -# Returns: @VncInfo -# # Since: 0.14 # # Example: @@ -689,8 +685,6 @@ # # Returns a list of vnc servers. The list can be empty. # -# Returns: a list of @VncInfo2 -# # Since: 2.3 ## { 'command': 'query-vnc-servers', 'returns': ['VncInfo2'], @@ -824,8 +818,6 @@ # # Returns information about each active mouse device # -# Returns: a list of @MouseInfo for each device -# # Since: 0.14 # # Example: @@ -1564,8 +1556,6 @@ # # Returns information about display configuration # -# Returns: @DisplayOptions -# # Since: 3.1 ## { 'command': 'query-display-options', diff --git a/qapi/virtio.json b/qapi/virtio.json index 74fc27c702..476a2a4192 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -30,8 +30,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: List of gathered VirtIODevices -# # Since: 7.2 # # Example: @@ -199,8 +197,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: VirtioStatus of the virtio device -# # Since: 7.2 # # Examples: @@ -557,8 +553,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: VirtQueueStatus of the VirtQueue -# # Notes: last_avail_idx will not be displayed in the case where the # selected VirtIODevice has a running vhost device and the # VirtIODevice VirtQueue index (queue) does not exist for the @@ -686,8 +680,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: VirtVhostQueueStatus of the vhost_virtqueue -# # Since: 7.2 # # Examples: @@ -835,8 +827,6 @@ # # @unstable: This command is meant for debugging. # -# Returns: VirtioQueueElement information -# # Since: 7.2 # # Examples: diff --git a/qapi/yank.json b/qapi/yank.json index 89f2f4d199..82e3515308 100644 --- a/qapi/yank.json +++ b/qapi/yank.json @@ -102,8 +102,6 @@ # # Query yank instances. See @YankInstance for more information. # -# Returns: list of @YankInstance -# # Example: # # -> { "execute": "query-yank" } --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993649; cv=none; d=zohomail.com; s=zohoarc; b=ZgC/4gC0zsE4vwXBC1P5Kb8raDhyF5B3MfITHYB5B7wR5bPspj0tgMGDtzbJHgQXV6Eh4IyLCb0NqUe2gyKj3YlQZo+fkCylDFmQNYof52A5CBdBLI4bfMhMRvP2aMeYRL3tKJdmrgjnOSxgCBmHrr+2L5c4m4gfFFQe5VJyFdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993649; 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=y8Xv4sKeuJXrReP+xdm8YZZkzbF0yY+MYu1X3PH04IU=; b=Z8+VwoN1p2LsQr6hNUHYp1LYkqK0WI3beLaQPtyqzRy2OboF5THE6FLvJfTOd+nUS9/v0lqUdcg0AotJWivQ2h41KQBgsWHaB7GM/7lXEUKFy5pQq40eYC/WaIeMX0FlYc5RdzgluVdpPdGkaZeOuMEx2EeXtgvrQp95FNXtQoQ= 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 1714993649255323.7351919312273; Mon, 6 May 2024 04:07:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7l-0002xQ-4N; Mon, 06 May 2024 07:03:13 -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-0002oq-PA for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7Y-0003fP-QE for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:07 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-mDo0nzLiPQWyJKsAFFKH_g-1; Mon, 06 May 2024 07:02:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 79BE929AA394; 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 584E6AC6B; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 52FC021EE971; 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=1714993380; 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=y8Xv4sKeuJXrReP+xdm8YZZkzbF0yY+MYu1X3PH04IU=; b=XsNX68Mcg+S5qwG/gj+mxnpCjf5j+487N+Pr1uU2mkGtS6YufmO81svzdG+rEmDa5+oJl9 An+lrZbLetMhpDL+vnMJ07uVOiw+voBxxmTOIx+cMiWC+PTEWqMEiIsVdKLyo+tbdyiUsM TO41gkv4N9IbUZipKqOUg0zEvWox3Ts= X-MC-Unique: mDo0nzLiPQWyJKsAFFKH_g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PULL 5/7] qapi: Rename QAPISchemaAlternateType.variants to .alternatives Date: Mon, 6 May 2024 13:02:50 +0200 Message-ID: <20240506110254.3965097-11-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.1 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.133.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: 1714993649606100001 Content-Type: text/plain; charset="utf-8" A previous commit narrowed the type of QAPISchemaAlternateType.variants from QAPISchemaVariants to QAPISchemaAlternatives. Rename it to .alternatives. Same for .__init__() parameter @variants. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index c9ff794d0c..9bdbfd52b2 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -651,25 +651,25 @@ def __init__( doc: Optional[QAPIDoc], ifcond: Optional[QAPISchemaIfCond], features: List[QAPISchemaFeature], - variants: QAPISchemaAlternatives, + alternatives: QAPISchemaAlternatives, ): super().__init__(name, info, doc, ifcond, features) - assert variants.tag_member - variants.set_defined_in(name) - variants.tag_member.set_defined_in(self.name) - self.variants =3D variants + assert alternatives.tag_member + alternatives.set_defined_in(name) + alternatives.tag_member.set_defined_in(self.name) + self.alternatives =3D alternatives =20 def check(self, schema: QAPISchema) -> None: super().check(schema) - self.variants.tag_member.check(schema) - # Not calling self.variants.check_clash(), because there's nothing - # to clash with - self.variants.check(schema, {}) + self.alternatives.tag_member.check(schema) + # Not calling self.alternatives.check_clash(), because there's + # nothing to clash with + self.alternatives.check(schema, {}) # Alternate branch names have no relation to the tag enum values; # so we have to check for potential name collisions ourselves. seen: Dict[str, QAPISchemaMember] =3D {} types_seen: Dict[str, str] =3D {} - for v in self.variants.variants: + for v in self.alternatives.variants: v.check_clash(self.info, seen) qtype =3D v.type.alternate_qtype() if not qtype: @@ -700,7 +700,7 @@ def check(self, schema: QAPISchema) -> None: def connect_doc(self, doc: Optional[QAPIDoc] =3D None) -> None: super().connect_doc(doc) doc =3D doc or self.doc - for v in self.variants.variants: + for v in self.alternatives.variants: v.connect_doc(doc) =20 def c_type(self) -> str: @@ -712,7 +712,8 @@ def json_type(self) -> str: def visit(self, visitor: QAPISchemaVisitor) -> None: super().visit(visitor) visitor.visit_alternate_type( - self.name, self.info, self.ifcond, self.features, self.variant= s) + self.name, self.info, self.ifcond, self.features, + self.alternatives) =20 =20 class QAPISchemaVariants: --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993530; cv=none; d=zohomail.com; s=zohoarc; b=TwQ2TivblPNPdrbAMCCiGriHR8420kUXj9mDa2DYBG+2XSzHdLax11ErtUtSOrdBb7O0j9fEz87Bho6dtGWiIDgUOZq9dWZdiikDVK5ZH5IEQ16vaRcwebP704SZzEgMtbfMgSMpFBrG7HMbwkAppWYebmGkBXm+Bv2+sTFclg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993530; 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=ra3UHb3T8zQv2R0nHBXpbhmQsfMIG/kMMF2WRy9zyZo=; b=RLwae8ef941Iwv8tqoAL9+jTELjg0zGnSVGyxnwlVfMtVYPaUHq7t2r7NgFES1ugW4yC4n+3hLn8kmXk9beEZys1/p4Adt5khV9Id09BBDsan/DLBXd5C7CIEv/yOVB+T5kVWcQL1NYdUolz83kflC06jhvQpIyvo9YxjBtgSX4= 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 1714993530220560.0786762940738; Mon, 6 May 2024 04:05:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7m-0002zq-Ac; Mon, 06 May 2024 07:03:14 -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-0002om-F5 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-0003ej-7y for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:07 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-_gKCVzV8NVepu-nMb8c9ew-1; Mon, 06 May 2024 07:02:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 96B0A1C0514B; 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 59983EC685; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5881D21D49C2; 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=ra3UHb3T8zQv2R0nHBXpbhmQsfMIG/kMMF2WRy9zyZo=; b=YjYFkAmZCkdsBYdFISl8N2U1XDxjLJipcjpS8PwvjJ6iKhzMmuSUpSBJxXy/gDwO7YKXW3 drLjDTALJKDnx+FvmwHLJTZ3BHrqhreHaWOJnGHIItw2NXqFoGnXr8pdQysObrhJEme+sF u5G5YYodFZguzY/KsRWR53Gp+f6g2no= X-MC-Unique: _gKCVzV8NVepu-nMb8c9ew-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 6/7] qga/qapi-schema: Drop "Returns" section where default is fine WIP Date: Mon, 6 May 2024 13:02:52 +0200 Message-ID: <20240506110254.3965097-13-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.5 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: 1714993531854100003 Content-Type: text/plain; charset="utf-8" --- qga/qapi-schema.json | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index d5af155007..fe41670ed2 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -194,8 +194,6 @@ # # Get some information about the guest agent. # -# Returns: @GuestAgentInfo -# # Since: 0.15.0 ## { 'command': 'guest-info', @@ -277,8 +275,6 @@ # @count: maximum number of bytes to read (default is 4KB, maximum is # 48MB) # -# Returns: @GuestFileRead -# # Since: 0.15.0 ## { 'command': 'guest-file-read', @@ -312,8 +308,6 @@ # @count: bytes to write (actual bytes, after base64-decode), default # is all content in buf-b64 buffer after base64 decoding # -# Returns: @GuestFileWrite -# # Since: 0.15.0 ## { 'command': 'guest-file-write', @@ -379,8 +373,6 @@ # # @whence: Symbolic or numeric code for interpreting offset # -# Returns: @GuestFileSeek -# # Since: 0.15.0 ## { 'command': 'guest-file-seek', @@ -419,9 +411,6 @@ # # Get guest fsfreeze state. # -# Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined -# below) -# # Note: This may fail to properly report the current state as a result # of some other guest processes having issued an fs freeze/thaw. # @@ -725,8 +714,6 @@ # # Get list of guest IP addresses, MAC addresses and netmasks. # -# Returns: List of GuestNetworkInterface -# # Since: 1.1 ## { 'command': 'guest-network-get-interfaces', @@ -760,6 +747,7 @@ # # Returns: The list of all VCPUs the guest knows about. Each VCPU is # put on the list exactly once, but their order is unspecified. +# TODO # # Since: 1.5 ## @@ -1009,6 +997,7 @@ # the physical disks. On Linux these are all root block devices # of non-zero size including e.g. removable devices, loop devices, # NBD, etc. +# TODO # # Since: 5.2 ## @@ -1045,6 +1034,7 @@ # The returned mountpoints may be specified to # @guest-fsfreeze-freeze-list. Network filesystems (such as CIFS # and NFS) are not listed. +# TODO # # Since: 2.2 ## @@ -1108,6 +1098,7 @@ # Returns: The list of all memory blocks the guest knows about. Each # memory block is put on the list exactly once, but their order is # unspecified. +# TODO # # Since: 2.3 ## @@ -1179,6 +1170,7 @@ # Note: it will return an empty list if the @mem-blks list was # empty on input, or there is an error, and in this case, guest # state will not be changed. +# TODO # # Since: 2.3 ## @@ -1203,8 +1195,6 @@ # # Get information relating to guest memory blocks. # -# Returns: @GuestMemoryBlockInfo -# # Since: 2.3 ## { 'command': 'guest-get-memory-block-info', @@ -1249,8 +1239,6 @@ # # @pid: pid returned from guest-exec # -# Returns: GuestExecStatus -# # Since: 2.5 ## { 'command': 'guest-exec-status', @@ -1322,8 +1310,6 @@ # @capture-output: bool flag to enable capture of stdout/stderr of # running process. Defaults to false. # -# Returns: PID -# # Since: 2.5 ## { 'command': 'guest-exec', @@ -1351,8 +1337,6 @@ # or even present in DNS or some other name service at all. It need # not even be unique on your local network or site, but usually it is. # -# Returns: the host name of the machine -# # Since: 2.10 ## { 'command': 'guest-get-host-name', @@ -1381,8 +1365,6 @@ # # Retrieves a list of currently active users on the VM. # -# Returns: A unique list of users. -# # Since: 2.10 ## { 'command': 'guest-get-users', @@ -1407,8 +1389,6 @@ # # Retrieves the timezone information from the guest. # -# Returns: A GuestTimezone dictionary. -# # Since: 2.10 ## { 'command': 'guest-get-timezone', @@ -1483,8 +1463,6 @@ # # Retrieve guest operating system information # -# Returns: @GuestOSInfo -# # Since: 2.10 ## { 'command': 'guest-get-osinfo', @@ -1550,8 +1528,6 @@ # # Retrieve information about device drivers in Windows guest # -# Returns: @GuestDeviceInfo -# # Since: 5.2 ## { 'command': 'guest-get-devices', @@ -1579,8 +1555,6 @@ # # @username: the user account to add the authorized keys # -# Returns: @GuestAuthorizedKeys -# # Since: 5.2 ## { 'command': 'guest-ssh-get-authorized-keys', @@ -1707,8 +1681,6 @@ # # Retrieve information about disk stats. # -# Returns: List of disk stats of guest. -# # Since: 7.1 ## { 'command': 'guest-get-diskstats', @@ -1791,8 +1763,6 @@ # # Retrieve information about CPU stats. # -# Returns: List of CPU stats of guest. -# # Since: 7.1 ## { 'command': 'guest-get-cpustats', --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993451; cv=none; d=zohomail.com; s=zohoarc; b=HkgE4fTgq1JwIKaofxLedrKsAn2et+lEtQXNtvdnH1yanXMvH1cNwbVZ0cbM5T6x/pzFn9wXGxWXlLZ6/4QgRL8MhdACVjf7/FFM26T0FvPgDyPthVK8PthSDMtHSxlIVg9tXe1eM9csOltAN5X1lFDF1+angTdHuLXy7nPtinM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993451; 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=OA65odhw6yvz8wFdh9oVTxjcsGiEwAHIVPPzhH06qI0=; b=J0wsMy/z8h0yJLRMWabFIAN55KsFBTmCoSzLpra9GRiNmDhMAUSw33JwOv/fcxWs9RyoWzWjVPR7BFDnioXpcz5Ktff3CTncGXHbNW6rM1s8Pu9t2FjSSu0mJ23Q9OmPCqVC80yDAjwMOiQNPwRlEWB+s0CYQG5qblOyD4DaZfE= 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 1714993451076711.9403879235957; Mon, 6 May 2024 04:04:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7p-00034P-2X; Mon, 06 May 2024 07:03:17 -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 1s3w7h-0002p0-4J 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 1s3w7Z-0003fS-Ts for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:08 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-FojZnOdKPZaK3ZQ-ze9Dag-1; Mon, 06 May 2024 07:02:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 91CB329AA3AF; 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 580266958; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 55CDA21D49C0; 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=1714993380; 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=OA65odhw6yvz8wFdh9oVTxjcsGiEwAHIVPPzhH06qI0=; b=Jm6Qc6KjVIjalf9TtU8zyzurHAhioN1zNy7naFp3zKYjr5HhHKWXds75X6Y2y8xHRurMMJ vg7xt/S5UZh0DXtXD6xKrlLzZaXl9mttGuyo84o1byYIX7Z1XZ5pa0jDTle7He80DJmTW3 hS/mKfC4d985axPy+bNtPGwd5ocw0Cw= X-MC-Unique: FojZnOdKPZaK3ZQ-ze9Dag-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PULL 6/7] qapi: Move conditional code from QAPISchemaVariants to its subtypes Date: Mon, 6 May 2024 13:02:51 +0200 Message-ID: <20240506110254.3965097-12-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.1 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: 1714993453808100003 Content-Type: text/plain; charset="utf-8" QAPISchemaVariants.check()'s code is almost entirely conditional on union vs. alternate type. Move the conditional code to QAPISchemaBranches.check() and QAPISchemaAlternatives.check(), where the conditions are always satisfied. Attribute QAPISchemaVariants.tag_name is now only used by QAPISchemaBranches. Move it there. Refactor the three types' .__init__() to make them a bit simpler. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 138 ++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 9bdbfd52b2..c5b824f1fd 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -719,20 +719,11 @@ def visit(self, visitor: QAPISchemaVisitor) -> None: class QAPISchemaVariants: def __init__( self, - tag_name: Optional[str], info: QAPISourceInfo, - tag_member: Optional[QAPISchemaObjectTypeMember], variants: List[QAPISchemaVariant], ): - # Unions pass tag_name but not tag_member. - # Alternates pass tag_member but not tag_name. - # After check(), tag_member is always set. - assert bool(tag_member) !=3D bool(tag_name) - assert (isinstance(tag_name, str) or - isinstance(tag_member, QAPISchemaObjectTypeMember)) - self._tag_name =3D tag_name self.info =3D info - self._tag_member =3D tag_member + self._tag_member: Optional[QAPISchemaObjectTypeMember] =3D None self.variants =3D variants =20 @property @@ -749,58 +740,66 @@ def set_defined_in(self, name: str) -> None: v.set_defined_in(name) =20 def check( - self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember] + self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember] ) -> None: - if self._tag_name: # union - # We need to narrow the member type: - tmp =3D seen.get(c_name(self._tag_name)) - assert tmp is None or isinstance(tmp, QAPISchemaObjectTypeMemb= er) - self._tag_member =3D tmp + for v in self.variants: + v.check(schema) =20 - base =3D "'base'" - # Pointing to the base type when not implicit would be - # nice, but we don't know it here - if not self._tag_member or self._tag_name !=3D self._tag_membe= r.name: - raise QAPISemError( - self.info, - "discriminator '%s' is not a member of %s" - % (self._tag_name, base)) - # Here we do: - assert self.tag_member.defined_in - base_type =3D schema.lookup_type(self.tag_member.defined_in) - assert base_type - if not base_type.is_implicit(): - base =3D "base type '%s'" % self.tag_member.defined_in - if not isinstance(self.tag_member.type, QAPISchemaEnumType): - raise QAPISemError( - self.info, - "discriminator member '%s' of %s must be of enum type" - % (self._tag_name, base)) - if self.tag_member.optional: - raise QAPISemError( - self.info, - "discriminator member '%s' of %s must not be optional" - % (self._tag_name, base)) - if self.tag_member.ifcond.is_present(): - raise QAPISemError( - self.info, - "discriminator member '%s' of %s must not be condition= al" - % (self._tag_name, base)) - else: # alternate - assert self._tag_member - assert isinstance(self.tag_member.type, QAPISchemaEnumType) - assert not self.tag_member.optional - assert not self.tag_member.ifcond.is_present() - if self._tag_name: # union - # branches that are not explicitly covered get an empty type - assert self.tag_member.defined_in - cases =3D {v.name for v in self.variants} - for m in self.tag_member.type.members: - if m.name not in cases: - v =3D QAPISchemaVariant(m.name, self.info, - 'q_empty', m.ifcond) - v.set_defined_in(self.tag_member.defined_in) - self.variants.append(v) + +class QAPISchemaBranches(QAPISchemaVariants): + def __init__(self, + info: QAPISourceInfo, + variants: List[QAPISchemaVariant], + tag_name: str): + super().__init__(info, variants) + self._tag_name =3D tag_name + + def check( + self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember] + ) -> None: + # We need to narrow the member type: + tmp =3D seen.get(c_name(self._tag_name)) + assert tmp is None or isinstance(tmp, QAPISchemaObjectTypeMember) + self._tag_member =3D tmp + + base =3D "'base'" + # Pointing to the base type when not implicit would be + # nice, but we don't know it here + if not self._tag_member or self._tag_name !=3D self._tag_member.na= me: + raise QAPISemError( + self.info, + "discriminator '%s' is not a member of %s" + % (self._tag_name, base)) + # Here we do: + assert self.tag_member.defined_in + base_type =3D schema.lookup_type(self.tag_member.defined_in) + assert base_type + if not base_type.is_implicit(): + base =3D "base type '%s'" % self.tag_member.defined_in + if not isinstance(self.tag_member.type, QAPISchemaEnumType): + raise QAPISemError( + self.info, + "discriminator member '%s' of %s must be of enum type" + % (self._tag_name, base)) + if self.tag_member.optional: + raise QAPISemError( + self.info, + "discriminator member '%s' of %s must not be optional" + % (self._tag_name, base)) + if self.tag_member.ifcond.is_present(): + raise QAPISemError( + self.info, + "discriminator member '%s' of %s must not be conditional" + % (self._tag_name, base)) + # branches that are not explicitly covered get an empty type + assert self.tag_member.defined_in + cases =3D {v.name for v in self.variants} + for m in self.tag_member.type.members: + if m.name not in cases: + v =3D QAPISchemaVariant(m.name, self.info, + 'q_empty', m.ifcond) + v.set_defined_in(self.tag_member.defined_in) + self.variants.append(v) if not self.variants: raise QAPISemError(self.info, "union has no branches") for v in self.variants: @@ -834,20 +833,21 @@ def check_clash( v.type.check_clash(info, dict(seen)) =20 =20 -class QAPISchemaBranches(QAPISchemaVariants): - def __init__(self, - info: QAPISourceInfo, - variants: List[QAPISchemaVariant], - tag_name: str): - super().__init__(tag_name, info, None, variants) - - class QAPISchemaAlternatives(QAPISchemaVariants): def __init__(self, info: QAPISourceInfo, variants: List[QAPISchemaVariant], tag_member: QAPISchemaObjectTypeMember): - super().__init__(None, info, tag_member, variants) + super().__init__(info, variants) + self._tag_member =3D tag_member + + def check( + self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember] + ) -> None: + super().check(schema, seen) + assert isinstance(self.tag_member.type, QAPISchemaEnumType) + assert not self.tag_member.optional + assert not self.tag_member.ifcond.is_present() =20 =20 class QAPISchemaMember: --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993566; cv=none; d=zohomail.com; s=zohoarc; b=AdfhChX8tNaKFGyknPLPXtlIOvtYi73x90ytTLZusdVggqDG9VcF055dDOr5QS/cIxvoJz2BDWPagAYwoZr8qLVRNJjWsAgTOyfNgZkXFmyr3TEyWlmFTEgPA5GjhtReFMmdLwSgnUxyei4uYMZoZ3EAlDsr3i9gX5jZa82o4h4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993566; 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=t0bAfLx0fSN9+pKtZd6qempTW+VtaN8OzkHnNuAO3EY=; b=PdmstiSIsR6aEe6JLEvxQ7/Fjd2UaHIUYsPFVZES1T5GQ6RUc3ZskJfP/Y4TrZQEWcc/0WeIxkBrUtvcPvryxd67cRksUzHcX0PUwljLCfZoqrF7oZK+cQRx9+OiRebp7uAhuaLt9S7w5CySdT1V1000GXKGgDH82/DLDUClHVs= 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 1714993566087283.8636395743815; Mon, 6 May 2024 04:06:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7o-00032N-9J; Mon, 06 May 2024 07:03:16 -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 1s3w7a-0002lM-TI for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7X-0003ek-3n for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:02 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-YlVr0dCRNsiZ9_hajyr2WA-1; Mon, 06 May 2024 07:02:57 -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 9767E38000AF; 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 5D53D200B2C4; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5B32921D49C4; 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=t0bAfLx0fSN9+pKtZd6qempTW+VtaN8OzkHnNuAO3EY=; b=F6hOfpSODIoshj02oXdrpGkM6wo5lvyO9zPuL25kM6fkkxQR6QUXdZuf3j8zqomfWaS/mY NiQb3bT9e2RgCyzCr/FmhQkCgXXc1LAv2KFx/HUxmhoiDNV3K0/EXkFsb4HTyFCdUDMhbN sbai6hU0zequY8qgBiP0/uaUVV3mZKA= X-MC-Unique: YlVr0dCRNsiZ9_hajyr2WA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 7/7] find untagged sections WIP Date: Mon, 6 May 2024 13:02:53 +0200 Message-ID: <20240506110254.3965097-14-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.133.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: 1714993567291100007 Content-Type: text/plain; charset="utf-8" --- qapi/block-core.json | 1 + qapi/introspect.json | 4 ++++ qapi/machine-target.json | 2 ++ qapi/migration.json | 3 +++ qapi/net.json | 2 ++ qapi/qom.json | 1 + qapi/ui.json | 1 + qga/qapi-schema.json | 2 ++ scripts/qapi/parser.py | 1 + tests/qapi-schema/doc-good.out | 1 + 10 files changed, 18 insertions(+) diff --git a/qapi/block-core.json b/qapi/block-core.json index fab1a45365..1c43d3d2bb 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3289,6 +3289,7 @@ # # @namespace: namespace number of the device, starting from 1. # +# @@@ untagged # Note that the PCI @device must have been unbound from any host # kernel driver before instructing QEMU to add the blockdev. # diff --git a/qapi/introspect.json b/qapi/introspect.json index b041b02ba8..1747562a41 100644 --- a/qapi/introspect.json +++ b/qapi/introspect.json @@ -149,6 +149,7 @@ # # @deprecated: Member @values is deprecated. Use @members instead. # +# @@@ untagged # Values of this type are JSON string on the wire. # # Since: 2.5 @@ -180,6 +181,7 @@ # # @element-type: the array type's element type. # +# @@@ untagged # Values of this type are JSON array on the wire. # # Since: 2.5 @@ -203,6 +205,7 @@ # The variants are in no particular order, and may even differ # from the order of the values of the enum type of the @tag. # +# @@@ untagged # Values of this type are JSON object on the wire. # # Since: 2.5 @@ -261,6 +264,7 @@ # members' wire encoding is distinct, see # :doc:`/devel/qapi-code-gen` section Alternate types. # +# @@@ untagged # On the wire, this can be any of the members. # # Since: 2.5 diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 4ef7ef7b43..37ffd6409b 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -107,6 +107,7 @@ # @responsible-properties: List of properties that led to the # comparison result not being identical. # +# @@@ untagged # @responsible-properties is a list of QOM property names that led to # both CPUs not being detected as identical. For identical models, # this list is empty. If a QOM property is read-only, that means @@ -342,6 +343,7 @@ # removed in in some future version of QEMU according to the QEMU # deprecation policy. (since 5.2) # +# @@@ untagged # @unavailable-features is a list of QOM property names that represent # CPU model attributes that prevent the CPU from running. If the QOM # property is read-only, that means there's no known way to make the diff --git a/qapi/migration.json b/qapi/migration.json index e22645253c..97a727c41a 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -2427,6 +2427,7 @@ # # @devices: list of block device node names to save a snapshot to # +# @@@ untagged # Applications should not assume that the snapshot save is complete # when this command returns. The job commands / events must be used # to determine completion and to fetch details of any errors that @@ -2499,6 +2500,7 @@ # # @devices: list of block device node names to load a snapshot from # +# @@@ untagged # Applications should not assume that the snapshot load is complete # when this command returns. The job commands / events must be used # to determine completion and to fetch details of any errors that @@ -2567,6 +2569,7 @@ # # @devices: list of block device node names to delete a snapshot from # +# @@@ untagged # Applications should not assume that the snapshot delete is complete # when this command returns. The job commands / events must be used # to determine completion and to fetch details of any errors that diff --git a/qapi/net.json b/qapi/net.json index 0f5a259475..da21c02fa2 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -650,6 +650,7 @@ # attempt a reconnect after the given number of seconds. Setting # this to zero disables this function. (default: 0) (since 8.0) # +# @@@ untagged # Only SocketAddress types 'unix', 'inet' and 'fd' are supported. # # Since: 7.2 @@ -669,6 +670,7 @@ # # @local: local address # +# @@@ untagged # Only SocketAddress types 'unix', 'inet' and 'fd' are supported. # # If remote address is present and it's a multicast address, local diff --git a/qapi/qom.json b/qapi/qom.json index d1dc216474..237711cd59 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -547,6 +547,7 @@ # algorithm detects it is spending too long polling without # encountering events. 0 selects a default behaviour (default: 0) # +# @@@ untagged # The @aio-max-batch option is available since 6.1. # # Since: 2.0 diff --git a/qapi/ui.json b/qapi/ui.json index 2b7f0b8401..b2c3f143dc 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -934,6 +934,7 @@ # # @f24: since 8.0 # +# @@@ untagged # 'sysrq' was mistakenly added to hack around the fact that the ps2 # driver was not generating correct scancodes sequences when # 'alt+print' was pressed. This flaw is now fixed and the 'sysrq' key diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index fe41670ed2..17cdb52f83 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -207,6 +207,7 @@ # # @mode: "halt", "powerdown" (default), or "reboot" # +# @@@ untagged # This command does NOT return a response on success. Success # condition is indicated by the VM exiting with a zero exit status or, # when running with --no-shutdown, by issuing the query-status QMP @@ -1050,6 +1051,7 @@ # # @crypted: true if password is already crypt()d, false if raw # +# @@@ untagged # If the @crypted flag is true, it is the caller's responsibility to # ensure the correct crypt() encryption scheme is used. This command # does not attempt to interpret or report on the encryption scheme. diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index e8a482c37d..126acab38d 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -665,6 +665,7 @@ def ensure_untagged_section(self, info: QAPISourceInfo)= -> None: section =3D self.Section(info) self.sections.append(section) self.all_sections.append(section) + section.append_line(f'### untagged {info.loc()}') =20 def new_tagged_section(self, info: QAPISourceInfo, tag: str) -> None: section =3D self.Section(info, tag) diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index f2be711a2c..067e3d1135 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -112,6 +112,7 @@ Also _one_ {and only} feature=3Denum-member-feat a member feature section=3DNone +### untagged /work/armbru/qemu/bld/../tests/qapi-schema/doc-good.json:67 @two is undocumented doc symbol=3DBase body=3D --=20 2.44.0 From nobody Mon Nov 25 11:20:19 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=1714993590; cv=none; d=zohomail.com; s=zohoarc; b=bCGgubnaXm6323QnKQAaK5+slOGfMzcxKk7Pz/+fYhP0bAatKcVUGfU1mlInwl3OG++CRBGchBEsZMT5SIGu87D5bZJgkIxqmXd3xjCPefooCTuRh2HrSMve948X4+rTFP1Um7e++r56pMizN3GkISTOK2QOLUYnrF5D/ifzVBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714993590; 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=NuQ9Fil2xTNfxL9eTvXPA3hWo76CgVTuL8CK0QDZm6w=; b=GxFfoHNrEy6UHfPQEmBujQiZpzT820QW492I4N1LXRflUXBXdejrSxL7ysTeaWJKXuwoOOsHAe1nlBzrP04jQ3UeQdZ8dOeT7YkEjzxw+Mebd5ethXWtrR354Y0s6P1UIv4pSAvcwBJ/VnzLsqTpB37m2QC7LUAg790baWa/HeU= 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 1714993590288158.0948888435778; Mon, 6 May 2024 04:06:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3w7q-00035s-Qj; Mon, 06 May 2024 07:03:18 -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 1s3w7g-0002oz-Vp for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3w7Y-0003fM-KJ for qemu-devel@nongnu.org; Mon, 06 May 2024 07:03:08 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-GdW2s1XgPOaMvcCfBv-ixw-1; Mon, 06 May 2024 07:02:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 9B0A43810B06; 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 61615400D279; Mon, 6 May 2024 11:02:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5E1C221D49C6; 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=1714993380; 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=NuQ9Fil2xTNfxL9eTvXPA3hWo76CgVTuL8CK0QDZm6w=; b=YbmZLVGeQNHteegvgVQSkQtRDcaJRMnmCeT7ZE/ZMWmIj1qxnFhEGxJLRmTdnFrb03mVFd FwDCVWR2rB+9BfoQR+bkLOBf72IOykHjSlvWM88jipvIQWXFesUU3L77zz74E/i/ylpQeO OomgOGzDKJxkmZAsUC0KkEz+upHrRfw= X-MC-Unique: GdW2s1XgPOaMvcCfBv-ixw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PULL 7/7] qapi: Simplify QAPISchemaVariants @tag_member Date: Mon, 6 May 2024 13:02:54 +0200 Message-ID: <20240506110254.3965097-15-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.2 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.133.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: 1714993591397100001 Content-Type: text/plain; charset="utf-8" For union types, the tag member is known only after .check(). We used to code this in a simple way: QAPISchemaVariants attribute .tag_member was None for union types until .check(). Since this complicated typing, recent commit "qapi/schema: fix typing for QAPISchemaVariants.tag_member" hid it behind a property. The previous commit lets us treat .tag_member just like the other attributes that become known only in .check(): declare, but don't initialize it in .__init__(). Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 44 +++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index c5b824f1fd..721c470d2b 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -723,18 +723,9 @@ def __init__( variants: List[QAPISchemaVariant], ): self.info =3D info - self._tag_member: Optional[QAPISchemaObjectTypeMember] =3D None + self.tag_member: QAPISchemaObjectTypeMember self.variants =3D variants =20 - @property - def tag_member(self) -> QAPISchemaObjectTypeMember: - if self._tag_member is None: - raise RuntimeError( - "QAPISchemaVariants has no tag_member property until " - "after check() has been run." - ) - return self._tag_member - def set_defined_in(self, name: str) -> None: for v in self.variants: v.set_defined_in(name) @@ -758,47 +749,48 @@ def check( self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember] ) -> None: # We need to narrow the member type: - tmp =3D seen.get(c_name(self._tag_name)) - assert tmp is None or isinstance(tmp, QAPISchemaObjectTypeMember) - self._tag_member =3D tmp + tag_member =3D seen.get(c_name(self._tag_name)) + assert (tag_member is None + or isinstance(tag_member, QAPISchemaObjectTypeMember)) =20 base =3D "'base'" # Pointing to the base type when not implicit would be # nice, but we don't know it here - if not self._tag_member or self._tag_name !=3D self._tag_member.na= me: + if not tag_member or self._tag_name !=3D tag_member.name: raise QAPISemError( self.info, "discriminator '%s' is not a member of %s" % (self._tag_name, base)) + self.tag_member =3D tag_member # Here we do: - assert self.tag_member.defined_in - base_type =3D schema.lookup_type(self.tag_member.defined_in) + assert tag_member.defined_in + base_type =3D schema.lookup_type(tag_member.defined_in) assert base_type if not base_type.is_implicit(): - base =3D "base type '%s'" % self.tag_member.defined_in - if not isinstance(self.tag_member.type, QAPISchemaEnumType): + base =3D "base type '%s'" % tag_member.defined_in + if not isinstance(tag_member.type, QAPISchemaEnumType): raise QAPISemError( self.info, "discriminator member '%s' of %s must be of enum type" % (self._tag_name, base)) - if self.tag_member.optional: + if tag_member.optional: raise QAPISemError( self.info, "discriminator member '%s' of %s must not be optional" % (self._tag_name, base)) - if self.tag_member.ifcond.is_present(): + if tag_member.ifcond.is_present(): raise QAPISemError( self.info, "discriminator member '%s' of %s must not be conditional" % (self._tag_name, base)) # branches that are not explicitly covered get an empty type - assert self.tag_member.defined_in + assert tag_member.defined_in cases =3D {v.name for v in self.variants} - for m in self.tag_member.type.members: + for m in tag_member.type.members: if m.name not in cases: v =3D QAPISchemaVariant(m.name, self.info, 'q_empty', m.ifcond) - v.set_defined_in(self.tag_member.defined_in) + v.set_defined_in(tag_member.defined_in) self.variants.append(v) if not self.variants: raise QAPISemError(self.info, "union has no branches") @@ -807,11 +799,11 @@ def check( # Union names must match enum values; alternate names are # checked separately. Use 'seen' to tell the two apart. if seen: - if v.name not in self.tag_member.type.member_names(): + if v.name not in tag_member.type.member_names(): raise QAPISemError( self.info, "branch '%s' is not a value of %s" - % (v.name, self.tag_member.type.describe())) + % (v.name, tag_member.type.describe())) if not isinstance(v.type, QAPISchemaObjectType): raise QAPISemError( self.info, @@ -839,7 +831,7 @@ def __init__(self, variants: List[QAPISchemaVariant], tag_member: QAPISchemaObjectTypeMember): super().__init__(info, variants) - self._tag_member =3D tag_member + self.tag_member =3D tag_member =20 def check( self, schema: QAPISchema, seen: Dict[str, QAPISchemaMember] --=20 2.44.0