From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345188; cv=none; d=zoho.com; s=zohoarc; b=iC6/hMSOAeXnlGvAtgRXpSGmft8solGvh44x3sxrNynwxe/1H3bD5UtAwrtX5Po9GO/qCjrnu8FNmP3xKMQ6QSrSrvmZvkqpKn6vszCD/E7HaegLa7LpQHJ3ZkiqkGvCwDKuoO4Zf9eykbk2sIBKe30Wzb9xcidTHgC8UbBbxkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345188; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6clcLZCh8AgNCQzhxRb7905oBBUjO8EbBiZIFBOzXr0=; b=aWSe3kvWf+BUfpcAEkIWkHXsQbxor7RRslJBPcOCAJDwJ+LDH9wyNNckDLeZNd9nC7g5eJSt7KDFwjxooooq44ROe0ZgZPyGpNkJFJt73POGRxZpGniHUhai/NEBVWsdEE+XS+zs0ROMK19WkKDnXRlx5Jke4a7+sX1M3ueBr3Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345188885675.9595404804135; Tue, 29 Oct 2019 03:33:08 -0700 (PDT) Received: from localhost ([::1]:54464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOoF-0008Kh-JK for importer@patchew.org; Tue, 29 Oct 2019 06:33:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56783) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeA-0005TY-Bw for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOe7-00017a-Lz for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28662 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOe7-00016c-CW for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-ZRVT2bkVO0-t5bRJk_iP4A-1; Tue, 29 Oct 2019 06:22:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D1E4801E64 for ; Tue, 29 Oct 2019 10:22:35 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13E0360863 for ; Tue, 29 Oct 2019 10:22:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 805DF1136447; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6clcLZCh8AgNCQzhxRb7905oBBUjO8EbBiZIFBOzXr0=; b=KJYd4kspHmM/8jpULRxw6XrPWGSg+EEXfo+R3ZhPQr1baEJEsGIPZdi7ylH0GkXkyiZUiv 4bTxrV2Bi9hqUkW3Y7Oov9J4ApYsLHOk6aYwqp2YeGC/UXbaDxhOE15/WXtCoYo1Bejllg KFJW1p5fgCKYDx+NKzORof6VjagYtoc= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 01/19] tests/qapi-schema: Demonstrate feature and enum doc comment bugs Date: Tue, 29 Oct 2019 11:22:10 +0100 Message-Id: <20191029102228.20740-2-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: ZRVT2bkVO0-t5bRJk_iP4A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add negative tests doc-bad-enum-member and doc-bad-feature to cover documentation for nonexistent enum members and features, and test doc-undoc-feature to cover features lacking documentation. None of them works. To be fixed later in this series. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-2-armbru@redhat.com> --- tests/Makefile.include | 3 +++ tests/qapi-schema/doc-bad-enum-member.err | 0 tests/qapi-schema/doc-bad-enum-member.json | 9 +++++++++ tests/qapi-schema/doc-bad-enum-member.out | 21 +++++++++++++++++++++ tests/qapi-schema/doc-bad-feature.err | 0 tests/qapi-schema/doc-bad-feature.json | 10 ++++++++++ tests/qapi-schema/doc-bad-feature.out | 17 +++++++++++++++++ tests/qapi-schema/doc-undoc-feature.err | 0 tests/qapi-schema/doc-undoc-feature.json | 10 ++++++++++ tests/qapi-schema/doc-undoc-feature.out | 19 +++++++++++++++++++ 10 files changed, 89 insertions(+) create mode 100644 tests/qapi-schema/doc-bad-enum-member.err create mode 100644 tests/qapi-schema/doc-bad-enum-member.json create mode 100644 tests/qapi-schema/doc-bad-enum-member.out create mode 100644 tests/qapi-schema/doc-bad-feature.err create mode 100644 tests/qapi-schema/doc-bad-feature.json create mode 100644 tests/qapi-schema/doc-bad-feature.out create mode 100644 tests/qapi-schema/doc-undoc-feature.err create mode 100644 tests/qapi-schema/doc-undoc-feature.json create mode 100644 tests/qapi-schema/doc-undoc-feature.out diff --git a/tests/Makefile.include b/tests/Makefile.include index fde8a0c5ef..ca2a0cb84f 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -342,6 +342,8 @@ qapi-schema +=3D command-int.json qapi-schema +=3D comments.json qapi-schema +=3D doc-bad-alternate-member.json qapi-schema +=3D doc-bad-command-arg.json +qapi-schema +=3D doc-bad-enum-member.json +qapi-schema +=3D doc-bad-feature.json qapi-schema +=3D doc-bad-section.json qapi-schema +=3D doc-bad-symbol.json qapi-schema +=3D doc-bad-union-member.json @@ -365,6 +367,7 @@ qapi-schema +=3D doc-missing-expr.json qapi-schema +=3D doc-missing-space.json qapi-schema +=3D doc-missing.json qapi-schema +=3D doc-no-symbol.json +qapi-schema +=3D doc-undoc-feature.json qapi-schema +=3D double-type.json qapi-schema +=3D duplicate-key.json qapi-schema +=3D empty.json diff --git a/tests/qapi-schema/doc-bad-enum-member.err b/tests/qapi-schema/= doc-bad-enum-member.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-enum-member.json b/tests/qapi-schema= /doc-bad-enum-member.json new file mode 100644 index 0000000000..9f32fe64b4 --- /dev/null +++ b/tests/qapi-schema/doc-bad-enum-member.json @@ -0,0 +1,9 @@ +# Members listed in the doc comment must exist in the actual schema +# BUG: nonexistent @a is not rejected + +## +# @Foo: +# @a: a +# @b: b +## +{ 'enum': 'Foo', 'data': [ 'b' ] } diff --git a/tests/qapi-schema/doc-bad-enum-member.out b/tests/qapi-schema/= doc-bad-enum-member.out new file mode 100644 index 0000000000..6ca31c1e9b --- /dev/null +++ b/tests/qapi-schema/doc-bad-enum-member.out @@ -0,0 +1,21 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-enum-member.json +enum Foo + member b +doc symbol=3DFoo + body=3D + + arg=3Da +a + arg=3Db +b diff --git a/tests/qapi-schema/doc-bad-feature.err b/tests/qapi-schema/doc-= bad-feature.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-feature.json b/tests/qapi-schema/doc= -bad-feature.json new file mode 100644 index 0000000000..2a78e3b1db --- /dev/null +++ b/tests/qapi-schema/doc-bad-feature.json @@ -0,0 +1,10 @@ +# Features listed in the doc comment must exist in the actual schema +# BUG: nonexistent @a is not rejected + +## +# @foo: +# +# Features: +# @a: a +## +{ 'command': 'foo' } diff --git a/tests/qapi-schema/doc-bad-feature.out b/tests/qapi-schema/doc-= bad-feature.out new file mode 100644 index 0000000000..4670be3a72 --- /dev/null +++ b/tests/qapi-schema/doc-bad-feature.out @@ -0,0 +1,17 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-feature.json +command foo None -> None + gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse +doc symbol=3Dfoo + body=3D + diff --git a/tests/qapi-schema/doc-undoc-feature.err b/tests/qapi-schema/do= c-undoc-feature.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-undoc-feature.json b/tests/qapi-schema/d= oc-undoc-feature.json new file mode 100644 index 0000000000..c7650d9974 --- /dev/null +++ b/tests/qapi-schema/doc-undoc-feature.json @@ -0,0 +1,10 @@ +# Doc comment must cover all features +# BUG: missing documentation for @undoc not caught + +## +# @foo: +# +# Features: +# @doc: documented feature +## +{ 'command': 'foo', 'features': ['undoc', 'doc'] } diff --git a/tests/qapi-schema/doc-undoc-feature.out b/tests/qapi-schema/do= c-undoc-feature.out new file mode 100644 index 0000000000..faae777f0d --- /dev/null +++ b/tests/qapi-schema/doc-undoc-feature.out @@ -0,0 +1,19 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-undoc-feature.json +command foo None -> None + gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse + feature undoc + feature doc +doc symbol=3Dfoo + body=3D + --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572344852; cv=none; d=zoho.com; s=zohoarc; b=CD6KC6QA4rY7pFCGKtHS0VaUPumXOBv8nXjAe8czt/iRXHawtVG2e7GppAWmA5qKzEiF64bzZ7mqCdMNOInED+OVWU8Zy97gnHsI4c6UxPjqr+pWKvHJEDma3kraEMEA7gWMbDb/IXCalzkeEnF8C7t/UW8P0tfmN3LtKSQd2ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572344852; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S17zb9VJmJXU5JrsFlbS3HbNlldujxxBtBQrqUOHXGU=; b=OR/8dkZljd46SKEJZubTB48Y3dXCQ6YOCD+8NfjBmF3hhFTdS0WYF3BIsN1MOJ5yQVfoFsaVBrdFNbRVZXkcSwJ1QqgRs8RTVrDTreXIOaoIXQCZT6bUAZ72zFouPAPtyIv/VdurKtBUlKBOAs6EgbD2lEGNcDgKvezrXBUsHMM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572344852170304.55880943050613; Tue, 29 Oct 2019 03:27:32 -0700 (PDT) Received: from localhost ([::1]:54418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOip-0002F9-1C for importer@patchew.org; Tue, 29 Oct 2019 06:27:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56787) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeA-0005TZ-CQ for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOe7-00017k-O9 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:41 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:20091 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOe7-000169-Br for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-IKtUQSiGMBGZW8z9_tC1-Q-1; Tue, 29 Oct 2019 06:22:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72DF5801E6F for ; Tue, 29 Oct 2019 10:22:35 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1841E5D6C3 for ; Tue, 29 Oct 2019 10:22:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 832A61133023; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S17zb9VJmJXU5JrsFlbS3HbNlldujxxBtBQrqUOHXGU=; b=QSoXGENWk9nJua8NIcHy6y4UgGpZcqPt73l0kqFmWpx7KmDGW9DxET6PHdmwOzFigQ4pcu x4NgjnwFN9Sgp9scFMHyU4xuK83hIkwhgA94YdOdRmnidflLfR/VBicbVD7bkdWOtl8HsF k+oQ2QTIVUan9iKcJCnWlekaLg1KNcg= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 02/19] tests/qapi-schema: Demonstrate command and event doc comment bugs Date: Tue, 29 Oct 2019 11:22:11 +0100 Message-Id: <20191029102228.20740-3-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: IKtUQSiGMBGZW8z9_tC1-Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add negative tests doc-bad-boxed-command-arg and doc-bad-event-arg to cover boxed and no arguments. They demonstrate insufficient doc comment checking. Update positive test doc-good to cover boxed event arguments. It demonstrates the generated doc comment misses arguments. These bugs will be fixed later in this series. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-3-armbru@redhat.com> --- tests/qapi-schema/doc-good.texi | 8 ++++++ tests/Makefile.include | 2 ++ .../qapi-schema/doc-bad-boxed-command-arg.err | 0 .../doc-bad-boxed-command-arg.json | 15 +++++++++++ .../qapi-schema/doc-bad-boxed-command-arg.out | 26 +++++++++++++++++++ tests/qapi-schema/doc-bad-event-arg.err | 0 tests/qapi-schema/doc-bad-event-arg.json | 8 ++++++ tests/qapi-schema/doc-bad-event-arg.out | 19 ++++++++++++++ tests/qapi-schema/doc-good.json | 7 +++++ tests/qapi-schema/doc-good.out | 5 ++++ 10 files changed, 90 insertions(+) create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.err create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.json create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.out create mode 100644 tests/qapi-schema/doc-bad-event-arg.err create mode 100644 tests/qapi-schema/doc-bad-event-arg.json create mode 100644 tests/qapi-schema/doc-bad-event-arg.out diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index 2ce8b883c9..d6ecdac94f 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -258,3 +258,11 @@ another feature =20 @end deftypefn =20 + + +@deftypefn Event {} EVT-BOXED + +BUG: generated doc misses arguments + +@end deftypefn + diff --git a/tests/Makefile.include b/tests/Makefile.include index ca2a0cb84f..237e5acd27 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -341,8 +341,10 @@ qapi-schema +=3D base-cycle-indirect.json qapi-schema +=3D command-int.json qapi-schema +=3D comments.json qapi-schema +=3D doc-bad-alternate-member.json +qapi-schema +=3D doc-bad-boxed-command-arg.json qapi-schema +=3D doc-bad-command-arg.json qapi-schema +=3D doc-bad-enum-member.json +qapi-schema +=3D doc-bad-event-arg.json qapi-schema +=3D doc-bad-feature.json qapi-schema +=3D doc-bad-section.json qapi-schema +=3D doc-bad-symbol.json diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.err b/tests/qapi-s= chema/doc-bad-boxed-command-arg.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.json b/tests/qapi-= schema/doc-bad-boxed-command-arg.json new file mode 100644 index 0000000000..2c265d2ca3 --- /dev/null +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.json @@ -0,0 +1,15 @@ +# Boxed arguments are not to be documented with the command +# BUG: not rejected + +## +# @Args: +# @a: an argument +## +{ 'struct': 'Args', 'data': { 'a': 'int' } } + +## +# @cmd-boxed: +# @a: bogus +## +{ 'command': 'cmd-boxed', 'boxed': true, + 'data': 'Args' } diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.out b/tests/qapi-s= chema/doc-bad-boxed-command-arg.out new file mode 100644 index 0000000000..4ccd788253 --- /dev/null +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.out @@ -0,0 +1,26 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-boxed-command-arg.json +object Args + member a: int optional=3DFalse +command cmd-boxed Args -> None + gen=3DTrue success_response=3DTrue boxed=3DTrue oob=3DFalse preconfig= =3DFalse +doc symbol=3DArgs + body=3D + + arg=3Da +an argument +doc symbol=3Dcmd-boxed + body=3D + + arg=3Da +bogus diff --git a/tests/qapi-schema/doc-bad-event-arg.err b/tests/qapi-schema/do= c-bad-event-arg.err new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qapi-schema/doc-bad-event-arg.json b/tests/qapi-schema/d= oc-bad-event-arg.json new file mode 100644 index 0000000000..80d4e1240b --- /dev/null +++ b/tests/qapi-schema/doc-bad-event-arg.json @@ -0,0 +1,8 @@ +# Arguments listed in the doc comment must exist in the actual schema +# BUG: nonexistent @a is not rejected + +## +# @FOO: +# @a: a +## +{ 'event': 'FOO' } diff --git a/tests/qapi-schema/doc-bad-event-arg.out b/tests/qapi-schema/do= c-bad-event-arg.out new file mode 100644 index 0000000000..ad0367cd45 --- /dev/null +++ b/tests/qapi-schema/doc-bad-event-arg.out @@ -0,0 +1,19 @@ +module None +object q_empty +enum QType + prefix QTYPE + member none + member qnull + member qnum + member qstring + member qdict + member qlist + member qbool +module doc-bad-event-arg.json +event FOO None + boxed=3DFalse +doc symbol=3DFOO + body=3D + + arg=3Da +a diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son index 7dc21e58a3..1ae6c3a9da 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -149,3 +149,10 @@ { 'command': 'cmd-boxed', 'boxed': true, 'data': 'Object', 'features': [ 'cmd-feat1', 'cmd-feat2' ] } + +## +# @EVT-BOXED: +# BUG: generated doc misses arguments +## +{ 'event': 'EVT-BOXED', 'boxed': true, + 'data': 'Object' } diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index f78fdef6a9..a8fc39d288 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -54,6 +54,8 @@ command cmd-boxed Object -> None gen=3DTrue success_response=3DTrue boxed=3DTrue oob=3DFalse preconfig= =3DFalse feature cmd-feat1 feature cmd-feat2 +event EVT-BOXED Object + boxed=3DTrue doc freeform body=3D =3D Section @@ -170,3 +172,6 @@ If you're bored enough to read this, go see a video of = boxed cats -> in =20 <- out +doc symbol=3DEVT-BOXED + body=3D +BUG: generated doc misses arguments --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345348; cv=none; d=zoho.com; s=zohoarc; b=cwk+wh3VjKTarPEAos/PsrQdX0XGxcx6Jam+2w0tLYYgdsW6ypCz7xXURRvKLWpOJNnyotwxjWcAQtHZiW3gVTy5r7ntm2OuNE+B2JIZbAGya96wPLEwgvXlrax9djMEzWE1PeaBhFpZdpRek2E3a9Cc8FJl9unGXjjIM9TeNDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345348; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=a+fRf+3erE8+48yu1hfN6R/KqPIH/A3PzMRXUb2aQnk=; b=XuLtQk6B042GPt9BjggvE7UfRqi83bD+EFhOBajUlI+Ao3C+soNOcl9bDW5nj0vQ7uU4A5tT/yde3zri/AF5TmwQc+oYnf/ZjYa/H6Kq2cBCrr6mZgQtCetUFk+vvyJbbu4AYnneuIdzI4JIBqa/VY3cFn+SsbUqJdEf+CbvGSw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345348392453.43244643104595; Tue, 29 Oct 2019 03:35:48 -0700 (PDT) Received: from localhost ([::1]:54482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOql-0002jX-2T for importer@patchew.org; Tue, 29 Oct 2019 06:35:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56840) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeC-0005U2-8w for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeB-0001Ag-4W for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:44 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31825 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeB-0001AH-0A for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-of8pGXh8PamXd7pm3CUQBA-1; Tue, 29 Oct 2019 06:22:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C43E801E64 for ; Tue, 29 Oct 2019 10:22:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BA9B60863 for ; Tue, 29 Oct 2019 10:22:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 86B541132E8F; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a+fRf+3erE8+48yu1hfN6R/KqPIH/A3PzMRXUb2aQnk=; b=PbK81xChpiP8t/cy4iD//lq97Zppi3/mdgl+KHDDVud7QkPr1K6MnzW+5txsIbWlyBStO7 jxkNR5NRqKT2xyaYT+CB/wxy58bZq59tEJ3TjvaV98eTIELqbr8DbhDP8z4Fd+ZFfou6Bh fjDAnpyFA+Kd8iOJdq/FI45FVlTeT8Q= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 03/19] tests/qapi-schema: Cover alternate documentation comments Date: Tue, 29 Oct 2019 11:22:12 +0100 Message-Id: <20191029102228.20740-4-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: of8pGXh8PamXd7pm3CUQBA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-4-armbru@redhat.com> --- tests/qapi-schema/doc-good.texi | 17 +++++++++++++++++ tests/qapi-schema/doc-good.json | 8 ++++++++ tests/qapi-schema/doc-good.out | 12 ++++++++++++ 3 files changed, 37 insertions(+) diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index d6ecdac94f..98aa78e1fb 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -170,6 +170,23 @@ One of @t{"one"}, @t{"two"} @end deftp =20 =20 + +@deftp {Alternate} Alternate + + + +@b{Members:} +@table @asis +@item @code{i: int} +an integer +@code{b} is undocumented +@item @code{b: boolean} +Not documented +@end table + +@end deftp + + @subsection Another subsection =20 =20 diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son index 1ae6c3a9da..df50a877e3 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -98,6 +98,14 @@ { 'union': 'SugaredUnion', 'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' = } } } =20 +## +# @Alternate: +# @i: an integer +# @b is undocumented +## +{ 'alternate': 'Alternate', + 'data': { 'i': 'int', 'b': 'bool' } } + ## # =3D=3D Another subsection ## diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index a8fc39d288..b0e99f2110 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -42,6 +42,10 @@ object SugaredUnion case one: q_obj_Variant1-wrapper case two: q_obj_Variant2-wrapper if ['IFTWO'] +alternate Alternate + tag type + case i: int + case b: bool object q_obj_cmd-arg member arg1: int optional=3DFalse member arg2: str optional=3DTrue @@ -133,6 +137,14 @@ doc symbol=3DSugaredUnion =20 arg=3Dtype =20 +doc symbol=3DAlternate + body=3D + + arg=3Di +an integer +@b is undocumented + arg=3Db + doc freeform body=3D =3D=3D Another subsection --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572344677; cv=none; d=zoho.com; s=zohoarc; b=JjnB4aOwUNaigIk8KdZ2z2Zi03Ln4l++HGtVJ7AYY1RyjRxS4p1XTWPeblXkaCnSJMdUGMYZIblVPStZG+YxTCR9hwXJnAIHNoNdvOzJvnzD0MpFod8z2yqFlFr4MvnCquttlXfSVRrvulPcQBwypV4w5rHKfc+Wp20kM7gzEqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572344677; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0GVN7Ngnf1d40Eu8SuX1e1IPhbmaEYE/iExqwcXRbvw=; b=KrOn0oynG2p9Sp4vokeY0gPy9FP+RpcS5PSnzWAgwlSCzBKffhxaxU7a7RJ+zuTHWDsAj96JNKf3ZCujAR9dN4r2ShhzUImtv+oqzwwUv8D1MMA8xNcM8zOzy8yzrcBDSA7kVIUg2uOFGp85F1j955nkmdqAek4zSMHlPJtZQHo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572344677456605.9970870160817; Tue, 29 Oct 2019 03:24:37 -0700 (PDT) Received: from localhost ([::1]:54388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOfz-0007L0-VX for importer@patchew.org; Tue, 29 Oct 2019 06:24:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56796) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeA-0005Ta-Dm for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOe8-00018c-Jc for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:23991 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOe8-000185-GB for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-388-w70NypJxM8q2kynGUkuLDQ-1; Tue, 29 Oct 2019 06:22:38 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FA1C1804972 for ; Tue, 29 Oct 2019 10:22:37 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E8E4194BE for ; Tue, 29 Oct 2019 10:22:37 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 89C781132E92; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0GVN7Ngnf1d40Eu8SuX1e1IPhbmaEYE/iExqwcXRbvw=; b=MBK4CWDwxjs2+2onDJVuy22sdfjz9XOgWp76D7Xm8Eva4kvLHhjMX/LTPpR7GJ1qn8ygj3 0Tpg/3AOEkMbx1yReMLOfsm690RR2JfPlunRCWZ/kFYbKy8h7QJ2Q8Md44H9CjqWXk3Rd3 PJZ7pYTLGVjvo0QBRbaqO5iBd/xkL2c= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 04/19] tests/qapi-schema: Fix feature documentation testing Date: Tue, 29 Oct 2019 11:22:13 +0100 Message-Id: <20191029102228.20740-5-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: w70NypJxM8q2kynGUkuLDQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 8aa3a33e44 "tests/qapi-schema: Test for good feature lists in structs" made test-qapi.py show features, but neglected to show their documentation. Fix that. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-5-armbru@redhat.com> --- tests/qapi-schema/doc-bad-feature.out | 2 ++ tests/qapi-schema/doc-good.out | 10 ++++++++++ tests/qapi-schema/doc-undoc-feature.out | 2 ++ tests/qapi-schema/test-qapi.py | 2 ++ 4 files changed, 16 insertions(+) diff --git a/tests/qapi-schema/doc-bad-feature.out b/tests/qapi-schema/doc-= bad-feature.out index 4670be3a72..fef4a3e400 100644 --- a/tests/qapi-schema/doc-bad-feature.out +++ b/tests/qapi-schema/doc-bad-feature.out @@ -15,3 +15,5 @@ command foo None -> None doc symbol=3Dfoo body=3D =20 + feature=3Da +a diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index b0e99f2110..8cc29fce50 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -126,6 +126,8 @@ A paragraph Another paragraph (but no @var: line) arg=3Dvar1 =20 + feature=3Dvariant1-feat +a feature doc symbol=3DVariant2 body=3D =20 @@ -158,6 +160,10 @@ the second argument arg=3Darg3 =20 + feature=3Dcmd-feat1 +a feature + feature=3Dcmd-feat2 +another feature section=3DNote @arg3 is undocumented section=3DReturns @@ -180,6 +186,10 @@ Duis aute irure dolor doc symbol=3Dcmd-boxed body=3D If you're bored enough to read this, go see a video of boxed cats + feature=3Dcmd-feat1 +a feature + feature=3Dcmd-feat2 +another feature section=3DExample -> in =20 diff --git a/tests/qapi-schema/doc-undoc-feature.out b/tests/qapi-schema/do= c-undoc-feature.out index faae777f0d..cdb097361f 100644 --- a/tests/qapi-schema/doc-undoc-feature.out +++ b/tests/qapi-schema/doc-undoc-feature.out @@ -17,3 +17,5 @@ command foo None -> None doc symbol=3Dfoo body=3D =20 + feature=3Ddoc +documented feature diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 2bd9fd8742..bad14edb47 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -117,6 +117,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)) + for feat, section in doc.features.items(): + print(' feature=3D%s\n%s' % (feat, section.text)) for section in doc.sections: print(' section=3D%s\n%s' % (section.name, section.text)) =20 --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345065; cv=none; d=zoho.com; s=zohoarc; b=ZfBjIREb3myx0UmAx9At37iA/HdeQ5bfD2iUQjlYT4suo0qzEa1NTC4Tn9BaXMYrVDEOdHeFC+PKQl3dRH15Dtjv0UKJFhTxvDUneFZWjFOEj1QmAFxjjHB0MpW076e6gmP3jXyslfEEofi19VCKnA/VcwD56LE3cs+EProp1Gw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345065; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S36T8nwF13z1jgj6foVTl0MPyPUCcTK8njdEkhrBvQs=; b=KYkDR+yK5BsIyBa/v6ek2JCYDyeKOo9z/3OA2O8D5n0QXG9jpBZYB7rLyNFBbmLulptECmdGhFYH0/GjVLX56i1xYDGwS/ayx/xcjJ15rgvPo+1WnRRxAy4fwALRxMqvpoBzRtCMuban0ttxe5rlF1llIJYgmIiZ+31xZaviYzY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345065919235.93783237187233; Tue, 29 Oct 2019 03:31:05 -0700 (PDT) Received: from localhost ([::1]:54446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOmG-0006Ye-G6 for importer@patchew.org; Tue, 29 Oct 2019 06:31:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56872) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeF-0005Y3-Tw for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeE-0001EH-Pi for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:54419 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeE-0001E0-Kq for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-357-0nB2cZo_PemgV8Wc5V2z9A-1; Tue, 29 Oct 2019 06:22:44 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F208185B6F0 for ; Tue, 29 Oct 2019 10:22:43 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFC4810027AF for ; Tue, 29 Oct 2019 10:22:43 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8CAA81132C0F; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S36T8nwF13z1jgj6foVTl0MPyPUCcTK8njdEkhrBvQs=; b=YxCAwCljQNjS1S+LCfcGj5HsMYXhzLmCl2XkZteDW9wj2NDegQ1CIY/Tjohb2jrM0SgWLQ J7HY5ZoJrAIITeQponSXerHdpNrBDKF0erCbBdZg0k5xLjb/ZlI8U3YpSjJnfJkkdn5pEo higucxdM0k52t3G2QU/E1kDcqJclp3Q= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 05/19] qemu-doc: Belatedly document QMP command deprecation Date: Tue, 29 Oct 2019 11:22:14 +0100 Message-Id: <20191029102228.20740-6-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 0nB2cZo_PemgV8Wc5V2z9A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 24fb413300 "qmp: Introduce blockdev-change-medium" (v2.5.0) deprecated change. Commit 2ff3025797 "migrate: move max-bandwidth and downtime-limit to migrate_set_parameter" (v2.8.0) deprecated migrate_set_downtime and migrate_set_speed. These wre missed in commit eb22aeca65 "docs: document deprecation policy & deprecated features in appendix" (v2.10.0). Commit 73af8dd8d7 "migration: Make xbzrle_cache_size a migration parameter" (v2.11.0) deprecated migrate-set-cache-size and query-migrate-cache-size, but neglected to update qemu-doc. Make up for that. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-6-armbru@redhat.com> --- qemu-deprecated.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 7239e0959d..f727bd3932 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -149,6 +149,18 @@ QEMU 4.1 has three options, please migrate to one of t= hese three: =20 @section QEMU Machine Protocol (QMP) commands =20 +@subsection change (since 2.5.0) + +Use ``blockdev-change-medium'' or ``change-vnc-password'' instead. + +@subsection migrate_set_downtime and migrate_set_speed (since 2.8.0) + +Use ``migrate-set-parameters'' instead. + +@subsection migrate-set-cache-size and query-migrate-cache-size (since 2.1= 1.0) + +Use ``migrate-set-parameters'' and ``query-migrate-parameters'' instead. + @subsection query-block result field dirty-bitmaps[i].status (since 4.0) =20 The ``status'' field of the ``BlockDirtyInfo'' structure, returned by --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345545; cv=none; d=zoho.com; s=zohoarc; b=T4ILnR8tStLXUWjydMARnt5PcsqqMSr+tLZElS60CIKy/wos2elJYj4HlTxsT0s+NnXeEr4w7zhR3LDKoDF1Vk2Crwg0ZLaqei9bvgmjxFdfSCyoGCwIv/U7dI6+j/c2ciQm0O27YIBbYMEU7g8ao5MA3+sLx+CcM4wq4qJ1MtI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345545; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tc3I4EWEVU2b+QWt9klfeULkPE0QaiDiPfz84BGDzhs=; b=Y7WwO2phT64StXLSqWWPbA8uCi6n/Joel/0CbBlabakgUShkVdC8J044Sv0iLK0tuENxUxplDURA5RVN4z57x813bXN5ddh2ugDaEV/agGqjxEOi+RWGtfJi90lHpgDZN72EpP45yL0VmOk9ti7YaHZm+rMz679OFL7CA6qGLnc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345545000441.75852706898; Tue, 29 Oct 2019 03:39:05 -0700 (PDT) Received: from localhost ([::1]:54562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOty-00077N-T6 for importer@patchew.org; Tue, 29 Oct 2019 06:39:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56909) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeI-0005cy-Jq for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeH-0001IZ-D5 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:50 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:27733 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeH-0001IJ-98 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:49 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-VsRzaGOqM1yE4vtLih2C9g-1; Tue, 29 Oct 2019 06:22:47 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00A8F1005509 for ; Tue, 29 Oct 2019 10:22:47 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3BC260C4B for ; Tue, 29 Oct 2019 10:22:46 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8F9891132C11; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tc3I4EWEVU2b+QWt9klfeULkPE0QaiDiPfz84BGDzhs=; b=VmMdHaJzHH5H5P1FUCAVCnsJkeXpHbFgMTkVezoKGzBayP1n4CbYNmnjp/m6WVljl85jwa Aj7vfMwzhPaunzJXGqApgiKQjrF8sd305StM/p6acSuqQNJLUvBqJFZEYpq8PIT9+hzqRG oU4kCecMi5LEyr6n7JhqWufrcOTCkI0= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 06/19] qapi: Implement boxed event argument documentation Date: Tue, 29 Oct 2019 11:22:15 +0100 Message-Id: <20191029102228.20740-7-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: VsRzaGOqM1yE4vtLih2C9g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Generate a reference "Arguments: the members of ...", just like we do for commands since commit c2dd311cb7 "qapi2texi: Implement boxed argument documentation". No change to generated QMP documentation; we don't yet use boxed events outside tests/. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-7-armbru@redhat.com> --- tests/qapi-schema/doc-good.texi | 4 +++- scripts/qapi/doc.py | 10 +++++++++- tests/qapi-schema/doc-good.json | 1 - tests/qapi-schema/doc-good.out | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index 98aa78e1fb..d4b15dabf0 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -279,7 +279,9 @@ another feature =20 @deftypefn Event {} EVT-BOXED =20 -BUG: generated doc misses arguments + + +@b{Arguments:} the members of @code{Object} =20 @end deftypefn =20 diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 6d5726cf6e..f2462c9877 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -266,9 +266,17 @@ class QAPISchemaGenDocVisitor(QAPISchemaVisitor): =20 def visit_event(self, name, info, ifcond, arg_type, boxed): doc =3D self.cur_doc + if boxed: + body =3D texi_body(doc) + body +=3D ('\n@b{Arguments:} the members of @code{%s}\n' + % arg_type.name) + body +=3D texi_features(doc) + body +=3D texi_sections(doc, ifcond) + else: + body =3D texi_entity(doc, 'Arguments', ifcond) self._gen.add(MSG_FMT(type=3D'Event', name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Arguments', ifcond)= )) + body=3Dbody)) =20 def symbol(self, doc, entity): if self._gen._body: diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son index df50a877e3..d992e713d9 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -160,7 +160,6 @@ =20 ## # @EVT-BOXED: -# BUG: generated doc misses arguments ## { 'event': 'EVT-BOXED', 'boxed': true, 'data': 'Object' } diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 8cc29fce50..4c9406a464 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -196,4 +196,4 @@ another feature <- out doc symbol=3DEVT-BOXED body=3D -BUG: generated doc misses arguments + --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572344666; cv=none; d=zoho.com; s=zohoarc; b=d14E22d8kMAooX67167w28eQL9VwwGJaddguohpggpP1f8OabNrVCPqnB/dsyxpLhw6MWLxVGR15IcEPPnQUnByBKjCQP5mKvVp/+bGYmtiObZoNef7tR8EBviHr/8mOSD2KMjNVOmycaAXvNZEUVGSAWBxudneaNt4atgqUlFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572344666; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=II3m01MgY98fc2Dieg7c1F0uusOjdo1u3iC/UkCx+o0=; b=CIN8xkck7xlymb7iOClrSDR9Z2P/YwU0DXwnH2CckfldDPwimymNqCLJQUk2AoIRidJFasAh7QNy52PeUpVW3gUg15ZYgwJLK0ByTIOh+k8BkzhiBdvSZgV6GMAh2p6SjVWp0017Arn3/skM0i+y5G5ErdGI1kLkTeLHp33JUyg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572344666026830.0446527145316; Tue, 29 Oct 2019 03:24:26 -0700 (PDT) Received: from localhost ([::1]:54382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOfn-00074e-41 for importer@patchew.org; Tue, 29 Oct 2019 06:24:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56797) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeA-0005Tb-Bn for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOe8-00018G-9w for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33912 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOe8-00017t-5w for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-76-m3LiL0nfMnWk-aQmXOUBMw-1; Tue, 29 Oct 2019 06:22:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2813B1804971 for ; Tue, 29 Oct 2019 10:22:37 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C381160863 for ; Tue, 29 Oct 2019 10:22:36 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 929081132B52; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=II3m01MgY98fc2Dieg7c1F0uusOjdo1u3iC/UkCx+o0=; b=CRPlINOhB+M/rwXztb/qUy1esk15UJwi97bDTWyeUo/Z8La0bvRjHmL7zSeeXaOzTMkIju yG9/IoQxM/8wNcpzFzjFmElGaJUiL/PWhbtdc3xAb86/BLj3m8MdD3xkHIKMXQZdpXlpDl dzrAuOPOWtbN2N8p9sDrckjpPIlmlyg= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 07/19] qapi: De-duplicate entity documentation generation code Date: Tue, 29 Oct 2019 11:22:16 +0100 Message-Id: <20191029102228.20740-8-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: m3LiL0nfMnWk-aQmXOUBMw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" QAPISchemaGenDocVisitor.visit_command() duplicates texi_entity() for its boxed arguments case. The previous commit added another copy in .visit_event(). Replace texi_entity() by texi_type() and texi_msg(). Use texi_msg() for the boxed arguments case as well. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-8-armbru@redhat.com> --- scripts/qapi/doc.py | 82 ++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index f2462c9877..c8c4bda153 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -12,7 +12,7 @@ from qapi.gen import QAPIGenDoc, QAPISchemaVisitor MSG_FMT =3D """ @deftypefn {type} {{}} {name} =20 -{body} +{body}{members}{features}{sections} @end deftypefn =20 """.format @@ -20,7 +20,7 @@ MSG_FMT =3D """ TYPE_FMT =3D """ @deftp {{{type}}} {name} =20 -{body} +{body}{members}{features}{sections} @end deftp =20 """.format @@ -149,7 +149,8 @@ def texi_member(member, desc, suffix): suffix, desc, texi_if(member.ifcond, prefix=3D'@*')) =20 =20 -def texi_members(doc, what, base, variants, member_func): +def texi_members(doc, what, base=3DNone, variants=3DNone, + member_func=3Dtexi_member): """Format the table of members""" items =3D '' for section in doc.args.values(): @@ -182,6 +183,13 @@ def texi_members(doc, what, base, variants, member_fun= c): return '\n@b{%s:}\n@table @asis\n%s@end table\n' % (what, items) =20 =20 +def texi_arguments(doc, boxed_arg_type): + if boxed_arg_type: + return ('\n@b{Arguments:} the members of @code{%s}\n' + % boxed_arg_type.name) + return texi_members(doc, 'Arguments') + + def texi_features(doc): """Format the table of features""" items =3D '' @@ -208,12 +216,22 @@ def texi_sections(doc, ifcond): return body =20 =20 -def texi_entity(doc, what, ifcond, base=3DNone, variants=3DNone, - member_func=3Dtexi_member): - return (texi_body(doc) - + texi_members(doc, what, base, variants, member_func) - + texi_features(doc) - + texi_sections(doc, ifcond)) +def texi_type(typ, doc, ifcond, members): + return TYPE_FMT(type=3Dtyp, + name=3Ddoc.symbol, + body=3Dtexi_body(doc), + members=3Dmembers, + features=3Dtexi_features(doc), + sections=3Dtexi_sections(doc, ifcond)) + + +def texi_msg(typ, doc, ifcond, members): + return MSG_FMT(type=3Dtyp, + name=3Ddoc.symbol, + body=3Dtexi_body(doc), + members=3Dmembers, + features=3Dtexi_features(doc), + sections=3Dtexi_sections(doc, ifcond)) =20 =20 class QAPISchemaGenDocVisitor(QAPISchemaVisitor): @@ -227,56 +245,36 @@ class QAPISchemaGenDocVisitor(QAPISchemaVisitor): =20 def visit_enum_type(self, name, info, ifcond, members, prefix): doc =3D self.cur_doc - self._gen.add(TYPE_FMT(type=3D'Enum', - name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Values', ifcond, - member_func=3Dtexi_enum_va= lue))) + self._gen.add(texi_type('Enum', doc, ifcond, + texi_members(doc, 'Values', + member_func=3Dtexi_enum_value= ))) =20 def visit_object_type(self, name, info, ifcond, base, members, variant= s, features): doc =3D self.cur_doc if base and base.is_implicit(): base =3D None - self._gen.add(TYPE_FMT(type=3D'Object', - name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Members', ifcond, - base, variants))) + self._gen.add(texi_type('Object', doc, ifcond, + texi_members(doc, 'Members', base, variant= s))) =20 def visit_alternate_type(self, name, info, ifcond, variants): doc =3D self.cur_doc - self._gen.add(TYPE_FMT(type=3D'Alternate', - name=3Ddoc.symbol, - body=3Dtexi_entity(doc, 'Members', ifcond))) + self._gen.add(texi_type('Alternate', doc, ifcond, + texi_members(doc, 'Members'))) =20 def visit_command(self, name, info, ifcond, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig, features): doc =3D self.cur_doc - if boxed: - body =3D texi_body(doc) - body +=3D ('\n@b{Arguments:} the members of @code{%s}\n' - % arg_type.name) - body +=3D texi_features(doc) - body +=3D texi_sections(doc, ifcond) - else: - body =3D texi_entity(doc, 'Arguments', ifcond) - self._gen.add(MSG_FMT(type=3D'Command', - name=3Ddoc.symbol, - body=3Dbody)) + self._gen.add(texi_msg('Command', doc, ifcond, + texi_arguments(doc, + arg_type if boxed else None)= )) =20 def visit_event(self, name, info, ifcond, arg_type, boxed): doc =3D self.cur_doc - if boxed: - body =3D texi_body(doc) - body +=3D ('\n@b{Arguments:} the members of @code{%s}\n' - % arg_type.name) - body +=3D texi_features(doc) - body +=3D texi_sections(doc, ifcond) - else: - body =3D texi_entity(doc, 'Arguments', ifcond) - self._gen.add(MSG_FMT(type=3D'Event', - name=3Ddoc.symbol, - body=3Dbody)) + self._gen.add(texi_msg('Event', doc, ifcond, + texi_arguments(doc, + arg_type if boxed else None)= )) =20 def symbol(self, doc, entity): if self._gen._body: --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572346106; cv=none; d=zoho.com; s=zohoarc; b=VG5TWXByL8VwRFQKHBzsMjn8C4uCv5x78lvoSi4QJfF+BCcImUmtlY3QHBY+IDXRHNDG2DYbCZmwKRQOtrbrZFid52l22DFNVHvvoRc01VaHuBaR269ljkp/1WR9XFPvp4HvgxVOUqb/DCvPJVAa0EclXqEs40M4X76zJ1Xf4nQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572346106; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jqNMt4RSIpJPAGi/jqfj8UinKDuq7x/cW6NIANBam4g=; b=IhPx5OKScudvV8R2q05nhUILv2LBEte3wruuplHLvXhXasRx6r0xcR2+g4TlzuaddFSc/UuKxuicrTC0eFn2REJlhgfJas/nNx1ezE++e0zUyuSik4TFnBSy19ZMOxmCpbDbF2tHpHw6CzMGXDmMLq/w86CYVn51SD1n5EgMxLE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572346106408983.9313904522314; Tue, 29 Oct 2019 03:48:26 -0700 (PDT) Received: from localhost ([::1]:54662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPP32-0006Wv-Tn for importer@patchew.org; Tue, 29 Oct 2019 06:48:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57023) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeZ-000632-65 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:23:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeX-0001XX-0Y for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:23:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29523 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeW-0001Wj-TH for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:23:04 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-215-UAAretzaNOmOeNmU5pdJzg-1; Tue, 29 Oct 2019 06:23:01 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 026EB5E4 for ; Tue, 29 Oct 2019 10:23:01 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4A5A1001B08 for ; Tue, 29 Oct 2019 10:23:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 957C31132B56; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jqNMt4RSIpJPAGi/jqfj8UinKDuq7x/cW6NIANBam4g=; b=Dc6Tqps/uB059zrGjPsr90/p7ISDG2S87faflWJhmF4dRcQUYRUGoOX6iuYjMfyMKgHHsy jrnFEbKK/iQZf037VXgc0HofD4HvcE/34Hfxsdv1push/WiPbj9QNVhhPTmLUrP1qI+jho npzStbOWA2Ompll6M5a94egbRp2H0r0= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 08/19] qapi: Split .connect_doc(), .check_doc() off .check() Date: Tue, 29 Oct 2019 11:22:17 +0100 Message-Id: <20191029102228.20740-9-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: UAAretzaNOmOeNmU5pdJzg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Splitting documentation checking off the .check() methods makes them a bit more focused, which is welcome, as some of them are pretty big. It also prepares the ground for the following commits. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-9-armbru@redhat.com> --- scripts/qapi/schema.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index f7d68a35f4..9b62c8d74d 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -51,6 +51,12 @@ class QAPISchemaEntity(object): os.path.dirname(schema.fname)) self._checked =3D True =20 + def connect_doc(self): + pass + + def check_doc(self): + pass + @property def ifcond(self): assert self._checked @@ -217,7 +223,10 @@ class QAPISchemaEnumType(QAPISchemaType): seen =3D {} for m in self.members: m.check_clash(self.info, seen) - if self.doc: + + def connect_doc(self): + if self.doc: + for m in self.members: self.doc.connect_member(m) =20 def is_implicit(self): @@ -345,8 +354,6 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.local_members: m.check(schema) m.check_clash(self.info, seen) - if self.doc: - self.doc.connect_member(m) members =3D seen.values() =20 if self.variants: @@ -358,9 +365,6 @@ class QAPISchemaObjectType(QAPISchemaType): for f in self.features: f.check_clash(self.info, seen) =20 - if self.doc: - self.doc.check() - self.members =3D members # mark completed =20 # Check that the members of this type do not cause duplicate JSON memb= ers, @@ -372,6 +376,15 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.members: m.check_clash(info, seen) =20 + def connect_doc(self): + if self.doc: + for m in self.local_members: + self.doc.connect_member(m) + + def check_doc(self): + if self.doc: + self.doc.check() + @property def ifcond(self): assert self._checked @@ -639,8 +652,13 @@ class QAPISchemaAlternateType(QAPISchemaType): "%s can't be distinguished from '%s'" % (v.describe(self.info), types_seen[qt])) types_seen[qt] =3D v.name - if self.doc: + + def connect_doc(self): + if self.doc: + for v in self.variants.variants: self.doc.connect_member(v) + + def check_doc(self): if self.doc: self.doc.check() =20 @@ -1043,6 +1061,8 @@ class QAPISchema(object): def check(self): for ent in self._entity_list: ent.check(self) + ent.connect_doc() + ent.check_doc() =20 def visit(self, visitor): visitor.visit_begin(self) --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572344674; cv=none; d=zoho.com; s=zohoarc; b=LPdsfkjN29IDuC4p58/O127tR9IlsYAcNKtKNwtuYBuWblkBi+txDAZDw+JMigbmoydCQ8IncKwPOWtspnuY9Y/Q3tdVgX9k3k7+2+45w815m7+uaTgCVHO04Sw6s4CHz8ldfBSRAuzujsSKdcCoNhEARorNC7MAtLl1ZJRWwCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572344674; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+bs0n5JYoSHvTctyXcbCXY19cUjHnJPcItocSem1xdE=; b=SqTCDMlVgwSxanYXixyB3IV8DyQ3hPihI7kfjK0TImtTetJQixGmgogBK8I3h7brua7mx0+jIYX3EDpiQI57iQZE+6ncLNRK02+I+KDT9sOi/MYyCNfiBPekTCzQHlgCW91kMsNzPu17yfCJ68maWMECToqXfwaCJJAuWk3A9sM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572344674202677.6268989840554; Tue, 29 Oct 2019 03:24:34 -0700 (PDT) Received: from localhost ([::1]:54384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOfw-0007C5-DH for importer@patchew.org; Tue, 29 Oct 2019 06:24:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56853) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeE-0005W6-CF for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeD-0001DG-7F for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:46 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:41622 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeD-0001D5-3t for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-Mltw2CKxNMu_v03n5RhimQ-1; Tue, 29 Oct 2019 06:22:43 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C8171005500 for ; Tue, 29 Oct 2019 10:22:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7F0D1001B09 for ; Tue, 29 Oct 2019 10:22:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9867D1132B3B; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+bs0n5JYoSHvTctyXcbCXY19cUjHnJPcItocSem1xdE=; b=HH+V79T61iKhbwX/wcofXll7NPY4SDBWtbVtravQk3ve/UTBozTfb0utKCDQNP+1Ii5W2i iCrUkqe67vZIK7TsumQOcOdZZt3pL1NLYjFSU0YcN46uf7DDC0/4JcxreJvkiFLUAX81I3 S3POT/RHKdbKmZzf4N+4n+U9NhHAeEY= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 09/19] qapi: Fix enum doc comment checking Date: Tue, 29 Oct 2019 11:22:18 +0100 Message-Id: <20191029102228.20740-10-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: Mltw2CKxNMu_v03n5RhimQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Enumeration type documentation comments are not checked, as demonstrated by test doc-bad-enum-member. This is because we neglect to call self.doc.check() for enumeration types. Messed up in 816a57cd6e "qapi: Fix detection of bogus member documentation". Fix it. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-10-armbru@redhat.com> --- scripts/qapi/schema.py | 4 ++++ tests/qapi-schema/doc-bad-enum-member.err | 1 + tests/qapi-schema/doc-bad-enum-member.json | 1 - tests/qapi-schema/doc-bad-enum-member.out | 21 --------------------- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 9b62c8d74d..0381e3cb40 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -229,6 +229,10 @@ class QAPISchemaEnumType(QAPISchemaType): for m in self.members: self.doc.connect_member(m) =20 + def check_doc(self): + if self.doc: + self.doc.check() + def is_implicit(self): # See QAPISchema._make_implicit_enum_type() and ._def_predefineds() return self.name.endswith('Kind') or self.name =3D=3D 'QType' diff --git a/tests/qapi-schema/doc-bad-enum-member.err b/tests/qapi-schema/= doc-bad-enum-member.err index e69de29bb2..dfa1e786d7 100644 --- a/tests/qapi-schema/doc-bad-enum-member.err +++ b/tests/qapi-schema/doc-bad-enum-member.err @@ -0,0 +1 @@ +doc-bad-enum-member.json:3: the following documented members are not in th= e declaration: a diff --git a/tests/qapi-schema/doc-bad-enum-member.json b/tests/qapi-schema= /doc-bad-enum-member.json index 9f32fe64b4..9cab35c6e8 100644 --- a/tests/qapi-schema/doc-bad-enum-member.json +++ b/tests/qapi-schema/doc-bad-enum-member.json @@ -1,5 +1,4 @@ # Members listed in the doc comment must exist in the actual schema -# BUG: nonexistent @a is not rejected =20 ## # @Foo: diff --git a/tests/qapi-schema/doc-bad-enum-member.out b/tests/qapi-schema/= doc-bad-enum-member.out index 6ca31c1e9b..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-enum-member.out +++ b/tests/qapi-schema/doc-bad-enum-member.out @@ -1,21 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-enum-member.json -enum Foo - member b -doc symbol=3DFoo - body=3D - - arg=3Da -a - arg=3Db -b --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345466; cv=none; d=zoho.com; s=zohoarc; b=li2HETosAKcBTeaoBMtDWgwudHM4RuQUAJSnJx/70PT1dRZ1ivFUlqKHG/Ti4c69kgPYjDPnEmDOqXa3WowPeAY0zYsokuEPrRyXIWHZD1D3KYQ55LxsOLHSh7kxIxXTM/bWIzscc1jNZU4wRxlA/1sJ+EM141FRCP6vxIYRVWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345466; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v0sDzd1QgfzfoduOKf+MrIaSH480l27auLMgWPhFZOU=; b=d8A9bzSbfgk9UIDzp4XgBeYnWiGbitelLkIsulVEF47GyvPNI3WUwqsV83ZnWP/Mqfk9mza01S0n3scG5E225+GUD3X3RLlpawxGPp3nJN01PnUceDSnT2QGDJfigsSqlsIo0Wsfymxb3UonCf6PpQjHlQv7NwM01rkjx87tMz0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345466841281.9100187776446; Tue, 29 Oct 2019 03:37:46 -0700 (PDT) Received: from localhost ([::1]:54528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOsj-0005YF-LL for importer@patchew.org; Tue, 29 Oct 2019 06:37:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56888) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeG-0005Zc-R5 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeF-0001F9-8z for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33146 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeF-0001Da-3x for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-cULfyEMmPciLtnwKqlsYJg-1; Tue, 29 Oct 2019 06:22:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F9E885B6EE for ; Tue, 29 Oct 2019 10:22:43 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9C815C1B2 for ; Tue, 29 Oct 2019 10:22:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9B6381132A09; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v0sDzd1QgfzfoduOKf+MrIaSH480l27auLMgWPhFZOU=; b=RHqeQ5tTbMkGXxflvw9YVvA4Y5Rl2DLCH66gd8ndmtf/9njGUviFhUAQusW67wHwltbN39 LseBdMMUvXGYz4YlOqWDhz8zOVqEvJ4Ue9ytcBiXkNexu6RNliHKkLcaSLCHgtDxi5d+yU bnckImPO1b/hbm2U2d47hmMljYkSkS0= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 10/19] qapi: Clean up doc comment checking for implicit union base Date: Tue, 29 Oct 2019 11:22:19 +0100 Message-Id: <20191029102228.20740-11-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: cULfyEMmPciLtnwKqlsYJg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" An object type's doc comment describes the type's members, less the ones defined in a named base type. Cases: * Struct: the members are defined in 'data' and inherited from 'base'. Since the base type cannot be implicit, the doc comment describes just 'data'. * Simple union: the only member is the implicit tag member @type, and the doc comment describes it. * Flat union with implicit base type: the members are defined in 'base', and the doc comment describes it. * Flat union with named base type: the members are inherited from 'base'. The doc comment describes no members. Before we can check a doc comment with .check_doc(), we need .connect_doc() connect each of its "argument sections" to the member it documents. For structs and simple unions, this is straightforward: the members in question are in .local_members, and .connect_doc() connects them. For flat unions with a named base type, it's trivial: .local_members is empty, and .connect_doc() does nothing. For flat unions with an implicit base type, it's tricky. We have QAPISchema._make_implicit_object_type() forward the union's doc comment to the implicit base type, so that the base type's .connect_doc() connects the members. The union's .connect_doc() does nothing, as .local_members is empty. Dirt effect: we check the doc comment twice, once for the union type, and once for the implicit base type. This is needlessly brittle and hard to understand. Clean up as follows. Make the union's .connect_doc() connect an implicit base's members itself. Do not forward the union's doc comment to its implicit base type. Requires extending .connect_doc() so it can work with a doc comment other than self.doc. Add an optional argument for that. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-11-armbru@redhat.com> --- scripts/qapi/schema.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 0381e3cb40..c16dce1fe0 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -51,7 +51,7 @@ class QAPISchemaEntity(object): os.path.dirname(schema.fname)) self._checked =3D True =20 - def connect_doc(self): + def connect_doc(self, doc=3DNone): pass =20 def check_doc(self): @@ -224,10 +224,11 @@ class QAPISchemaEnumType(QAPISchemaType): for m in self.members: m.check_clash(self.info, seen) =20 - def connect_doc(self): - if self.doc: + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: for m in self.members: - self.doc.connect_member(m) + doc.connect_member(m) =20 def check_doc(self): if self.doc: @@ -380,10 +381,13 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.members: m.check_clash(info, seen) =20 - def connect_doc(self): - if self.doc: + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: + if self.base and self.base.is_implicit(): + self.base.connect_doc(doc) for m in self.local_members: - self.doc.connect_member(m) + doc.connect_member(m) =20 def check_doc(self): if self.doc: @@ -657,10 +661,11 @@ class QAPISchemaAlternateType(QAPISchemaType): % (v.describe(self.info), types_seen[qt])) types_seen[qt] =3D v.name =20 - def connect_doc(self): - if self.doc: + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: for v in self.variants.variants: - self.doc.connect_member(v) + doc.connect_member(v) =20 def check_doc(self): if self.doc: @@ -974,7 +979,7 @@ class QAPISchema(object): tag_member =3D None if isinstance(base, dict): base =3D self._make_implicit_object_type( - name, info, doc, ifcond, + name, info, None, ifcond, 'base', self._make_members(base, info)) if tag_name: variants =3D [self._make_variant(key, value['type'], --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345720; cv=none; d=zoho.com; s=zohoarc; b=kmJO480Biy+WP6sO+g6O72/tlvjwGhq4pzhzDF73vqIhiOwan33xrJ3F4I7zGWrDY3SnK4Gxgpfi+su/l4/+lNdrDlvPv9mRvzU/mJOTdvPGqJye31ovw2qd3wuQiGppk0Td5ROgpDWSyiveTwxPatkiJX1MdAri+8pMYLjTRTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345720; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+JMn6pPjR9wgY+pG0VV/+OUc79f2GZ/WW4gJ5aof4Ig=; b=a7XWQ7ZQE1rqVv1ZQMuw2qkD5tgH8eoF2j7V8MRQ4DGp6TbnnM8XKdtIqJk9LURqWsmA2eRfcrmBIjzJnGYz1W+uHHvqgB8Vk/Y0718JZ/j/tk0QOkioMyWTHpYTqr5/JDqit4ZwLnrTTCQiA+2MW092T+zajIYgTgDnthk+7Es= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345720059732.8183146767121; Tue, 29 Oct 2019 03:42:00 -0700 (PDT) Received: from localhost ([::1]:54584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOwn-00015Z-P8 for importer@patchew.org; Tue, 29 Oct 2019 06:41:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56923) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeJ-0005eJ-Jx for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeH-0001JU-TH for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:51 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:53174 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeH-0001Iw-PR for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:49 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-333-ni2g7APMOn6cx0npGh-41Q-1; Tue, 29 Oct 2019 06:22:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4D875E4 for ; Tue, 29 Oct 2019 10:22:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AB725C1B2 for ; Tue, 29 Oct 2019 10:22:44 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9E6B211329D0; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+JMn6pPjR9wgY+pG0VV/+OUc79f2GZ/WW4gJ5aof4Ig=; b=hlrKh2whyBueBAMa4U1a21g1UtlQuUGXYO4pae2DfKfzobR3cy/xz2ysVqrNVoTpYzpDtE K54RZfjskX0nh6rBt3EhSJSmb8o3d2SBuEVQPjdrgp2S7E5QsLR/fWOFFwaNnlNLoeiQow Ydi9BHAsqR+KehslHqJMY53RgFy7+fc= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 11/19] qapi: Fix doc comment checking for commands and events Date: Tue, 29 Oct 2019 11:22:20 +0100 Message-Id: <20191029102228.20740-12-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: ni2g7APMOn6cx0npGh-41Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When a command's 'data' is an object, its doc comment describes the arguments defined there. When 'data' names a type, the doc comment does not describe arguments. Instead, the doc generator inserts a pointer to the named type. An event's doc comment works the same. We don't actually check doc comments for commands and events. Instead, QAPISchema._def_command() forwards the doc comment to the implicit argument type, where it gets checked. Works because the check only cares for the implicit argument type's members. Not only is this needlessly hard to understand, it actually falls apart in two cases: * When 'data' is empty, there is nothing to forward to, and the doc comment remains unchecked. Demonstrated by test doc-bad-event-arg. * When 'data' names a type, we can't forward, as the type has its own doc comment. The command or event's doc comment remains unchecked. Demonstrated by test doc-bad-boxed-command-arg. The forwarding goes back to commit 069fb5b250 "qapi: Prepare for requiring more complete documentation", put to use in commit 816a57cd6e "qapi: Fix detection of bogus member documentation". That fix was incomplete. To fix this, make QAPISchemaCommand and QAPISchemaEvent check doc comments, and drop the forwarding of doc comments to implicit argument types. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-12-armbru@redhat.com> --- qapi/net.json | 2 -- scripts/qapi/doc.py | 1 + scripts/qapi/schema.py | 24 +++++++++++++++-- .../qapi-schema/doc-bad-boxed-command-arg.err | 1 + .../doc-bad-boxed-command-arg.json | 1 - .../qapi-schema/doc-bad-boxed-command-arg.out | 26 ------------------- tests/qapi-schema/doc-bad-event-arg.err | 1 + tests/qapi-schema/doc-bad-event-arg.json | 1 - tests/qapi-schema/doc-bad-event-arg.out | 19 -------------- 9 files changed, 25 insertions(+), 51 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 728990f4fb..4c96137811 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -723,8 +723,6 @@ # Trigger generation of broadcast RARP frames to update network switches. # This can be useful when network bonds fail-over the active slave. # -# @params: AnnounceParameters giving timing and repetition count of announ= ce -# # Example: # # -> { "execute": "announce-self", diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index c8c4bda153..6f1c17f71f 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -185,6 +185,7 @@ def texi_members(doc, what, base=3DNone, variants=3DNon= e, =20 def texi_arguments(doc, boxed_arg_type): if boxed_arg_type: + assert not doc.args return ('\n@b{Arguments:} the members of @code{%s}\n' % boxed_arg_type.name) return texi_members(doc, 'Arguments') diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index c16dce1fe0..06e37c9c49 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -739,6 +739,16 @@ class QAPISchemaCommand(QAPISchemaEntity): for f in self.features: f.check_clash(self.info, seen) =20 + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: + if self.arg_type and self.arg_type.is_implicit(): + self.arg_type.connect_doc(doc) + + def check_doc(self): + if self.doc: + self.doc.check() + def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_command(self.name, self.info, self.ifcond, @@ -775,6 +785,16 @@ class QAPISchemaEvent(QAPISchemaEntity): "event's 'data' can take %s only with 'boxed': true" % self.arg_type.describe()) =20 + def connect_doc(self, doc=3DNone): + doc =3D doc or self.doc + if doc: + if self.arg_type and self.arg_type.is_implicit(): + self.arg_type.connect_doc(doc) + + def check_doc(self): + if self.doc: + self.doc.check() + def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_event(self.name, self.info, self.ifcond, @@ -1026,7 +1046,7 @@ class QAPISchema(object): features =3D expr.get('features', []) if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, doc, ifcond, 'arg', self._make_members(data, i= nfo)) + name, info, None, ifcond, 'arg', self._make_members(data, = info)) if isinstance(rets, list): assert len(rets) =3D=3D 1 rets =3D self._make_array_type(rets[0], info) @@ -1042,7 +1062,7 @@ class QAPISchema(object): ifcond =3D expr.get('if') if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, doc, ifcond, 'arg', self._make_members(data, i= nfo)) + name, info, None, ifcond, 'arg', self._make_members(data, = info)) self._def_entity(QAPISchemaEvent(name, info, doc, ifcond, data, bo= xed)) =20 def _def_exprs(self, exprs): diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.err b/tests/qapi-s= chema/doc-bad-boxed-command-arg.err index e69de29bb2..e1101b1667 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.err +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.err @@ -0,0 +1 @@ +doc-bad-boxed-command-arg.json:9: the following documented members are not= in the declaration: a diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.json b/tests/qapi-= schema/doc-bad-boxed-command-arg.json index 2c265d2ca3..bd143241ec 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.json +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.json @@ -1,5 +1,4 @@ # Boxed arguments are not to be documented with the command -# BUG: not rejected =20 ## # @Args: diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.out b/tests/qapi-s= chema/doc-bad-boxed-command-arg.out index 4ccd788253..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.out +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.out @@ -1,26 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-boxed-command-arg.json -object Args - member a: int optional=3DFalse -command cmd-boxed Args -> None - gen=3DTrue success_response=3DTrue boxed=3DTrue oob=3DFalse preconfig= =3DFalse -doc symbol=3DArgs - body=3D - - arg=3Da -an argument -doc symbol=3Dcmd-boxed - body=3D - - arg=3Da -bogus diff --git a/tests/qapi-schema/doc-bad-event-arg.err b/tests/qapi-schema/do= c-bad-event-arg.err index e69de29bb2..114ff4a3c7 100644 --- a/tests/qapi-schema/doc-bad-event-arg.err +++ b/tests/qapi-schema/doc-bad-event-arg.err @@ -0,0 +1 @@ +doc-bad-event-arg.json:3: the following documented members are not in the = declaration: a diff --git a/tests/qapi-schema/doc-bad-event-arg.json b/tests/qapi-schema/d= oc-bad-event-arg.json index 80d4e1240b..23c83cc81f 100644 --- a/tests/qapi-schema/doc-bad-event-arg.json +++ b/tests/qapi-schema/doc-bad-event-arg.json @@ -1,5 +1,4 @@ # Arguments listed in the doc comment must exist in the actual schema -# BUG: nonexistent @a is not rejected =20 ## # @FOO: diff --git a/tests/qapi-schema/doc-bad-event-arg.out b/tests/qapi-schema/do= c-bad-event-arg.out index ad0367cd45..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-event-arg.out +++ b/tests/qapi-schema/doc-bad-event-arg.out @@ -1,19 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-event-arg.json -event FOO None - boxed=3DFalse -doc symbol=3DFOO - body=3D - - arg=3Da -a --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345011; cv=none; d=zoho.com; s=zohoarc; b=AtmJFE+U3XFHVKZWV5eUd+h98008w1JhE+AlicKLHyJlIiyz41gLcwTHPPRxNWzIaffbpjo3vXJEu9nUb6IZv5ElA+m17fd56A0uCr/SQU0diFwfQSJtkYSTHokMtnl8apiUdIIzxzBLrCukMQhkI5I+DI5GzbdXZQmi/EOz1N4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345011; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y9Ey/EUrymiudN60r02MqqCrJg8LPl6HqqAmQ4TOoVM=; b=FN6C1WWKwla830TzkrFLE41++Nn8a6wtM1N1cBoNPDsnErjNZcFaqbvd/uVFruZdCrgSma9BaHFtiMGIe92VMW/6lNZ7uuHR7TDi1recvZz6fBSxZcZmIp3rJCFKmGC6p6kz43MRtVgnWWTV0Mw+6J9YBeWnBGiTAU/PRajfE2M= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157234501156180.27471228135084; Tue, 29 Oct 2019 03:30:11 -0700 (PDT) Received: from localhost ([::1]:54436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOlN-0005eL-2w for importer@patchew.org; Tue, 29 Oct 2019 06:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56808) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeA-0005Te-LQ for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOe9-000194-4v for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:42 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57616 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOe9-00018b-0Y for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-bN8FrCo6NfqZkv_7GeYhWg-1; Tue, 29 Oct 2019 06:22:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B33F5107AD28 for ; Tue, 29 Oct 2019 10:22:38 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80B1860BF1 for ; Tue, 29 Oct 2019 10:22:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A15941132941; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y9Ey/EUrymiudN60r02MqqCrJg8LPl6HqqAmQ4TOoVM=; b=OgidRPSaS4Ok11OmlmwHAlYjA80m1UCJEqHqE1f7I1cViAVqJRkXGappbhsm2whFaAlgNh 5FB8COG2H2/QhtdvbxSqOz5TlrgM8bk56yjamzi2Ot7Ii1R+XinpOh5DWgWvE4BQvY64tK jFf2inj9c68O1obK2NOggCidmAA2Fkg= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 12/19] qapi: Simplify ._make_implicit_object_type() Date: Tue, 29 Oct 2019 11:22:21 +0100 Message-Id: <20191029102228.20740-13-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: bN8FrCo6NfqZkv_7GeYhWg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" All callers now pass doc=3DNone. Drop the argument. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-13-armbru@redhat.com> --- scripts/qapi/schema.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 06e37c9c49..27da4e0f7d 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -920,8 +920,7 @@ class QAPISchema(object): self._def_entity(QAPISchemaArrayType(name, info, element_type)) return name =20 - def _make_implicit_object_type(self, name, info, doc, ifcond, - role, members): + def _make_implicit_object_type(self, name, info, ifcond, role, members= ): if not members: return None # See also QAPISchemaObjectTypeMember.describe() @@ -939,7 +938,7 @@ class QAPISchema(object): # TODO kill simple unions or implement the disjunction assert (ifcond or []) =3D=3D typ._ifcond # pylint: disable=3Dp= rotected-access else: - self._def_entity(QAPISchemaObjectType(name, info, doc, ifcond, + self._def_entity(QAPISchemaObjectType(name, info, None, ifcond, None, members, None, [])) return name =20 @@ -986,7 +985,7 @@ class QAPISchema(object): assert len(typ) =3D=3D 1 typ =3D self._make_array_type(typ[0], info) typ =3D self._make_implicit_object_type( - typ, info, None, self.lookup_type(typ), + typ, info, self.lookup_type(typ), 'wrapper', [self._make_member('data', typ, None, info)]) return QAPISchemaObjectTypeVariant(case, info, typ, ifcond) =20 @@ -999,7 +998,7 @@ class QAPISchema(object): tag_member =3D None if isinstance(base, dict): base =3D self._make_implicit_object_type( - name, info, None, ifcond, + name, info, ifcond, 'base', self._make_members(base, info)) if tag_name: variants =3D [self._make_variant(key, value['type'], @@ -1046,7 +1045,7 @@ class QAPISchema(object): features =3D expr.get('features', []) if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, None, ifcond, 'arg', self._make_members(data, = info)) + name, info, ifcond, 'arg', self._make_members(data, info)) if isinstance(rets, list): assert len(rets) =3D=3D 1 rets =3D self._make_array_type(rets[0], info) @@ -1062,7 +1061,7 @@ class QAPISchema(object): ifcond =3D expr.get('if') if isinstance(data, OrderedDict): data =3D self._make_implicit_object_type( - name, info, None, ifcond, 'arg', self._make_members(data, = info)) + name, info, ifcond, 'arg', self._make_members(data, info)) self._def_entity(QAPISchemaEvent(name, info, doc, ifcond, data, bo= xed)) =20 def _def_exprs(self, exprs): --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572344905; cv=none; d=zoho.com; s=zohoarc; b=PqBFbiSKRlQaK+t2sHa8HqPCQwJjgblAlkbO5sfeOX59HGv0SiEWCzV6FEoiPfXUa3CGwuus8rWvtHYxnC2/zCN+AEQ1Z7jbqutK6CFp3tYRKkSxBuUN4X0hz34y4OUyR0fGNUz14kE1eXYK0OlzuoEK6TRN2T8IzAncOMgprw0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572344905; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7ndEainXywempsWUxg5D0tGL2kVdPa3byjMpawz38sI=; b=Unx08gF2NvyhREeBS0DaqniHzkvf7Vn4eoR0WIhyTyB2qlVLvttb4wvj6Cuu57qLqHmjrHhMamrk3zIqHsk24LK18pmOPq4VxkrPqG/RvX28TeC/iWljJQqduwE89sP/4FYibbie5Cl3UwbVGYn+E02E1RSOwZWSWC0+bEkhEHQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572344905096934.398092283081; Tue, 29 Oct 2019 03:28:25 -0700 (PDT) Received: from localhost ([::1]:54424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOjf-0003Jd-5C for importer@patchew.org; Tue, 29 Oct 2019 06:28:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56864) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeF-0005Wz-9g for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeE-0001Dj-1b for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28908 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeD-0001DS-To for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-114-til2AhEPPqCfoKmxAiBQHA-1; Tue, 29 Oct 2019 06:22:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1E7681A334 for ; Tue, 29 Oct 2019 10:22:42 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1C7A5D6C3 for ; Tue, 29 Oct 2019 10:22:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A45A711328C1; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ndEainXywempsWUxg5D0tGL2kVdPa3byjMpawz38sI=; b=AOQFMywz1JHEzJ9S27DKSRwstnHvOF93F5pvW83C21gIVob/ml8y6fzZg8i0TTWmf3XT9k 2/E5q8iLIByINEUQ8R2vcvjpnFMyMawl9YbQ8kSnQ2XU5+nzpLRBUYUrkgE7Uy/WXLCY9d xvN+yhgMEbuUPRYyND6BedSHXxYbPBI= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 13/19] qapi: Eliminate .check_doc() overrides Date: Tue, 29 Oct 2019 11:22:22 +0100 Message-Id: <20191029102228.20740-14-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: til2AhEPPqCfoKmxAiBQHA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" All sub-classes of QAPISchemaEntity now override .check_doc() the same way, except for QAPISchemaType and and QAPISchemaArrayType. Put the overrides' code in QAPISchemaEntity.check_doc(), and drop the overrides. QAPISchemaType doesn't care because it's abstract. QAPISchemaArrayType doesn't care because its .doc is always None. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-14-armbru@redhat.com> --- scripts/qapi/schema.py | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 27da4e0f7d..ee510f129b 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -55,7 +55,8 @@ class QAPISchemaEntity(object): pass =20 def check_doc(self): - pass + if self.doc: + self.doc.check() =20 @property def ifcond(self): @@ -230,10 +231,6 @@ class QAPISchemaEnumType(QAPISchemaType): for m in self.members: doc.connect_member(m) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def is_implicit(self): # See QAPISchema._make_implicit_enum_type() and ._def_predefineds() return self.name.endswith('Kind') or self.name =3D=3D 'QType' @@ -389,10 +386,6 @@ class QAPISchemaObjectType(QAPISchemaType): for m in self.local_members: doc.connect_member(m) =20 - def check_doc(self): - if self.doc: - self.doc.check() - @property def ifcond(self): assert self._checked @@ -667,10 +660,6 @@ class QAPISchemaAlternateType(QAPISchemaType): for v in self.variants.variants: doc.connect_member(v) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def c_type(self): return c_name(self.name) + pointer_suffix =20 @@ -745,10 +734,6 @@ class QAPISchemaCommand(QAPISchemaEntity): if self.arg_type and self.arg_type.is_implicit(): self.arg_type.connect_doc(doc) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_command(self.name, self.info, self.ifcond, @@ -791,10 +776,6 @@ class QAPISchemaEvent(QAPISchemaEntity): if self.arg_type and self.arg_type.is_implicit(): self.arg_type.connect_doc(doc) =20 - def check_doc(self): - if self.doc: - self.doc.check() - def visit(self, visitor): QAPISchemaEntity.visit(self, visitor) visitor.visit_event(self.name, self.info, self.ifcond, --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345229; cv=none; d=zoho.com; s=zohoarc; b=YjjpnNr1t4BuaFhM/VZpQ1lBWV59cbinLIde87SsCiMs9DeOGjWUFLoBmgZ/mPBkHDvIzO/u4+cdmYiXP8NWK4zyez7DtLJHz8bvUvn8UM6hPzlI5pJA5qqrF3S3ArwOVE7zGkCmSAgsJDEgyKe/UXGvacjbDIAJx/yim4lcsdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345229; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=K9zyM7Nhkvqxf/eDuzfTkeYrVz0KroKSzD8sZvcH50U=; b=axm8u2BU9aNU38tejcBgi1CtbD/w9jndBITUg6+uFr9V+3/JRV/yaco1FuGyPXjsMpSGEpuqhniqw3eZ27ot6y3fakf7b9HqLlVZRg7zmj6jDZa2Q2jO7yfcnVXPlimS+zASqIa2Z7c5byGwDunMefnDnwaSLQ9MWfMlwWzSJlI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345229221870.2175368817346; Tue, 29 Oct 2019 03:33:49 -0700 (PDT) Received: from localhost ([::1]:54466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOoq-0000Uu-BH for importer@patchew.org; Tue, 29 Oct 2019 06:33:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56893) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeH-0005am-Di for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeG-0001Gw-5N for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:36559 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeG-0001GW-28 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-149-VfxINnwjOB-qgTfq0op34g-1; Tue, 29 Oct 2019 06:22:44 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6B49476 for ; Tue, 29 Oct 2019 10:22:43 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A5A4C60870 for ; Tue, 29 Oct 2019 10:22:43 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A7538113287A; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K9zyM7Nhkvqxf/eDuzfTkeYrVz0KroKSzD8sZvcH50U=; b=YAdLBQ0Heii7svb1Bgm429GEiHNOt8JwbQQJXwlM543Cqm4TIFf67Z8duX0UEpTAxLC1FE LvlXJr89GV5tNzTP+kk9wBh6p0lKZHrrU4Dy6zlZHfxWGZkjflWAKNt08LbxkLJSnRPPiV o6tlr0PEboGqueF8yJEAvWpOJJ6iAgc= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 14/19] qapi: Fold normalize_if() into check_if() Date: Tue, 29 Oct 2019 11:22:23 +0100 Message-Id: <20191029102228.20740-15-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: VfxINnwjOB-qgTfq0op34g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" check_if() is always called together with normalize_if(). Fold the latter into the former. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-15-armbru@redhat.com> --- scripts/qapi/expr.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 7c7394f835..aa0fe69f99 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -95,12 +95,6 @@ def check_flags(expr, info): info, "flag '%s' may only use true value" % key) =20 =20 -def normalize_if(expr): - ifcond =3D expr.get('if') - if isinstance(ifcond, str): - expr['if'] =3D [ifcond] - - def check_if(expr, info, source): =20 def check_if_str(ifcond, info): @@ -126,6 +120,7 @@ def check_if(expr, info, source): check_if_str(elt, info) else: check_if_str(ifcond, info) + expr['if'] =3D [ifcond] =20 =20 def normalize_members(members): @@ -175,7 +170,6 @@ def check_type(value, info, source, raise QAPISemError(info, "%s uses reserved name" % key_source) check_keys(arg, info, key_source, ['type'], ['if']) check_if(arg, info, key_source) - normalize_if(arg) check_type(arg['type'], info, key_source, allow_array=3DTrue) =20 =20 @@ -198,7 +192,6 @@ def check_features(features, info): source =3D "%s '%s'" % (source, f['name']) check_name_str(f['name'], info, source) check_if(f, info, source) - normalize_if(f) =20 =20 def normalize_enum(expr): @@ -227,7 +220,6 @@ def check_enum(expr, info): check_name_str(member['name'], info, source, enum_member=3DTrue, permit_upper=3Dpermit_upper) check_if(member, info, source) - normalize_if(member) =20 =20 def check_struct(expr, info): @@ -259,7 +251,6 @@ def check_union(expr, info): check_name_str(key, info, source) check_keys(value, info, source, ['type'], ['if']) check_if(value, info, source) - normalize_if(value) check_type(value['type'], info, source, allow_array=3Dnot base) =20 =20 @@ -273,7 +264,6 @@ def check_alternate(expr, info): check_name_str(key, info, source) check_keys(value, info, source, ['type'], ['if']) check_if(value, info, source) - normalize_if(value) check_type(value['type'], info, source) =20 =20 @@ -376,7 +366,6 @@ def check_exprs(exprs): else: assert False, 'unexpected meta type' =20 - normalize_if(expr) check_if(expr, info, meta) check_flags(expr, info) =20 --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345641; cv=none; d=zoho.com; s=zohoarc; b=POpM6V2Z4uLzMo8oz/SkaiAotVpx9eiB9ArSAv5++wgfgHRJxIy0JlmBh9lBKNuPKGL2f4QNtaPBvpoPcYcvf+JGr8V5A8DSQhgzZqZ3LyNiU3OURONasBxJXH3GJB9hV5HxbuBqFb8eSuy4yf8UxEN0BJy4UZIZk523rBQIn3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345641; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i2eThPq9BJLPZf9L3adB8f7juJrJrRykI/QSBFmzWMY=; b=ecU7JiT251qUinv/ixXsAbu39wYsTyBxXEF3g6ykGs6LGmUs4ZUYrmihONtf28ye1D3XnTs69KgNNaFgEvest+RaNNDOe0t6iWeSn1RrmPVidmdHoHSjFo/TnIB3AIHcLoBalpdwa0UD1XLKMacfxxIhfOeYY9vWv4stn9pU0iw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157234564154872.24889024122342; Tue, 29 Oct 2019 03:40:41 -0700 (PDT) Received: from localhost ([::1]:54570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOvY-00005T-ED for importer@patchew.org; Tue, 29 Oct 2019 06:40:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56926) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeK-0005ez-16 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeI-0001KK-Rp for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:53238 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeI-0001Jw-OC for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-4TkxXanhPUmRB2GyAvqm1g-1; Tue, 29 Oct 2019 06:22:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3FCAA180496F for ; Tue, 29 Oct 2019 10:22:48 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1033C5D9C3 for ; Tue, 29 Oct 2019 10:22:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AA5991132741; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i2eThPq9BJLPZf9L3adB8f7juJrJrRykI/QSBFmzWMY=; b=GlG/9jLXoXIpgd78ukeHDImfjoasipRlkSKpAUct7h2rqfDviQBoLpWgYYVC/ZBn8PzLeF kg4vl/5M3MbJsVh3GaFVnf9yBJGWBGJanY9BcZtATyd66QzYp3b7IP/KAP54b8Y58VslX6 bfLPWZnXcX9ihKwNME9jbkKlPIPYzno= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 15/19] qapi: Fold normalize_features() into check_features() Date: Tue, 29 Oct 2019 11:22:24 +0100 Message-Id: <20191029102228.20740-16-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: 4TkxXanhPUmRB2GyAvqm1g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" check_features() is always called together with normalize_features(): the former in check_struct() and check_command(), the latter in their caller check_exprs(). Fold the latter into the former. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-16-armbru@redhat.com> --- scripts/qapi/expr.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index aa0fe69f99..66014e2bb2 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -173,17 +173,13 @@ def check_type(value, info, source, check_type(arg['type'], info, key_source, allow_array=3DTrue) =20 =20 -def normalize_features(features): - if isinstance(features, list): - features[:] =3D [f if isinstance(f, dict) else {'name': f} - for f in features] - - def check_features(features, info): if features is None: return if not isinstance(features, list): raise QAPISemError(info, "'features' must be an array") + features[:] =3D [f if isinstance(f, dict) else {'name': f} + for f in features] for f in features: source =3D "'features' member" assert isinstance(f, dict) @@ -347,7 +343,6 @@ def check_exprs(exprs): check_keys(expr, info, meta, ['struct', 'data'], ['base', 'if', 'features']) normalize_members(expr['data']) - normalize_features(expr.get('features')) check_struct(expr, info) elif meta =3D=3D 'command': check_keys(expr, info, meta, @@ -356,7 +351,6 @@ def check_exprs(exprs): 'gen', 'success-response', 'allow-oob', 'allow-preconfig']) normalize_members(expr.get('data')) - normalize_features(expr.get('features')) check_command(expr, info) elif meta =3D=3D 'event': check_keys(expr, info, meta, --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345805; cv=none; d=zoho.com; s=zohoarc; b=BM8UI2LvqQryXu7+BFYvgHeg8b+FYalT/UV3YWsXmw7HbVlor4bu6sFtMWlpcZ46PEr+pPAhk81bG/+5+RAjsAe5A/9PyznhihOqQMYs8H4fy4f2MTiXLXdeEX0BU4/BnKid3yR5qtKshUbAVg9QzWkT37h16Y4m4jEl/GzaiF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345805; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XdEghAFjyk3DnbTpW/iUY4A1QqUqAgUKvtrL5qp70JU=; b=TwBNXyrEr9kHzkNgiQ0ksDyZQ06XU0i6S9VrEMCWTAm4YLPAEGqqL92rarAkgw0Zz6Q7JJOLw99GNyLMZtLu1n7M8t7kMlPYT6cC4Ym6uuP1awuZDYI4K1HoYzinIAyUrNN0tW5jd7bKIjk69Sc2dXox1Nu4CkfhoIHBVv1iVz8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345805782331.2424587612485; Tue, 29 Oct 2019 03:43:25 -0700 (PDT) Received: from localhost ([::1]:54594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOyC-0001zY-Il for importer@patchew.org; Tue, 29 Oct 2019 06:43:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56951) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeM-0005jm-Q6 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeL-0001Nc-Oi for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:54 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:51337 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeL-0001Mz-Ki for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-85-QD67w9oGN62C_sKTe8VH3A-1; Tue, 29 Oct 2019 06:22:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 453E681A334 for ; Tue, 29 Oct 2019 10:22:48 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 167285D9C8 for ; Tue, 29 Oct 2019 10:22:48 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AD4D711326E8; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XdEghAFjyk3DnbTpW/iUY4A1QqUqAgUKvtrL5qp70JU=; b=Hu4HlbuUWcWj8cjglVtNAeyBZX7TROQ0A27wYHQOsXiHZy43LfXKh4iE7lkBJbt1gkCqe0 dHA9D3Hr8zYNoMyyvYzEvnLqfDa8umKmC2OcMimiiMXHM5kvpRM5UA0SZcRdnGOnaC/0KK jldNfI6Mik6Ub+aiBY6Yqb1dO+HyuMM= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 16/19] qapi: Fold normalize_enum() into check_enum() Date: Tue, 29 Oct 2019 11:22:25 +0100 Message-Id: <20191029102228.20740-17-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: QD67w9oGN62C_sKTe8VH3A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" check_features() is always called together with normalize_features(). Fold the latter into the former. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-17-armbru@redhat.com> --- scripts/qapi/expr.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 66014e2bb2..d7a289eded 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -190,12 +190,6 @@ def check_features(features, info): check_if(f, info, source) =20 =20 -def normalize_enum(expr): - if isinstance(expr['data'], list): - expr['data'] =3D [m if isinstance(m, dict) else {'name': m} - for m in expr['data']] - - def check_enum(expr, info): name =3D expr['enum'] members =3D expr['data'] @@ -208,6 +202,8 @@ def check_enum(expr, info): =20 permit_upper =3D name in info.pragma.name_case_whitelist =20 + members[:] =3D [m if isinstance(m, dict) else {'name': m} + for m in members] for member in members: source =3D "'data' member" check_keys(member, info, source, ['name'], ['if']) @@ -325,7 +321,6 @@ def check_exprs(exprs): if meta =3D=3D 'enum': check_keys(expr, info, meta, ['enum', 'data'], ['if', 'prefix']) - normalize_enum(expr) check_enum(expr, info) elif meta =3D=3D 'union': check_keys(expr, info, meta, --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345922; cv=none; d=zoho.com; s=zohoarc; b=ADX3aMS6YckAfe5Wlc+Dugw7yo1BoGIxvcvPBprEB4OJzKk/6OGDuQCM/KZ5DaaUNxmCZ2bieOiroBNDqgLfl+42+jp2iD/aZeG3KVwtlJ8XLKuDg60kH7CMyMaXTlUQDh51pq//1K9toP7gCsSr814QIcC+mI9TmcNZppK6hBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345922; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6PdSov71UGXpNm7DJ43bZBDSsa0rrhme+3USYG+Ez+I=; b=W1HKBQXmScwJcPQTEYveZuL1nbO+lZCwwkaFY0WCxYdbgI9Eimxj9DfEOVQKku9olW1CMEYrrcJiTDf3wpS8BXtAd2kb8McuDF9fn3aWc0XWsX5z6VOQI3DKZnOUCHNkk8wH2udNN0Vt76mwLDhMFSqCI+s4F4QVGz644Z46MMs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345922991651.8736470219502; Tue, 29 Oct 2019 03:45:22 -0700 (PDT) Received: from localhost ([::1]:54626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPP05-0003G8-KR for importer@patchew.org; Tue, 29 Oct 2019 06:45:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56974) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeN-0005lS-UU for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeM-0001O2-94 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:48549 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeM-0001NR-4t for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-2uUfjVWxPd6Jwk0b-kir_Q-1; Tue, 29 Oct 2019 06:22:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 017FA180496F for ; Tue, 29 Oct 2019 10:22:51 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BD87194BE for ; Tue, 29 Oct 2019 10:22:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B04EB11326EC; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6PdSov71UGXpNm7DJ43bZBDSsa0rrhme+3USYG+Ez+I=; b=OnDHmknCv+qVGFOP6I7RT5+r9yOd+dSyGz9IVZlANyvyYzj75TP6HxMihyDXsdHEWKXgCb y1E8v/l1tThkXKtL8R3SXkDVxkBoS57b3UWtXD28cKmke+pN8NDG6ApuyhSFTakIGXLUFv YoMNR7mJ0NiHqHvZ5eEvDJiQu0LU/WQ= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 17/19] qapi: Lift features into QAPISchemaEntity Date: Tue, 29 Oct 2019 11:22:26 +0100 Message-Id: <20191029102228.20740-18-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 2uUfjVWxPd6Jwk0b-kir_Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 6a8c0b5102 "qapi: Add feature flags to struct types" added features to QAPISchemaObjectType. Commit a95daa5093 "qapi: Add feature flags to commands in qapi" added them to QAPISchemaCommand, duplicating the code. Tolerable, but the duplication will only get worse as we add features to more definitions. To de-duplicate, lift features from QAPISchemaObjectType and QAPISchemaCommand into QAPISchemaEntity. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-18-armbru@redhat.com> --- scripts/qapi/schema.py | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index ee510f129b..bdea9482fc 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -27,8 +27,11 @@ from qapi.parser import QAPISchemaParser class QAPISchemaEntity(object): meta =3D None =20 - def __init__(self, name, info, doc, ifcond=3DNone): + def __init__(self, name, info, doc, ifcond=3DNone, features=3DNone): assert name is None or isinstance(name, str) + for f in features or []: + assert isinstance(f, QAPISchemaFeature) + f.set_defined_in(name) self.name =3D name self._module =3D None # For explicitly defined entities, info points to the (explicit) @@ -39,6 +42,7 @@ class QAPISchemaEntity(object): self.info =3D info self.doc =3D doc self._ifcond =3D ifcond or [] + self.features =3D features or [] self._checked =3D False =20 def c_name(self): @@ -49,6 +53,10 @@ class QAPISchemaEntity(object): if self.info: self._module =3D os.path.relpath(self.info.fname, os.path.dirname(schema.fname)) + seen =3D {} + for f in self.features: + f.check_clash(self.info, seen) + self._checked =3D True =20 def connect_doc(self, doc=3DNone): @@ -307,7 +315,7 @@ class QAPISchemaObjectType(QAPISchemaType): # struct has local_members, optional base, and no variants # flat union has base, variants, and no local_members # simple union has local_members, variants, and no base - QAPISchemaType.__init__(self, name, info, doc, ifcond) + QAPISchemaType.__init__(self, name, info, doc, ifcond, features) self.meta =3D 'union' if variants else 'struct' assert base is None or isinstance(base, str) for m in local_members: @@ -316,15 +324,11 @@ class QAPISchemaObjectType(QAPISchemaType): if variants is not None: assert isinstance(variants, QAPISchemaObjectTypeVariants) variants.set_defined_in(name) - for f in features: - assert isinstance(f, QAPISchemaFeature) - f.set_defined_in(name) self._base_name =3D base self.base =3D None self.local_members =3D local_members self.variants =3D variants self.members =3D None - self.features =3D features =20 def check(self, schema): # This calls another type T's .check() exactly when the C @@ -362,11 +366,6 @@ class QAPISchemaObjectType(QAPISchemaType): self.variants.check(schema, seen) self.variants.check_clash(self.info, seen) =20 - # Features are in a name space separate from members - seen =3D {} - for f in self.features: - f.check_clash(self.info, seen) - self.members =3D members # mark completed =20 # Check that the members of this type do not cause duplicate JSON memb= ers, @@ -678,12 +677,9 @@ class QAPISchemaCommand(QAPISchemaEntity): def __init__(self, name, info, doc, ifcond, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig, features): - QAPISchemaEntity.__init__(self, name, info, doc, ifcond) + QAPISchemaEntity.__init__(self, name, info, doc, ifcond, features) assert not arg_type or isinstance(arg_type, str) assert not ret_type or isinstance(ret_type, str) - for f in features: - assert isinstance(f, QAPISchemaFeature) - f.set_defined_in(name) self._arg_type_name =3D arg_type self.arg_type =3D None self._ret_type_name =3D ret_type @@ -693,7 +689,6 @@ class QAPISchemaCommand(QAPISchemaEntity): self.boxed =3D boxed self.allow_oob =3D allow_oob self.allow_preconfig =3D allow_preconfig - self.features =3D features =20 def check(self, schema): QAPISchemaEntity.check(self, schema) @@ -723,11 +718,6 @@ class QAPISchemaCommand(QAPISchemaEntity): "command's 'returns' cannot take %s" % self.ret_type.describe()) =20 - # Features are in a name space separate from members - seen =3D {} - for f in self.features: - f.check_clash(self.info, seen) - def connect_doc(self, doc=3DNone): doc =3D doc or self.doc if doc: --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572345404; cv=none; d=zoho.com; s=zohoarc; b=mkUrdPaqMP2iwfq/ibcFZa7YxS5t5rEqDIrxqnAMa9/LlhWZBdX3LR7DNBalEWJhs1H+BAoY3SUU6YPe+S2sMDAutama6ewH/52kTa56YvHDmGFvEJNiQWJdzfBZu0anOozDH7tH4IZ9yqfkXIPIxQNGks6SfKioWRqSzXPW/rU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572345404; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=f4K2pw9yJ4rE0TJ0CRG2LsovM4oBhSjTvDmaaCufiYw=; b=mCU3gn7uvHJx3Tsvy0KgGdanFWKy/ggsrPADe9vm81fo9VjnrYwMOyII2FK0d02gLGKvSzeCoeku62u9XD1TUB0F7o4D54dU9yG/sX3xtDsgA1bfh0JYTQ4m4+EeifA1mppLzRDKGpl54li6O3+QWBshCgvVfa52G1lbzgiZGvc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572345404520420.34471330078213; Tue, 29 Oct 2019 03:36:44 -0700 (PDT) Received: from localhost ([::1]:54494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOrf-00042u-Pz for importer@patchew.org; Tue, 29 Oct 2019 06:36:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56953) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeM-0005k4-Vf for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeL-0001NL-G5 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:54 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:54926 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeL-0001Mm-CP for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-364-tSPyS3JtOgmfRhnQjziNng-1; Tue, 29 Oct 2019 06:22:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D258F801E64 for ; Tue, 29 Oct 2019 10:22:49 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2C32600F0 for ; Tue, 29 Oct 2019 10:22:42 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B37F111326F0; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f4K2pw9yJ4rE0TJ0CRG2LsovM4oBhSjTvDmaaCufiYw=; b=OYsEcdJn32uwi8hchvxQWOtkTeu+yvAS/QQtYuJJTsPl0g5r56113imdNp6KhFmybqtxXR NcStxho6lgfKP0bXqUlepQEp90gDc7HApEJs/44WkRPTEJ5gJ75gl3RjzaBjZ1Y6wAf/42 wPSLTW1Hw80KIalCUvLWBBqQgGZaVfM= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 18/19] qapi: Polish reporting of bogus member documentation Date: Tue, 29 Oct 2019 11:22:27 +0100 Message-Id: <20191029102228.20740-19-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: tSPyS3JtOgmfRhnQjziNng-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Improve error messages from the following documented members are not in the declaration: a the following documented members are not in the declaration: aa, bb to the more concise documented member 'a' does not exist documented members 'aa', 'bb' do not exist Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-19-armbru@redhat.com> --- scripts/qapi/parser.py | 6 ++++-- tests/qapi-schema/doc-bad-alternate-member.err | 2 +- tests/qapi-schema/doc-bad-boxed-command-arg.err | 2 +- tests/qapi-schema/doc-bad-command-arg.err | 2 +- tests/qapi-schema/doc-bad-enum-member.err | 2 +- tests/qapi-schema/doc-bad-event-arg.err | 2 +- tests/qapi-schema/doc-bad-union-member.err | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index e800876ad1..6c45a00cf4 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -566,5 +566,7 @@ class QAPIDoc(object): if bogus: raise QAPISemError( self.info, - "the following documented members are not in " - "the declaration: %s" % ", ".join(bogus)) + "documented member%s '%s' %s not exist" + % ("s" if len(bogus) > 1 else "", + "', '".join(bogus), + "do" if len(bogus) > 1 else "does")) diff --git a/tests/qapi-schema/doc-bad-alternate-member.err b/tests/qapi-sc= hema/doc-bad-alternate-member.err index a1c282f935..d7286bb57c 100644 --- a/tests/qapi-schema/doc-bad-alternate-member.err +++ b/tests/qapi-schema/doc-bad-alternate-member.err @@ -1 +1 @@ -doc-bad-alternate-member.json:3: the following documented members are not = in the declaration: aa, bb +doc-bad-alternate-member.json:3: documented members 'aa', 'bb' do not exist diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.err b/tests/qapi-s= chema/doc-bad-boxed-command-arg.err index e1101b1667..7137af3ec9 100644 --- a/tests/qapi-schema/doc-bad-boxed-command-arg.err +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.err @@ -1 +1 @@ -doc-bad-boxed-command-arg.json:9: the following documented members are not= in the declaration: a +doc-bad-boxed-command-arg.json:9: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-command-arg.err b/tests/qapi-schema/= doc-bad-command-arg.err index 153ea0330a..18ed076cef 100644 --- a/tests/qapi-schema/doc-bad-command-arg.err +++ b/tests/qapi-schema/doc-bad-command-arg.err @@ -1 +1 @@ -doc-bad-command-arg.json:3: the following documented members are not in th= e declaration: b +doc-bad-command-arg.json:3: documented member 'b' does not exist diff --git a/tests/qapi-schema/doc-bad-enum-member.err b/tests/qapi-schema/= doc-bad-enum-member.err index dfa1e786d7..7efeb47363 100644 --- a/tests/qapi-schema/doc-bad-enum-member.err +++ b/tests/qapi-schema/doc-bad-enum-member.err @@ -1 +1 @@ -doc-bad-enum-member.json:3: the following documented members are not in th= e declaration: a +doc-bad-enum-member.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-event-arg.err b/tests/qapi-schema/do= c-bad-event-arg.err index 114ff4a3c7..d13cacf21f 100644 --- a/tests/qapi-schema/doc-bad-event-arg.err +++ b/tests/qapi-schema/doc-bad-event-arg.err @@ -1 +1 @@ -doc-bad-event-arg.json:3: the following documented members are not in the = declaration: a +doc-bad-event-arg.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-union-member.err b/tests/qapi-schema= /doc-bad-union-member.err index 8b9d36eab1..6dd2726a65 100644 --- a/tests/qapi-schema/doc-bad-union-member.err +++ b/tests/qapi-schema/doc-bad-union-member.err @@ -1 +1 @@ -doc-bad-union-member.json:3: the following documented members are not in t= he declaration: a, b +doc-bad-union-member.json:3: documented members 'a', 'b' do not exist --=20 2.21.0 From nobody Sun Apr 28 18:38:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1572346013; cv=none; d=zoho.com; s=zohoarc; b=B9+GjU/dVlleGgAuf1wt+yuXM5p4lyUfF2DLqYsm3KAK4M26+JTkf7AEiWLdz+1wLyQ9IuB5fqXkDhnlylPIcMieImkhDMRkug1mV8TIYVrvdZOyUGeooZJODfpwzQR/NdSvT3bdhBIOEAq9gxsE6Q78E6hM+E4WCY8u9KsxAXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572346013; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JKwVICVyptStW+1H5B2+rYomcxxf79KECgmCJBaCaSc=; b=EJyOYabqKGcOdEyGi4bMqCg+v4KmZwFYqXsuDU/Ja5x56SUo0qjOq1yIuB1OcOQzAMLe+lxqm8xvu+sd5Yc0iODr7ePTa6Cm8HSU/O9gUTZ89T2cyRMdoTFPkvPRUvLLKIH/fpa0h2vyRUlHhwS3ddN/9R9ffkifn2kFMU+ZA+A= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572346013051390.345830170849; Tue, 29 Oct 2019 03:46:53 -0700 (PDT) Received: from localhost ([::1]:54650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPP1X-0004RK-M0 for importer@patchew.org; Tue, 29 Oct 2019 06:46:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56984) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPOeP-0005oP-OG for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:23:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPOeM-0001Nn-3b for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:57 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:39448 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPOeM-0001NX-07 for qemu-devel@nongnu.org; Tue, 29 Oct 2019 06:22:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-77-4WQltdnqOGut6TUF6gkNDg-1; Tue, 29 Oct 2019 06:22:47 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D8BB61005500 for ; Tue, 29 Oct 2019 10:22:46 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F76D1001B08 for ; Tue, 29 Oct 2019 10:22:46 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B6C5911326F2; Tue, 29 Oct 2019 11:22:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572344573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JKwVICVyptStW+1H5B2+rYomcxxf79KECgmCJBaCaSc=; b=XIsOUWT6XJvMA9pPxs0g+ZoByngunReeyPKW8ZJkyqkUG/NWAp3usQoR/Rbxqaj/lCBPmx jtOzyMTCQUSrF0VPgRyrASDuZIGimhgjKKn6SV0663R1bF9OH97QyBrNDXRrU8pFx4FyN9 Iq/xUio3/hMxEdc2drStGsRfHUjLuWg= From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 19/19] qapi: Check feature documentation against the schema Date: Tue, 29 Oct 2019 11:22:28 +0100 Message-Id: <20191029102228.20740-20-armbru@redhat.com> In-Reply-To: <20191029102228.20740-1-armbru@redhat.com> References: <20191029102228.20740-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 4WQltdnqOGut6TUF6gkNDg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit f3ed93d545 "qapi: Allow documentation for features" neglected to check documentation against the schema. Fix that: check them the same way we check arguments. Signed-off-by: Markus Armbruster Message-Id: <20191024110237.30963-20-armbru@redhat.com> --- scripts/qapi/parser.py | 31 +++++++++++++++++------- scripts/qapi/schema.py | 2 ++ tests/qapi-schema/doc-bad-feature.err | 1 + tests/qapi-schema/doc-bad-feature.json | 1 - tests/qapi-schema/doc-bad-feature.out | 19 --------------- tests/qapi-schema/doc-undoc-feature.err | 2 ++ tests/qapi-schema/doc-undoc-feature.json | 1 - tests/qapi-schema/doc-undoc-feature.out | 21 ---------------- 8 files changed, 27 insertions(+), 51 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 6c45a00cf4..342792e410 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -555,18 +555,31 @@ class QAPIDoc(object): self.args[member.name] =3D QAPIDoc.ArgSection(member.name) self.args[member.name].connect(member) =20 + def connect_feature(self, feature): + if feature.name not in self.features: + raise QAPISemError(feature.info, + "feature '%s' lacks documentation" + % feature.name) + self.features[feature.name] =3D QAPIDoc.ArgSection(feature.nam= e) + self.features[feature.name].connect(feature) + def check_expr(self, expr): if self.has_section('Returns') and 'command' not in expr: raise QAPISemError(self.info, "'Returns:' is only valid for commands") =20 def check(self): - bogus =3D [name for name, section in self.args.items() - if not section.member] - if bogus: - raise QAPISemError( - self.info, - "documented member%s '%s' %s not exist" - % ("s" if len(bogus) > 1 else "", - "', '".join(bogus), - "do" if len(bogus) > 1 else "does")) + + def check_args_section(args, info, what): + bogus =3D [name for name, section in args.items() + if not section.member] + if bogus: + raise QAPISemError( + self.info, + "documented member%s '%s' %s not exist" + % ("s" if len(bogus) > 1 else "", + "', '".join(bogus), + "do" if len(bogus) > 1 else "does")) + + check_args_section(self.args, self.info, 'members') + check_args_section(self.features, self.info, 'features') diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index bdea9482fc..cf0045f34e 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -56,6 +56,8 @@ class QAPISchemaEntity(object): seen =3D {} for f in self.features: f.check_clash(self.info, seen) + if self.doc: + self.doc.connect_feature(f) =20 self._checked =3D True =20 diff --git a/tests/qapi-schema/doc-bad-feature.err b/tests/qapi-schema/doc-= bad-feature.err index e69de29bb2..e4c62adfa3 100644 --- a/tests/qapi-schema/doc-bad-feature.err +++ b/tests/qapi-schema/doc-bad-feature.err @@ -0,0 +1 @@ +doc-bad-feature.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-feature.json b/tests/qapi-schema/doc= -bad-feature.json index 2a78e3b1db..3d49b8e607 100644 --- a/tests/qapi-schema/doc-bad-feature.json +++ b/tests/qapi-schema/doc-bad-feature.json @@ -1,5 +1,4 @@ # Features listed in the doc comment must exist in the actual schema -# BUG: nonexistent @a is not rejected =20 ## # @foo: diff --git a/tests/qapi-schema/doc-bad-feature.out b/tests/qapi-schema/doc-= bad-feature.out index fef4a3e400..e69de29bb2 100644 --- a/tests/qapi-schema/doc-bad-feature.out +++ b/tests/qapi-schema/doc-bad-feature.out @@ -1,19 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-bad-feature.json -command foo None -> None - gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse -doc symbol=3Dfoo - body=3D - - feature=3Da -a diff --git a/tests/qapi-schema/doc-undoc-feature.err b/tests/qapi-schema/do= c-undoc-feature.err index e69de29bb2..62fc82d2b9 100644 --- a/tests/qapi-schema/doc-undoc-feature.err +++ b/tests/qapi-schema/doc-undoc-feature.err @@ -0,0 +1,2 @@ +doc-undoc-feature.json: In command 'foo': +doc-undoc-feature.json:9: feature 'undoc' lacks documentation diff --git a/tests/qapi-schema/doc-undoc-feature.json b/tests/qapi-schema/d= oc-undoc-feature.json index c7650d9974..c52f88e2cd 100644 --- a/tests/qapi-schema/doc-undoc-feature.json +++ b/tests/qapi-schema/doc-undoc-feature.json @@ -1,5 +1,4 @@ # Doc comment must cover all features -# BUG: missing documentation for @undoc not caught =20 ## # @foo: diff --git a/tests/qapi-schema/doc-undoc-feature.out b/tests/qapi-schema/do= c-undoc-feature.out index cdb097361f..e69de29bb2 100644 --- a/tests/qapi-schema/doc-undoc-feature.out +++ b/tests/qapi-schema/doc-undoc-feature.out @@ -1,21 +0,0 @@ -module None -object q_empty -enum QType - prefix QTYPE - member none - member qnull - member qnum - member qstring - member qdict - member qlist - member qbool -module doc-undoc-feature.json -command foo None -> None - gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse - feature undoc - feature doc -doc symbol=3Dfoo - body=3D - - feature=3Ddoc -documented feature --=20 2.21.0