From nobody Mon Feb 9 11:28:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148964731891593.41414222526737; Wed, 15 Mar 2017 23:55:18 -0700 (PDT) Received: from localhost ([::1]:41238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coPJd-0002Sq-FZ for importer@patchew.org; Thu, 16 Mar 2017 02:55:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coOtX-0006AB-KS for qemu-devel@nongnu.org; Thu, 16 Mar 2017 02:28:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coOtS-00079g-9e for qemu-devel@nongnu.org; Thu, 16 Mar 2017 02:28:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32886) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coOtR-00077c-SD for qemu-devel@nongnu.org; Thu, 16 Mar 2017 02:28:14 -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 mx1.redhat.com (Postfix) with ESMTPS id B6AF67E9DA for ; Thu, 16 Mar 2017 06:28:13 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F8515DD66 for ; Thu, 16 Mar 2017 06:28:13 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4987F11384BF; Thu, 16 Mar 2017 07:28:06 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B6AF67E9DA Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B6AF67E9DA From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 07:27:56 +0100 Message-Id: <1489645685-4750-41-git-send-email-armbru@redhat.com> In-Reply-To: <1489645685-4750-1-git-send-email-armbru@redhat.com> References: <1489645685-4750-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 16 Mar 2017 06:28:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL for 2.9 40/49] qapi: Eliminate check_docs() and drop QAPIDoc.expr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move what's left in check_docs() to check_expr(). Delegate the actual checking to new QAPIDoc.check_expr(). QAPIDoc.expr is now unused; drop it. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <1489582656-31133-39-git-send-email-armbru@redhat.com> --- scripts/qapi.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index ca9926b..1aaae8e 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -138,8 +138,6 @@ class QAPIDoc(object): self.sections =3D [] # the current section self.section =3D self.body - # associated expression (to be set by expression parser) - self.expr =3D None =20 def has_section(self, name): """Return True if we have a section with this name.""" @@ -249,6 +247,11 @@ class QAPIDoc(object): self.args[member.name] =3D QAPIDoc.ArgSection(member.name) self.args[member.name].connect(member) =20 + 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") + def check(self): bogus =3D [name for name, section in self.args.iteritems() if not section.member] @@ -316,7 +319,6 @@ class QAPISchemaParser(object): raise QAPISemError( self.cur_doc.info, "Expression documentation required") - self.cur_doc.expr =3D expr expr_elem['doc'] =3D self.cur_doc self.exprs.append(expr_elem) self.cur_doc =3D None @@ -984,6 +986,7 @@ def check_exprs(exprs): for expr_elem in exprs: expr =3D expr_elem['expr'] info =3D expr_elem['info'] + doc =3D expr_elem.get('doc') =20 if 'enum' in expr: check_enum(expr, info) @@ -1000,22 +1003,12 @@ def check_exprs(exprs): else: assert False, 'unexpected meta type' =20 + if doc: + doc.check_expr(expr) + return exprs =20 =20 -def check_definition_doc(doc, expr, info): - if doc.has_section('Returns') and 'command' not in expr: - raise QAPISemError(info, "'Returns:' is only valid for commands") - - -def check_docs(docs): - for doc in docs: - if doc.expr: - check_definition_doc(doc, doc.expr, doc.info) - - return docs - - # # Schema compiler frontend # @@ -1511,7 +1504,7 @@ class QAPISchema(object): try: parser =3D QAPISchemaParser(open(fname, 'r')) self.exprs =3D check_exprs(parser.exprs) - self.docs =3D check_docs(parser.docs) + self.docs =3D parser.docs self._entity_dict =3D {} self._predefining =3D True self._def_predefineds() --=20 2.7.4