From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630697937; cv=none; d=zohomail.com; s=zohoarc; b=BxSe0DJ1o9j2TOqfB5ZMexQZgYRCR6IrmsiAG6PU2Z9ipFuxhvQVsCu0yBNxOlKKHKAx8jyVXOEl8DExcMvLXOeAgVfqQGsHwU3O7IKjUgzAAjV/xOMVJ0BHJK31N92o4qsHy847fxaHkjFRKOW731FYSywwbIlk3A0o/p5g5i8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630697937; h=Content-Type:Content-Transfer-Encoding:Cc: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=+V6piWKKtsMf9Sz6Tt9oc/yE2HRvSfP5VOvoW0gligg=; b=AQCvar5bGZNo16nMQFeP9hWCPnJ5KKOXijba1oPqghmgZvC118vk+0FuBvc2u0k19AwmcMDBKXXUXkYcYMeChs5LEH88FUo81XBADCMe5rde4aFKVm2W7LSA0gvxYFwDbbqgb6x3nzPWXMMXTiZ0cT+mXg1gEu0OJZe2ypbjkw8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630697937102600.4270634248259; Fri, 3 Sep 2021 12:38:57 -0700 (PDT) Received: from localhost ([::1]:51366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF1b-0006EU-Vn for importer@patchew.org; Fri, 03 Sep 2021 15:38:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvD-0005iZ-Hl for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEv9-0003YH-W1 for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:19 -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-122-kpM_e7BmP4mXlX0XigGq8w-1; Fri, 03 Sep 2021 15:32:12 -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 5A2A284A5E3; Fri, 3 Sep 2021 19:32:11 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C8FC60BF1; Fri, 3 Sep 2021 19:32:11 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id BC6BC1138611; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+V6piWKKtsMf9Sz6Tt9oc/yE2HRvSfP5VOvoW0gligg=; b=bxdDk8ancpZl8UfY1V24nIQskZYn/Ig4Y8a9Uf06BXPHuQj1GZwXpyJGk5I/ntITq7NcLV 4ulreRXRKFJzxm+YB3YLcKa2LA9d7Fp7huNtv4LS2B3S0HGRSmYkmlAW+V1thW/hhz1a1y q3RwhaZCxQx8b71FcXg0w0MuCtOMWxY= X-MC-Unique: kpM_e7BmP4mXlX0XigGq8w-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 01/13] qapi: Set boolean value correctly in examples Date: Fri, 3 Sep 2021 21:31:57 +0200 Message-Id: <20210903193209.1426791-2-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Guoyi Tu , Eric Blake Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630697939448100001 Content-Type: text/plain; charset="utf-8" From: Guoyi Tu Signed-off-by: Guoyi Tu Message-Id: Reviewed-by: Eric Blake Signed-off-by: Markus Armbruster --- qapi/trace.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qapi/trace.json b/qapi/trace.json index 47c68f04da..eedfded512 100644 --- a/qapi/trace.json +++ b/qapi/trace.json @@ -99,7 +99,7 @@ # Example: # # -> { "execute": "trace-event-set-state", -# "arguments": { "name": "qemu_memalign", "enable": "true" } } +# "arguments": { "name": "qemu_memalign", "enable": true } } # <- { "return": {} } # ## --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698221; cv=none; d=zohomail.com; s=zohoarc; b=GikVLcCNTzFhcmuWOyBY6lOADP98dS173lVhXB0+B1XssCj13ZSKPrzcB2NaKD6GIcFwh3Yctolgf+Aa40ckhHj3kffirD4qkLdnU/P3/F9tV4CB55jF7NK780jPUel/yZNyQteEsvDhD5og+zeXJd16uEqvPA/eesAv7dX2tI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698221; h=Content-Type:Content-Transfer-Encoding:Cc: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=uTHirdJSbvfam5rHkKibIPiLKhRROSvQu0jDEbM6OqA=; b=QNNusvJc15cD8r0Y4VJ47X5jpPm7GUATBBAvD05xXGlnI/Ce2UjDuCCuDa8d3XO9KAB7d3CIBHtpiyfDRuwRNy/7DSkkVcZ//3QuWV5SkvNoFBy2USquI52DAGl1dgg1jQq3rQ63x9UK7RGFD3/SFdxPM+yxh1EAdaBc+hxhaMQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163069822184494.70699949261223; Fri, 3 Sep 2021 12:43:41 -0700 (PDT) Received: from localhost ([::1]:37138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF6C-0007vJ-LR for importer@patchew.org; Fri, 03 Sep 2021 15:43:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvJ-0005pP-ET for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvF-0003d0-MU for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:25 -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-289-60CSFD_IOfa7wa6cVeVtGQ-1; Fri, 03 Sep 2021 15:32:16 -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 0398284A5E1; Fri, 3 Sep 2021 19:32:16 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D41D5D9FC; Fri, 3 Sep 2021 19:32:11 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id BFB2311385C7; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uTHirdJSbvfam5rHkKibIPiLKhRROSvQu0jDEbM6OqA=; b=dexDUwgUrs7sUYfJSMf5SVVIjLY1hFqf1cNPU+iCqbk7R9mb0e63a/KXtmdS/FNsPeQwmk sjGCpmHluZOs8CG7UZdbUL3sn/xzcq7ct17LCAYMJEusy/4zTbJDaJj21R7JEYqQGaFKgp s9JdTSBLdTWtDCw0X81WeouA1eAi9NM= X-MC-Unique: 60CSFD_IOfa7wa6cVeVtGQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 02/13] qapi: Simplify QAPISchemaIfCond's interface for generating C Date: Fri, 3 Sep 2021 21:31:58 +0200 Message-Id: <20210903193209.1426791-3-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698223978100001 QAPISchemaIfCond.cgen() is only ever used like gen_if(ifcond.cgen()) and gen_endif(ifcond.cgen()) Simplify to ifcond.gen_if() and ifcond.gen_endif() Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-2-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau [Import statements tidied up with isort] --- scripts/qapi/gen.py | 6 ++---- scripts/qapi/introspect.py | 11 +++-------- scripts/qapi/schema.py | 10 +++++++++- scripts/qapi/types.py | 28 +++++++++++----------------- scripts/qapi/visit.py | 14 ++++++-------- 5 files changed, 31 insertions(+), 38 deletions(-) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 51a597a025..ab26d5c937 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -24,8 +24,6 @@ from .common import ( c_fname, c_name, - gen_endif, - gen_if, guardend, guardstart, mcgen, @@ -95,9 +93,9 @@ def _wrap_ifcond(ifcond: QAPISchemaIfCond, before: str, a= fter: str) -> str: if added[0] =3D=3D '\n': out +=3D '\n' added =3D added[1:] - out +=3D gen_if(ifcond.cgen()) + out +=3D ifcond.gen_if() out +=3D added - out +=3D gen_endif(ifcond.cgen()) + out +=3D ifcond.gen_endif() return out =20 =20 diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index bd4233ecee..4c079ee627 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -22,12 +22,7 @@ Union, ) =20 -from .common import ( - c_name, - gen_endif, - gen_if, - mcgen, -) +from .common import c_name, mcgen from .gen import QAPISchemaMonolithicCVisitor from .schema import ( QAPISchema, @@ -124,10 +119,10 @@ def indent(level: int) -> str: if obj.comment: ret +=3D indent(level) + f"/* {obj.comment} */\n" if obj.ifcond.is_present(): - ret +=3D gen_if(obj.ifcond.cgen()) + ret +=3D obj.ifcond.gen_if() ret +=3D _tree_to_qlit(obj.value, level) if obj.ifcond.is_present(): - ret +=3D '\n' + gen_endif(obj.ifcond.cgen()) + ret +=3D '\n' + obj.ifcond.gen_endif() return ret =20 ret =3D '' diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 229d24fce9..1451cdec81 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -24,6 +24,8 @@ c_name, cgen_ifcond, docgen_ifcond, + gen_endif, + gen_if, ) from .error import QAPIError, QAPISemError, QAPISourceError from .expr import check_exprs @@ -34,9 +36,15 @@ class QAPISchemaIfCond: def __init__(self, ifcond=3DNone): self.ifcond =3D ifcond or {} =20 - def cgen(self): + def _cgen(self): return cgen_ifcond(self.ifcond) =20 + def gen_if(self): + return gen_if(self._cgen()) + + def gen_endif(self): + return gen_endif(self._cgen()) + def docgen(self): return docgen_ifcond(self.ifcond) =20 diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index db9ff95bd1..831294fe42 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -15,13 +15,7 @@ =20 from typing import List, Optional =20 -from .common import ( - c_enum_const, - c_name, - gen_endif, - gen_if, - mcgen, -) +from .common import c_enum_const, c_name, mcgen from .gen import QAPISchemaModularCVisitor, ifcontext from .schema import ( QAPISchema, @@ -51,13 +45,13 @@ def gen_enum_lookup(name: str, ''', c_name=3Dc_name(name)) for memb in members: - ret +=3D gen_if(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_if() index =3D c_enum_const(name, memb.name, prefix) ret +=3D mcgen(''' [%(index)s] =3D "%(name)s", ''', index=3Dindex, name=3Dmemb.name) - ret +=3D gen_endif(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_endif() =20 ret +=3D mcgen(''' }, @@ -81,12 +75,12 @@ def gen_enum(name: str, c_name=3Dc_name(name)) =20 for memb in enum_members: - ret +=3D gen_if(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_if() ret +=3D mcgen(''' %(c_enum)s, ''', c_enum=3Dc_enum_const(name, memb.name, prefix)) - ret +=3D gen_endif(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_endif() =20 ret +=3D mcgen(''' } %(c_name)s; @@ -126,7 +120,7 @@ def gen_array(name: str, element_type: QAPISchemaType) = -> str: def gen_struct_members(members: List[QAPISchemaObjectTypeMember]) -> str: ret =3D '' for memb in members: - ret +=3D gen_if(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_if() if memb.optional: ret +=3D mcgen(''' bool has_%(c_name)s; @@ -136,7 +130,7 @@ def gen_struct_members(members: List[QAPISchemaObjectTy= peMember]) -> str: %(c_type)s %(c_name)s; ''', c_type=3Dmemb.type.c_type(), c_name=3Dc_name(memb.nam= e)) - ret +=3D gen_endif(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_endif() return ret =20 =20 @@ -159,7 +153,7 @@ def gen_object(name: str, ifcond: QAPISchemaIfCond, ret +=3D mcgen(''' =20 ''') - ret +=3D gen_if(ifcond.cgen()) + ret +=3D ifcond.gen_if() ret +=3D mcgen(''' struct %(c_name)s { ''', @@ -193,7 +187,7 @@ def gen_object(name: str, ifcond: QAPISchemaIfCond, ret +=3D mcgen(''' }; ''') - ret +=3D gen_endif(ifcond.cgen()) + ret +=3D ifcond.gen_endif() =20 return ret =20 @@ -220,13 +214,13 @@ def gen_variants(variants: QAPISchemaVariants) -> str: for var in variants.variants: if var.type.name =3D=3D 'q_empty': continue - ret +=3D gen_if(var.ifcond.cgen()) + ret +=3D var.ifcond.gen_if() ret +=3D mcgen(''' %(c_type)s %(c_name)s; ''', c_type=3Dvar.type.c_unboxed_type(), c_name=3Dc_name(var.name)) - ret +=3D gen_endif(var.ifcond.cgen()) + ret +=3D var.ifcond.gen_endif() =20 ret +=3D mcgen(''' } u; diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 56ea516399..9d9196a143 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -18,8 +18,6 @@ from .common import ( c_enum_const, c_name, - gen_endif, - gen_if, indent, mcgen, ) @@ -79,7 +77,7 @@ def gen_visit_object_members(name: str, =20 for memb in members: deprecated =3D 'deprecated' in [f.name for f in memb.features] - ret +=3D gen_if(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_if() if memb.optional: ret +=3D mcgen(''' if (visit_optional(v, "%(name)s", &obj->has_%(c_name)s)) { @@ -112,7 +110,7 @@ def gen_visit_object_members(name: str, ret +=3D mcgen(''' } ''') - ret +=3D gen_endif(memb.ifcond.cgen()) + ret +=3D memb.ifcond.gen_endif() =20 if variants: tag_member =3D variants.tag_member @@ -126,7 +124,7 @@ def gen_visit_object_members(name: str, for var in variants.variants: case_str =3D c_enum_const(tag_member.type.name, var.name, tag_member.type.prefix) - ret +=3D gen_if(var.ifcond.cgen()) + ret +=3D var.ifcond.gen_if() if var.type.name =3D=3D 'q_empty': # valid variant and nothing to do ret +=3D mcgen(''' @@ -142,7 +140,7 @@ def gen_visit_object_members(name: str, case=3Dcase_str, c_type=3Dvar.type.c_name(), c_name=3Dc_name(v= ar.name)) =20 - ret +=3D gen_endif(var.ifcond.cgen()) + ret +=3D var.ifcond.gen_endif() ret +=3D mcgen(''' default: abort(); @@ -228,7 +226,7 @@ def gen_visit_alternate(name: str, variants: QAPISchema= Variants) -> str: c_name=3Dc_name(name)) =20 for var in variants.variants: - ret +=3D gen_if(var.ifcond.cgen()) + ret +=3D var.ifcond.gen_if() ret +=3D mcgen(''' case %(case)s: ''', @@ -254,7 +252,7 @@ def gen_visit_alternate(name: str, variants: QAPISchema= Variants) -> str: ret +=3D mcgen(''' break; ''') - ret +=3D gen_endif(var.ifcond.cgen()) + ret +=3D var.ifcond.gen_endif() =20 ret +=3D mcgen(''' case QTYPE_NONE: --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630697856; cv=none; d=zohomail.com; s=zohoarc; b=LwyoWmsT/+4I3lLfs9sR2nj98d2MSnNWZpzXxTTGsIoOtZgBnjuxuEYwBSvge0oRW/RURSSCKlAaRdINTzg62dklMn3Wg9CdYAIj1cYk1MfQ2u59oAOVLqVUaLj+aAnhafe5C+11Gpv7jLA4wjNN63opOmNKtctlX3J1xrepCXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630697856; h=Content-Type:Content-Transfer-Encoding:Cc: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=/a77X5gtqSfSuqLn79jSzOSGVeNId3X3KMU/gai77DY=; b=RU6d4KT3KtnzbMEj1qfkH4SPJqDNHmu6x/g7ra7KhbEU1aaUQ7DNjRDaAmsgAqJSVDjgmYYEjXDWovAdwkY+41FASUgLAfb4r91ClJ4Wj6OWyY3UTDqLxPg2dvE7/HSNFwBN+mh6nK1u1I5Fs6acspB+oPjCxJUS6HahQLrL/y8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16306978569851008.4312815273098; Fri, 3 Sep 2021 12:37:36 -0700 (PDT) Received: from localhost ([::1]:48668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF0J-0004PD-VM for importer@patchew.org; Fri, 03 Sep 2021 15:37:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvI-0005n4-RP for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvD-0003bz-Kq for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:24 -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-287-7RXDOsw7MfG6E3xbHi56FA-1; Fri, 03 Sep 2021 15:32:16 -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 D0EE2107ACCD; Fri, 3 Sep 2021 19:32:15 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D2AD19C59; Fri, 3 Sep 2021 19:32:11 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C54181138220; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/a77X5gtqSfSuqLn79jSzOSGVeNId3X3KMU/gai77DY=; b=Sz6+Omijd3tbXgSkxG2NLo2Wt4RsL2NQLxjW5jhj+J/8YDfbydJowssjFyLuBkCv+OmrA9 dlKuFxGaQMCMmUW9yIg94gdYiUfUozGCP1cj1T/2ZGeWO04kYNi3l4XZZKbOet8NzFL024 yydgdG+J+5sxT312Z4IrKReB381c5DY= X-MC-Unique: 7RXDOsw7MfG6E3xbHi56FA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 03/13] qapi: Simplify how QAPISchemaIfCond represents "no condition" Date: Fri, 3 Sep 2021 21:31:59 +0200 Message-Id: <20210903193209.1426791-4-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630697857710100001 None works fine, there is no need to replace it by {} in .__init__(). Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-3-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/common.py | 4 ++-- scripts/qapi/schema.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 1724ac32db..1c1dc87ccb 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -200,7 +200,7 @@ def guardend(name: str) -> str: name=3Dc_fname(name).upper()) =20 =20 -def cgen_ifcond(ifcond: Union[str, Dict[str, Any]]) -> str: +def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: if not ifcond: return '' if isinstance(ifcond, str): @@ -214,7 +214,7 @@ def cgen_ifcond(ifcond: Union[str, Dict[str, Any]]) -> = str: return '(' + (') ' + oper + ' (').join(operands) + ')' =20 =20 -def docgen_ifcond(ifcond: Union[str, Dict[str, Any]]) -> str: +def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: # TODO Doc generated for conditions needs polish if not ifcond: return '' diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 1451cdec81..3d72c7dfc9 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -34,7 +34,7 @@ =20 class QAPISchemaIfCond: def __init__(self, ifcond=3DNone): - self.ifcond =3D ifcond or {} + self.ifcond =3D ifcond =20 def _cgen(self): return cgen_ifcond(self.ifcond) --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698594; cv=none; d=zohomail.com; s=zohoarc; b=R4+fifyHxbCs0Am0PhN2X7OokiFYyswoHYjvtquLzOLRLjeSneZjx9cL3JBgI65hETnJf9Cq1AwirPM5C3MOJnPBdnLNxGXKXZpL5F+3y+upTbfKs1ZWP3EDaaUmDRzv2T7sC9vjdYDQG5PPICzeoigAiSPjOd5HpXeS+8D3vgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698594; h=Content-Type:Content-Transfer-Encoding:Cc: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=fEEZ4ch5/qs/4u+VvW1u+ltQl8zE3FlPZy53bDszeho=; b=XdrkJ0WTkXKS1Nvy12ULoNE2GP2b/+0qIyjWiBoQnRGf3lKFFdN51P/9+ET0HggRgX/j/+DTyfpSbdNs7m5mrUdMfysKKzyM1NTts1fqgd8MNPJmQuupfI8PmxutXNBk/M1xxtAUDx3aIyjUwT7oeAZUIWVQ6BT2tOLVKmfksyk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698594629399.74178016124927; Fri, 3 Sep 2021 12:49:54 -0700 (PDT) Received: from localhost ([::1]:57478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMFCD-0004pY-M3 for importer@patchew.org; Fri, 03 Sep 2021 15:49:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvF-0005m4-0I for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvD-0003bK-4x for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:20 -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-32-j9kV65cLP8uKc_WOewh9Sw-1; Fri, 03 Sep 2021 15:32:17 -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 87368501E5; Fri, 3 Sep 2021 19:32:16 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C6F7100164A; Fri, 3 Sep 2021 19:32:11 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CB1DB1138221; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fEEZ4ch5/qs/4u+VvW1u+ltQl8zE3FlPZy53bDszeho=; b=LNP7Yj09eHO5fvXSivMlPcmk4CNtFBceMVehu9Z6n8aeAYzC4kbMk+gL/reG0l7j3ARNys gFWXnuN2UVJ0YOFzy2M6VA1AruHLrOb9yH7YFCHeuxA/C29L1emqadloT9bqVwBPnoCCvz rL4guwy4+HdC7e++qtQovStfkd4Fhrw= X-MC-Unique: j9kV65cLP8uKc_WOewh9Sw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 04/13] tests/qapi-schema: Correct two 'if' conditionals Date: Fri, 3 Sep 2021 21:32:00 +0200 Message-Id: <20210903193209.1426791-5-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698595216100001 A definition's conditional should imply the conditionals of types it uses. If it doesn't, some configurations won't compile. Example (from tests/qapi-schema/qapi-schema-test.json): { 'union': 'TestIfUnion', 'data': { 'foo': 'TestStruct', 'bar': { 'type': 'str', 'if': 'TEST_IF_UNION_BAR'} }, 'if': { 'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT'] } } { 'command': 'test-if-union-cmd', 'data': { 'union-cmd-arg': 'TestIfUnion' }, 'if': 'TEST_IF_UNION' } generates #if (defined(TEST_IF_UNION)) && (defined(TEST_IF_STRUCT)) typedef struct TestIfUnion TestIfUnion; #endif /* (defined(TEST_IF_UNION)) && (defined(TEST_IF_STRUCT)) */ and #if defined(TEST_IF_UNION) void qmp_test_if_union_cmd(TestIfUnion *union_cmd_arg, Error **errp); void qmp_marshal_test_if_union_cmd(QDict *args, QObject **ret, Error **= errp); #endif /* defined(TEST_IF_UNION) */ which doesn't compile when !defined(TEST_IF_STRUCT). Messed up in f8c4fdd6ae "tests/qapi: Cover commands with 'if' and union / alternate 'data'", v4.0.0. Harmless, as we don't actually use this configuration. Correct it anyway, along with another instance. This loses coverage for 'not'. The next commit will bring it back. Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-4-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/qapi-schema/qapi-schema-test.json | 5 ++--- tests/qapi-schema/qapi-schema-test.out | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index fe028145e4..e20f76d84c 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -236,7 +236,7 @@ =20 { 'command': 'test-if-union-cmd', 'data': { 'union-cmd-arg': 'TestIfUnion' }, - 'if': 'TEST_IF_UNION' } + 'if': { 'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT'] } } =20 { 'alternate': 'TestIfAlternate', 'data': { 'foo': 'int', @@ -245,8 +245,7 @@ =20 { 'command': 'test-if-alternate-cmd', 'data': { 'alt-cmd-arg': 'TestIfAlternate' }, - 'if': { 'all': ['TEST_IF_ALT', - {'not': 'TEST_IF_NOT_ALT'}] } } + 'if': { 'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT'] } } =20 { 'command': 'test-if-cmd', 'data': { diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 3d0c6a8f28..517d802636 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -321,10 +321,10 @@ object TestIfUnion if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])]) object q_obj_test-if-union-cmd-arg member union-cmd-arg: TestIfUnion optional=3DFalse - if TEST_IF_UNION + if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])]) command test-if-union-cmd q_obj_test-if-union-cmd-arg -> None gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse - if TEST_IF_UNION + if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])]) alternate TestIfAlternate tag type case foo: int @@ -333,10 +333,10 @@ alternate TestIfAlternate if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])]) object q_obj_test-if-alternate-cmd-arg member alt-cmd-arg: TestIfAlternate optional=3DFalse - if OrderedDict([('all', ['TEST_IF_ALT', OrderedDict([('not', 'TEST_IF_= NOT_ALT')])])]) + if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])]) command test-if-alternate-cmd q_obj_test-if-alternate-cmd-arg -> None gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse - if OrderedDict([('all', ['TEST_IF_ALT', OrderedDict([('not', 'TEST_IF_= NOT_ALT')])])]) + if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])]) object q_obj_test-if-cmd-arg member foo: TestIfStruct optional=3DFalse member bar: TestIfEnum optional=3DFalse --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698929; cv=none; d=zohomail.com; s=zohoarc; b=BdDpk+s7aiO87FtMp5OW3trk2X+RenJ65fY4VJ2OMNqZiqSLQs7SxO1VDhTfbhT9xfMjvrbLPjt1jsKAds1CT/mGfu9/rvSaAikEE4rZUYUuNcP4KXzV19sAGpGkn/xJUEU/heLo3KMnr3IyVLwZs8Yhi2d7rB3pCZdg2Mr/mHI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698929; h=Content-Type:Content-Transfer-Encoding:Cc: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=kVe53MQsH80erQi3iInFDsoE4RGwLmE6RkRir1nu14w=; b=l4KAtSN9kTslykIKna9Q+9TgfsZENHfyRR8xvFEfEW5KgGDYqE604rzUq2eeWm4yF3KZJvnmkpKeJ63DeqNORh5XBmys4oYPbO/pU4883Uh239w/KjKq2WylYRSbYPEMXD8W/F5ZUTB0lAJJ5OgQxwFrjDPodrQdsuG3Lb3p8EI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698929864510.1355712252623; Fri, 3 Sep 2021 12:55:29 -0700 (PDT) Received: from localhost ([::1]:46454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMFHc-0007sU-Qv for importer@patchew.org; Fri, 03 Sep 2021 15:55:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvE-0005l8-Dj for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvC-0003ad-Mb for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:20 -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-290-CjAXF4FoMmSkj9hWtLLekg-1; Fri, 03 Sep 2021 15:32:16 -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 D0B3C1854E2A; Fri, 3 Sep 2021 19:32:15 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D74619D9B; Fri, 3 Sep 2021 19:32:12 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CF5F41138222; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kVe53MQsH80erQi3iInFDsoE4RGwLmE6RkRir1nu14w=; b=QM3T1rLddrbG3Y5mYur2C+BsAvFR8oi/EYOlqKZ6/WeBZn9P2ratqeGFYo5aHW41qnGIUv m2qmxsk83mJLc54Y/iDWIiBj4Qxhxno1FWQTmzxl+a6TAB5aS6MdGV7JOsuWe2rJUEJEu4 KfvSGBdhrtwcveJF5AAYydtbL0F+nag= X-MC-Unique: CjAXF4FoMmSkj9hWtLLekg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 05/13] tests/qapi-schema: Demonstrate broken C code for 'if' Date: Fri, 3 Sep 2021 21:32:01 +0200 Message-Id: <20210903193209.1426791-6-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698930446100001 The C code generated for 'if' conditionals is incorrectly parenthesized. For instance, 'if': { 'not': { 'any': [ { 'not': 'TEST_IF_EVT' }, { 'not': 'TEST_IF_STRUCT' } ] } } } generates #if !(!defined(TEST_IF_EVT)) || (!defined(TEST_IF_STRUCT)) This is wrong. Correct would be: #if !(!defined(TEST_IF_EVT) || !defined(TEST_IF_STRUCT)) Cover the issue in qapi-schema-test.json. This generates bad #if in tests/test-qapi-events.h and other files. Add a similar condition to doc-good.json. The generated documentation is fine. Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-5-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/qapi-schema/doc-good.json | 2 +- tests/qapi-schema/doc-good.out | 2 +- tests/qapi-schema/doc-good.txt | 2 +- tests/qapi-schema/qapi-schema-test.json | 5 +++++ tests/qapi-schema/qapi-schema-test.out | 3 +++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.j= son index 5e30790730..e0027e4cf6 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -127,7 +127,7 @@ { 'alternate': 'Alternate', 'features': [ 'alt-feat' ], 'data': { 'i': 'int', 'b': 'bool' }, - 'if': { 'not': 'IFNOT' } } + 'if': { 'not': { 'any': [ 'IFONE', 'IFTWO' ] } } } =20 ## # =3D=3D Another subsection diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 26d1fa5d28..d72f3047e9 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -51,7 +51,7 @@ alternate Alternate tag type case i: int case b: bool - if OrderedDict([('not', 'IFNOT')]) + if OrderedDict([('not', OrderedDict([('any', ['IFONE', 'IFTWO'])]))]) feature alt-feat object q_obj_cmd-arg member arg1: int optional=3DFalse diff --git a/tests/qapi-schema/doc-good.txt b/tests/qapi-schema/doc-good.txt index 5bfe06e14e..85a370831f 100644 --- a/tests/qapi-schema/doc-good.txt +++ b/tests/qapi-schema/doc-good.txt @@ -174,7 +174,7 @@ Features If ~~ =20 -"!IFNOT" +"!(IFONE or IFTWO)" =20 =20 Another subsection diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index e20f76d84c..6e37758280 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -261,6 +261,11 @@ 'bar': { 'type': ['TestIfEnum'], 'if': 'TEST_IF_EVT_BAR' } }, 'if': { 'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT'] } } =20 +{ 'event': 'TEST_IF_EVENT2', 'data': {}, + # FIXME C #if generated for this conditional is wrong + 'if': { 'not': { 'any': [ { 'not': 'TEST_IF_EVT' }, + { 'not': 'TEST_IF_STRUCT' } ] } } } + # test 'features' =20 { 'struct': 'FeatureStruct0', diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 517d802636..5d2e830ba2 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -357,6 +357,9 @@ object q_obj_TEST_IF_EVENT-arg event TEST_IF_EVENT q_obj_TEST_IF_EVENT-arg boxed=3DFalse if OrderedDict([('all', ['TEST_IF_EVT', 'TEST_IF_STRUCT'])]) +event TEST_IF_EVENT2 None + boxed=3DFalse + if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TE= ST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))]) object FeatureStruct0 member foo: int optional=3DFalse object FeatureStruct1 --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698805; cv=none; d=zohomail.com; s=zohoarc; b=eqWsS3mI128PjZjaZQHe2nC91YGs+ReicYAKd+Xj5B3ZM/wJNL/XnlJiN7XfgLCV9ZAMOKV9fa4AyD99yWmTJoyuhra5HVhNQ1S7JAj4f8r9KmpxyNStZBp/67o+IowW4Z0KJu/SI0Doe/cSWUfFBO3Bopk+d22yRF+d7xcbnZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698805; h=Content-Type:Content-Transfer-Encoding:Cc: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=6Cdr/4ksTApBPzwkIEiFKujnttTP2oviLVmsZAoMmxk=; b=bRRoqWujlRjkjoSn171ziRm1pwkwSJ0/YTEfe8lSmhICYjkwryZH4LzqqkB0YAwQdoFRY+rsL9hm9xTdqUYAw0E8g2+jiwUe4orZw3zHE0oIzbffHCugNinkmSH0nHwDI/Z0nZbVHllF2xFsHveonLTVs9R7Lm/lvM7HQJwuZA4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698805783691.6118393809958; Fri, 3 Sep 2021 12:53:25 -0700 (PDT) Received: from localhost ([::1]:37684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMFFc-00023b-26 for importer@patchew.org; Fri, 03 Sep 2021 15:53:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvE-0005m1-ND for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54061) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvD-0003bi-4j for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:20 -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-384-Iu0oWu5QMgCCHrgy2Ag8FQ-1; Fri, 03 Sep 2021 15:32:17 -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 853BA501E1; Fri, 3 Sep 2021 19:32:16 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D19610023AE; Fri, 3 Sep 2021 19:32:12 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D2AA61138223; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Cdr/4ksTApBPzwkIEiFKujnttTP2oviLVmsZAoMmxk=; b=UDfs1TZNiQbb9TTjc9Tq60/iub1Kvp6Sbzo+7snSzJpFL4NGHWoUrEGC9f9vWROuGvK4U2 Rae3FFsKRowH5koMkvsIWZ0erPhyQZXHBZnkFpkQOS+jCc38MVhyXMXbyw82u1jsZ6STyC a2yBUgaKHekSDbFS2lrmkVN1QOZfQiw= X-MC-Unique: Iu0oWu5QMgCCHrgy2Ag8FQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 06/13] qapi: Fix C code generation for 'if' Date: Fri, 3 Sep 2021 21:32:02 +0200 Message-Id: <20210903193209.1426791-7-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698806164100003 When commit 5d83b9a130 "qapi: replace if condition list with dict {'all': [...]}" made cgen_ifcond() and docgen_ifcond() recursive, it messed up parenthesises in the former, and got them right in the latter, as the previous commit demonstrates. To fix, adopt the latter's working code for the former. This generates the correct code from the previous commit's commit message. Fixes: 5d83b9a130690f879d5f33e991beabe69cb88bc8 Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-6-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/common.py | 4 ++-- tests/qapi-schema/qapi-schema-test.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 1c1dc87ccb..f31e077d7b 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -209,9 +209,9 @@ def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, A= ny]]]) -> str: oper, operands =3D next(iter(ifcond.items())) if oper =3D=3D 'not': return '!' + cgen_ifcond(operands) - oper =3D {'all': '&&', 'any': '||'}[oper] + oper =3D {'all': ' && ', 'any': ' || '}[oper] operands =3D [cgen_ifcond(o) for o in operands] - return '(' + (') ' + oper + ' (').join(operands) + ')' + return '(' + oper.join(operands) + ')' =20 =20 def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index 6e37758280..b6c36a9eee 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -262,7 +262,6 @@ 'if': { 'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT'] } } =20 { 'event': 'TEST_IF_EVENT2', 'data': {}, - # FIXME C #if generated for this conditional is wrong 'if': { 'not': { 'any': [ { 'not': 'TEST_IF_EVT' }, { 'not': 'TEST_IF_STRUCT' } ] } } } =20 --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698050; cv=none; d=zohomail.com; s=zohoarc; b=E/3FyI6bflRTpiBusywV/5dVIxcKNYE7zsywGN6BQx2gLLHr7IYQHGXTQs19D+9LJ0uFo+GNmOqGa/zXL6tKf+jf5HINx/+y1h+I48mP2t1tv3G7cx/ZO+V0O7CUQKhQra3jm7no81qB0ZcCDFolmzDnn0wVWtPWxwE2vUlmlN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698050; h=Content-Type:Content-Transfer-Encoding:Cc: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=ZXTLMG5iR8j6xRJCwNT4ENeKijW35IpjnkBnkIwO/qc=; b=eyfxotpQHeBjgxNSon2rFCarCvICSP6oT+0DjwCmLTLClY6CuO7DcN3Ah3+hvLpD/L/W2F/XwPWnmVS+wbBkNPdmhKZzWW2Il8dnuw5oCZO12fL6Sw6BFjaXbMcI0gzEtSytXQ+nEdECeoxHN9kCXDIPtv0baZQe3tH/oxPS9N0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698050615457.8691793113436; Fri, 3 Sep 2021 12:40:50 -0700 (PDT) Received: from localhost ([::1]:57104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF3R-0001kL-HR for importer@patchew.org; Fri, 03 Sep 2021 15:40:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvJ-0005ot-9d for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvF-0003d7-US for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:24 -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-362-tfNqBwtANpG-iGVua1NXeA-1; Fri, 03 Sep 2021 15:32:19 -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 210FC84A5E1; Fri, 3 Sep 2021 19:32:19 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8DDDA5D6A1; Fri, 3 Sep 2021 19:32:12 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D624B1138224; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZXTLMG5iR8j6xRJCwNT4ENeKijW35IpjnkBnkIwO/qc=; b=XrUWOKafF2y9Hyz1+6R4Wx7ZgidOf+VCbdwxpKwPoRcx43ywddrs10dfcvms6jGOeqZt3i yDqF07Aij4hAVOVF/ieKDW3JTqUJxy/CdjAm2mT03tqLMZfyMEQAr9tdEeWOD6ECTwuKDa 5yb+yZmchG99pB4+FCtqwmngME7ou7Y= X-MC-Unique: tfNqBwtANpG-iGVua1NXeA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 07/13] qapi: Factor common recursion out of cgen_ifcond(), docgen_ifcond() Date: Fri, 3 Sep 2021 21:32:03 +0200 Message-Id: <20210903193209.1426791-8-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698052543100001 Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-7-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/common.py | 45 +++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index f31e077d7b..df92cff852 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -17,6 +17,7 @@ Dict, Match, Optional, + Sequence, Union, ) =20 @@ -200,33 +201,37 @@ def guardend(name: str) -> str: name=3Dc_fname(name).upper()) =20 =20 -def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: +def gen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]], + cond_fmt: str, not_fmt: str, + all_operator: str, any_operator: str) -> str: + + def do_gen(ifcond: Union[str, Dict[str, Any]]): + if isinstance(ifcond, str): + return cond_fmt % ifcond + assert isinstance(ifcond, dict) and len(ifcond) =3D=3D 1 + if 'not' in ifcond: + return not_fmt % do_gen(ifcond['not']) + if 'all' in ifcond: + gen =3D gen_infix(all_operator, ifcond['all']) + else: + gen =3D gen_infix(any_operator, ifcond['any']) + return gen + + def gen_infix(operator: str, operands: Sequence[Any]) -> str: + return '(' + operator.join([do_gen(o) for o in operands]) + ')' + if not ifcond: return '' - if isinstance(ifcond, str): - return 'defined(' + ifcond + ')' + return do_gen(ifcond) =20 - oper, operands =3D next(iter(ifcond.items())) - if oper =3D=3D 'not': - return '!' + cgen_ifcond(operands) - oper =3D {'all': ' && ', 'any': ' || '}[oper] - operands =3D [cgen_ifcond(o) for o in operands] - return '(' + oper.join(operands) + ')' + +def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: + return gen_ifcond(ifcond, 'defined(%s)', '!%s', ' && ', ' || ') =20 =20 def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: # TODO Doc generated for conditions needs polish - if not ifcond: - return '' - if isinstance(ifcond, str): - return ifcond - - oper, operands =3D next(iter(ifcond.items())) - if oper =3D=3D 'not': - return '!' + docgen_ifcond(operands) - oper =3D {'all': ' and ', 'any': ' or '}[oper] - operands =3D [docgen_ifcond(o) for o in operands] - return '(' + oper.join(operands) + ')' + return gen_ifcond(ifcond, '%s', '!%s', ' and ', ' or ') =20 =20 def gen_if(cond: str) -> str: --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698252; cv=none; d=zohomail.com; s=zohoarc; b=aJGV9N0Q4xSkFNu+jtpTPJhmZY9vnpdDDZgkx36BQg6l8BRt0p+9thRg0WFooSo/kX/lQhMR89fhFPvj7CKwHXWUAS1HodfC3nnm7iOZKkBTYKXyTFLZisxk5ZPdribMPLchO2uHL4y9ifiGYFKK+3FRtSf9y8uY9LHR0pVYcC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698252; h=Content-Type:Content-Transfer-Encoding:Cc: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=mzdG5Xl2cwirpy2YkQFrksW9FKG4ljXCH4pDIwlSgTs=; b=eNUuKeDC5pywU9vYPd/9LY6JWIFfAg8nTdIggqW/DyxYXFlzAe06FFqBh7g+u+Sl7fYagIVMtf1n3v3Szl5ODzE9A1PQhHLdQjZiS2zdHUSBZjPvdb1TSWFXm9ZvIOdQnOjCdUc9uBLRoQ2DNIfGE6XXQ76otnlY9wYJEC4zEP8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698252022252.72788531022923; Fri, 3 Sep 2021 12:44:12 -0700 (PDT) Received: from localhost ([::1]:39066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF6g-0000s2-WD for importer@patchew.org; Fri, 03 Sep 2021 15:44:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvK-0005ru-9f for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvI-0003fT-Em for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:26 -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-49-Ozd2e6bhOyWwI4LnmAhnlg-1; Fri, 03 Sep 2021 15:32:21 -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 58B0D501E0; Fri, 3 Sep 2021 19:32:20 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9160310016F4; Fri, 3 Sep 2021 19:32:12 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D976211380BA; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mzdG5Xl2cwirpy2YkQFrksW9FKG4ljXCH4pDIwlSgTs=; b=T2jSaF+16G1jHlmsvTUSeg4tKftb+5DP4TDknuiGlDoVPHLujkpc+i1QOVedgTdB3gGRjX Nr9RG/gTN3muUWlCWX66tpMJDsyLTVwdmj8dIZWLJ5k4U8uakxgebFBOW8np94taP1H+he uHry/I7ZtnOhdFo+MIvLmK5cgiWzU4c= X-MC-Unique: Ozd2e6bhOyWwI4LnmAhnlg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 08/13] qapi: Avoid redundant parens in code generated for conditionals Date: Fri, 3 Sep 2021 21:32:04 +0200 Message-Id: <20210903193209.1426791-9-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698254469100001 Commit 6cc2e4817f "qapi: introduce QAPISchemaIfCond.cgen()" caused a minor regression: redundant parenthesis. Subsequent commits eliminated of many of them, but not all. Get rid of the rest now. Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-8-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/common.py | 10 ++++++---- tests/qapi-schema/doc-good.txt | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index df92cff852..c7ccc7cec7 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -205,24 +205,26 @@ def gen_ifcond(ifcond: Optional[Union[str, Dict[str, = Any]]], cond_fmt: str, not_fmt: str, all_operator: str, any_operator: str) -> str: =20 - def do_gen(ifcond: Union[str, Dict[str, Any]]): + def do_gen(ifcond: Union[str, Dict[str, Any]], need_parens: bool): if isinstance(ifcond, str): return cond_fmt % ifcond assert isinstance(ifcond, dict) and len(ifcond) =3D=3D 1 if 'not' in ifcond: - return not_fmt % do_gen(ifcond['not']) + return not_fmt % do_gen(ifcond['not'], True) if 'all' in ifcond: gen =3D gen_infix(all_operator, ifcond['all']) else: gen =3D gen_infix(any_operator, ifcond['any']) + if need_parens: + gen =3D '(' + gen + ')' return gen =20 def gen_infix(operator: str, operands: Sequence[Any]) -> str: - return '(' + operator.join([do_gen(o) for o in operands]) + ')' + return operator.join([do_gen(o, True) for o in operands]) =20 if not ifcond: return '' - return do_gen(ifcond) + return do_gen(ifcond, False) =20 =20 def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: diff --git a/tests/qapi-schema/doc-good.txt b/tests/qapi-schema/doc-good.txt index 85a370831f..75f51a6fc1 100644 --- a/tests/qapi-schema/doc-good.txt +++ b/tests/qapi-schema/doc-good.txt @@ -79,7 +79,7 @@ Members If ~~ =20 -"(IFALL1 and IFALL2)" +"IFALL1 and IFALL2" =20 =20 "Variant1" (Object) @@ -120,8 +120,8 @@ Members =20 The members of "Base" The members of "Variant1" when "base1" is ""one"" -The members of "Variant2" when "base1" is ""two"" (**If: **"(IFONE or -IFTWO)") +The members of "Variant2" when "base1" is ""two"" (**If: **"IFONE or +IFTWO") =20 Features ~~~~~~~~ --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630699106; cv=none; d=zohomail.com; s=zohoarc; b=iP0IozqRxcULARuWSa097Ir6MuzcB0/Ln6Gkafqabf/AywLJOpMOtv5gjCPDMPglQyZgsz3LtmKJBOF7a/RtrKHtsHeGSlbFFQlC+mxVMNaJPBDf+z5HOjCPlR+0+rPSpjjrNiUqQ/iOSwS8u4RHX67G5ZrJDnvozYn9BEtE8OU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630699106; h=Content-Type:Content-Transfer-Encoding:Cc: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=7gwGK1i6HcoITbTzllgL3mmRGxIXIQiktAj6B0st0B4=; b=OeNKt3INwqzJWmNFLO3lWjyLix84HrJfYNHKJLBRewk5Lr1A7QrYs0TWxNd5NhDwjsjEGmAMHd4AcFq3L6ASOd92gIlsxUaH2YtDDtLdmdMysyYF1ZgAt6XttIkIhfy4EP7XWNPlXH4dU8/Vge43jJXf3hnJ2O3UWMCPwNQX5xk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630699106554287.08127237429994; Fri, 3 Sep 2021 12:58:26 -0700 (PDT) Received: from localhost ([::1]:55256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMFKT-0005Lg-A0 for importer@patchew.org; Fri, 03 Sep 2021 15:58:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvK-0005t4-Jq for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48286) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvI-0003fb-J4 for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:26 -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-486-njn5YK9_NfinSLx8UCUS9A-1; Fri, 03 Sep 2021 15:32:19 -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 2056B10054F6; Fri, 3 Sep 2021 19:32:19 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D0346B559; Fri, 3 Sep 2021 19:32:17 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id DF15211380BC; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7gwGK1i6HcoITbTzllgL3mmRGxIXIQiktAj6B0st0B4=; b=KqXj0fHpmiodfHkTe5/i27NkMnrNrzryjBtbkZ919tuOe7Tpbo+WMgL6ZqtWGLRdllDiVl b2LhqCc4sEAZJv61vOcvspy8Ou2geFvG/0E60gA1789DfWnhFcC7sMMRstxgL5fn1xRXcM muB7KaU0QoxtmZ7S+qcUzPwR86TmqxA= X-MC-Unique: njn5YK9_NfinSLx8UCUS9A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 09/13] qapi: Use "not COND" instead of "!COND" for generated documentation Date: Fri, 3 Sep 2021 21:32:05 +0200 Message-Id: <20210903193209.1426791-10-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630699107455100001 Generated documentation uses operators "and", "or", and "!". Change the latter to "not". Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-9-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/common.py | 2 +- tests/qapi-schema/doc-good.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index c7ccc7cec7..5f8f76e5b2 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -233,7 +233,7 @@ def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, A= ny]]]) -> str: =20 def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str: # TODO Doc generated for conditions needs polish - return gen_ifcond(ifcond, '%s', '!%s', ' and ', ' or ') + return gen_ifcond(ifcond, '%s', 'not %s', ' and ', ' or ') =20 =20 def gen_if(cond: str) -> str: diff --git a/tests/qapi-schema/doc-good.txt b/tests/qapi-schema/doc-good.txt index 75f51a6fc1..0c59d75964 100644 --- a/tests/qapi-schema/doc-good.txt +++ b/tests/qapi-schema/doc-good.txt @@ -174,7 +174,7 @@ Features If ~~ =20 -"!(IFONE or IFTWO)" +"not (IFONE or IFTWO)" =20 =20 Another subsection --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698119; cv=none; d=zohomail.com; s=zohoarc; b=hJyjUZhzcGiHGGGju0nGprhkoczOw494XvYMdiGaumm+0pdw/X7tK2oJiqD9QJw7X1wYwOztoiyb4jlaKu2jHpYPWkQRZO0iZmsLI9go8kTodm2CssgLSRrlqDTMFUha8QSxOMa55spmf61+VHrlt5Ibal5JqWmhJ+BSaAiivVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698119; h=Content-Type:Content-Transfer-Encoding:Cc: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=cqzg3QShsv1X3+eJHDQvZpPcUHEcgUbT+6Jz1uoMu9w=; b=Bryr46A8Sy0N6Pg/iolJ6d0Cj3RulQBYJ8iyAFBAxEooN1hfcLn02AAA9wWABkFOKaH7Bhpi+W4jAMGcAaGZSPxpGyLdPUZXWalFnnQqkK6nkisOIU0q6TgQEvO/Ff71C1USWmFY/TzHa7vV6R+xvjQRIv48EDAcVCjB68+EJUM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698119236804.8674752545569; Fri, 3 Sep 2021 12:41:59 -0700 (PDT) Received: from localhost ([::1]:59644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF4Y-0003aa-3f for importer@patchew.org; Fri, 03 Sep 2021 15:41:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvF-0005m6-PQ for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49504) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvE-0003ce-9Z for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:21 -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-515-d02UjkDLNv-E3TeMRNzOUw-1; Fri, 03 Sep 2021 15:32:18 -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 5DFED84A5E8; Fri, 3 Sep 2021 19:32:17 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D85A19C59; Fri, 3 Sep 2021 19:32:17 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id EC54311380C3; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cqzg3QShsv1X3+eJHDQvZpPcUHEcgUbT+6Jz1uoMu9w=; b=BnwWp5AIp7GO4LlyCkAlQtPyTtneZtpBTVD8vEQZuH/58S6m9HhINL/k3f47qcjXu6B7mE tBhjtYJUL3m+riQSsdVttZgP+E2WwOJOMEtWmOG5IqMJ+ysxRFvWY8In8/NlQdtRnhY/JX DCDJQB/dt+NGyPX+yQDMk1LNxY4+l1Q= X-MC-Unique: d02UjkDLNv-E3TeMRNzOUw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 10/13] qapi: Use re.fullmatch() where appropriate Date: Fri, 3 Sep 2021 21:32:06 +0200 Message-Id: <20210903193209.1426791-11-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698120627100001 Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-10-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/expr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 019f4c97aa..9e2aa1d43a 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -275,7 +275,7 @@ def check_if(expr: _JSONObject, info: QAPISourceInfo, s= ource: str) -> None: =20 def _check_if(cond: Union[str, object]) -> None: if isinstance(cond, str): - if not re.match(r'^[A-Z][A-Z0-9_]*$', cond): + if not re.fullmatch(r'[A-Z][A-Z0-9_]*', cond): raise QAPISemError( info, "'if' condition '%s' of %s is not a valid identifier" --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698443; cv=none; d=zohomail.com; s=zohoarc; b=aOYwhm7mtSzOQwnFJ6r0iy9dIOOYtVc9EUU9zarPqF2OeEESDaXVVI3Tw45ojREDhe6DXhF2sknytuZINwXylsd3H3cHEfSy5LlWRtfI21Rt4Rn4JQgkce/TiE+BFJrxdyb8+HSAy9M7y/hgyA7MqbkFU44CpQE2MLVVpyECFbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698443; h=Content-Type:Content-Transfer-Encoding:Cc: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=Bqmmhk6AT/6gkuvlIn9SelRXi/MM9KwDWPHPBhsWZhQ=; b=jDNH5R1X4uZFS+UaVoPus9g7kvow0++/V59RRK8P+Y2wbVgMM5EndsHh2AcfHUVnEFe72T7NEIxeq167hPLmlVRr1d+ICXldjuQCjZQ/UtHcs6m20A2KNBP/f16Rr2DzBek5S3ZbYX7xwigRX44lKo5Y2z1QORctFT1hV1R/Yxg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698443888750.8352286121938; Fri, 3 Sep 2021 12:47:23 -0700 (PDT) Received: from localhost ([::1]:48004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF9m-0006w6-OK for importer@patchew.org; Fri, 03 Sep 2021 15:47:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvL-0005ur-63 for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvI-0003fj-JQ for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:26 -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-582-NbZoy6esOQ-FjwzciQxxgQ-1; Fri, 03 Sep 2021 15:32:22 -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 745291006C85; Fri, 3 Sep 2021 19:32:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2BC8F779CE; Fri, 3 Sep 2021 19:32:17 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id F032B11380CC; Fri, 3 Sep 2021 21:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bqmmhk6AT/6gkuvlIn9SelRXi/MM9KwDWPHPBhsWZhQ=; b=TrqX4E3+RVUS7LZK0lJuzeAwRGWqHv6KE/sG4udbncOcHw1sQ2l5fZhmwypJOHTlYAeCdl 9cOtMdFQXuNzz5RB6yoJW07jmju+ZrdsQzAtSgJrtokdHpyXqJWfRqU7iJl24Gpq5Qdi+C hTXMVzK4q8Z3+d2HvHF5A4g2KgO2TuA= X-MC-Unique: NbZoy6esOQ-FjwzciQxxgQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 11/13] tests/qapi-schema: Hide OrderedDict in test output Date: Fri, 3 Sep 2021 21:32:07 +0200 Message-Id: <20210903193209.1426791-12-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698446051100003 Since commit 5d83b9a130 "qapi: replace if condition list with dict {'all': [...]}", we represent if conditionals as trees consisting of OrderedDict, list and str. This results in less than legible test output. For instance: if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TES= T_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))]) We intend to replace OrderedDict by dict when we get Python 3.7, which will result in more legible output: if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}} Can't wait: put in a hack to get that now, with a comment to revert it when we replace OrderedDict. Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-11-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/qapi-schema/doc-good.out | 6 +++--- tests/qapi-schema/qapi-schema-test.out | 30 +++++++++++++------------- tests/qapi-schema/test-qapi.py | 11 +++++++++- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index d72f3047e9..478fe6f82e 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -18,7 +18,7 @@ enum Enum feature enum-feat object Base member base1: Enum optional=3DFalse - if OrderedDict([('all', ['IFALL1', 'IFALL2'])]) + if {'all': ['IFALL1', 'IFALL2']} object Variant1 member var1: str optional=3DFalse if IFSTR @@ -30,7 +30,7 @@ object Object tag base1 case one: Variant1 case two: Variant2 - if OrderedDict([('any', ['IFONE', 'IFTWO'])]) + if {'any': ['IFONE', 'IFTWO']} feature union-feat1 object q_obj_Variant1-wrapper member data: Variant1 optional=3DFalse @@ -51,7 +51,7 @@ alternate Alternate tag type case i: int case b: bool - if OrderedDict([('not', OrderedDict([('any', ['IFONE', 'IFTWO'])]))]) + if {'not': {'any': ['IFONE', 'IFTWO']}} feature alt-feat object q_obj_cmd-arg member arg1: int optional=3DFalse diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 5d2e830ba2..d557fe2d89 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -311,40 +311,40 @@ enum TestIfUnionKind member foo member bar if TEST_IF_UNION_BAR - if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']} object TestIfUnion member type: TestIfUnionKind optional=3DFalse tag type case foo: q_obj_TestStruct-wrapper case bar: q_obj_str-wrapper if TEST_IF_UNION_BAR - if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']} object q_obj_test-if-union-cmd-arg member union-cmd-arg: TestIfUnion optional=3DFalse - if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']} command test-if-union-cmd q_obj_test-if-union-cmd-arg -> None gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse - if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']} alternate TestIfAlternate tag type case foo: int case bar: TestStruct if TEST_IF_ALT_BAR - if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT']} object q_obj_test-if-alternate-cmd-arg member alt-cmd-arg: TestIfAlternate optional=3DFalse - if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT']} command test-if-alternate-cmd q_obj_test-if-alternate-cmd-arg -> None gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse - if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT']} object q_obj_test-if-cmd-arg member foo: TestIfStruct optional=3DFalse member bar: TestIfEnum optional=3DFalse if TEST_IF_CMD_BAR - if OrderedDict([('all', ['TEST_IF_CMD', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_CMD', 'TEST_IF_STRUCT']} command test-if-cmd q_obj_test-if-cmd-arg -> UserDefThree gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse - if OrderedDict([('all', ['TEST_IF_CMD', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_CMD', 'TEST_IF_STRUCT']} command test-cmd-return-def-three None -> UserDefThree gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse array TestIfEnumList TestIfEnum @@ -353,13 +353,13 @@ object q_obj_TEST_IF_EVENT-arg member foo: TestIfStruct optional=3DFalse member bar: TestIfEnumList optional=3DFalse if TEST_IF_EVT_BAR - if OrderedDict([('all', ['TEST_IF_EVT', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT']} event TEST_IF_EVENT q_obj_TEST_IF_EVENT-arg boxed=3DFalse - if OrderedDict([('all', ['TEST_IF_EVT', 'TEST_IF_STRUCT'])]) + if {'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT']} event TEST_IF_EVENT2 None boxed=3DFalse - if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TE= ST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))]) + if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]= }} object FeatureStruct0 member foo: int optional=3DFalse object FeatureStruct1 @@ -392,11 +392,11 @@ object CondFeatureStruct2 object CondFeatureStruct3 member foo: int optional=3DFalse feature feature1 - if OrderedDict([('all', ['TEST_IF_COND_1', 'TEST_IF_COND_2'])]) + if {'all': ['TEST_IF_COND_1', 'TEST_IF_COND_2']} object CondFeatureStruct4 member foo: int optional=3DFalse feature feature1 - if OrderedDict([('any', ['TEST_IF_COND_1', 'TEST_IF_COND_2'])]) + if {'any': ['TEST_IF_COND_1', 'TEST_IF_COND_2']} enum FeatureEnum1 member eins member zwei @@ -447,7 +447,7 @@ command test-command-cond-features2 None -> None command test-command-cond-features3 None -> None gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse feature feature1 - if OrderedDict([('all', ['TEST_IF_COND_1', 'TEST_IF_COND_2'])]) + if {'all': ['TEST_IF_COND_1', 'TEST_IF_COND_2']} event TEST_EVENT_FEATURES0 FeatureStruct1 boxed=3DFalse event TEST_EVENT_FEATURES1 None diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index c92be2d086..73cffae2b6 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -94,8 +94,17 @@ def _print_variants(variants): =20 @staticmethod def _print_if(ifcond, indent=3D4): + # TODO Drop this hack after replacing OrderedDict by plain + # dict (requires Python 3.7) + def _massage(subcond): + if isinstance(subcond, str): + return subcond + if isinstance(subcond, list): + return [_massage(val) for val in subcond] + return {key: _massage(val) for key, val in subcond.items()} + if ifcond.is_present(): - print('%sif %s' % (' ' * indent, ifcond.ifcond)) + print('%sif %s' % (' ' * indent, _massage(ifcond.ifcond))) =20 @classmethod def _print_features(cls, features, indent=3D4): --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698257; cv=none; d=zohomail.com; s=zohoarc; b=DPxrIwKmLv8W+l8Y+7uypVhP82nIesNOwGApT+7NnddFZcs41kKNOAYT8P6PrXHfzLYtUcnQqxYP/keCX8VPzQgxqaFMODOsE3QxpxMaiKN48ctCGMrxxPzh5g2wnlGVDFdykQK6ODcKxCF/H9XmR46QFt2DVa1vUHwrSxZ07wM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698257; h=Content-Type:Content-Transfer-Encoding:Cc: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=+XCnAhE51JOQqbBNiPrhfm3nyHfH5fEyk1pZrOkclBQ=; b=lv9d+keCZ6kC3cu9KAsEmB+gnxYmbeUEejKmI5gXJGGSVvjWMbr7FeUR9B8g/63VWpdkew4E3qFsCrfdDa445VrhoWdrtzcRL9dxOua3M3h3HxGPEzTypIleKBbcXp1SFGX0yuyFV1cqCjlZMglIT4BP/DPb/T3b4dI2G/jB4Qw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698257732691.7670817856642; Fri, 3 Sep 2021 12:44:17 -0700 (PDT) Received: from localhost ([::1]:39588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMF6m-0001Cv-Nr for importer@patchew.org; Fri, 03 Sep 2021 15:44:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvK-0005u2-Si for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvI-0003ff-JQ for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:26 -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-520-kmQxiUAqME638xpdcdL1RQ-1; Fri, 03 Sep 2021 15:32:22 -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 52D5E501E3; Fri, 3 Sep 2021 19:32:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2BC3C77718; Fri, 3 Sep 2021 19:32:17 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0377C11380CD; Fri, 3 Sep 2021 21:32:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+XCnAhE51JOQqbBNiPrhfm3nyHfH5fEyk1pZrOkclBQ=; b=hUvd+HYvdJTkuVYbXHmOBERC25qSF0aFRHrxMZgj0f/f29G4lu85IwSTAMKOr4Cur8qDD/ bIjbIf/uff62r18goyPkKcSxFW8ZYy/f7eAme9Y8IegiK5agN//04dsmoMywH2LVcHW+xb Cu4l+CXfzQhxgIKvaxUn7hab/ufic7c= X-MC-Unique: kmQxiUAqME638xpdcdL1RQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 12/13] qapi: Tweak error messages for missing / conflicting meta-type Date: Fri, 3 Sep 2021 21:32:08 +0200 Message-Id: <20210903193209.1426791-13-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698258617100003 Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-12-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/expr.py | 23 +++++++++-------------- tests/qapi-schema/double-type.err | 4 +--- tests/qapi-schema/missing-type.err | 2 +- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 9e2aa1d43a..ae4437ba08 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -630,20 +630,15 @@ def check_exprs(exprs: List[_JSONObject]) -> List[_JS= ONObject]: if 'include' in expr: continue =20 - if 'enum' in expr: - meta =3D 'enum' - elif 'union' in expr: - meta =3D 'union' - elif 'alternate' in expr: - meta =3D 'alternate' - elif 'struct' in expr: - meta =3D 'struct' - elif 'command' in expr: - meta =3D 'command' - elif 'event' in expr: - meta =3D 'event' - else: - raise QAPISemError(info, "expression is missing metatype") + metas =3D expr.keys() & {'enum', 'struct', 'union', 'alternate', + 'command', 'event'} + if len(metas) !=3D 1: + raise QAPISemError( + info, + "expression must have exactly one key" + " 'enum', 'struct', 'union', 'alternate'," + " 'command', 'event'") + meta =3D metas.pop() =20 check_name_is_str(expr[meta], info, "'%s'" % meta) name =3D cast(str, expr[meta]) diff --git a/tests/qapi-schema/double-type.err b/tests/qapi-schema/double-t= ype.err index 576e716197..6a1e8a5990 100644 --- a/tests/qapi-schema/double-type.err +++ b/tests/qapi-schema/double-type.err @@ -1,3 +1 @@ -double-type.json: In struct 'Bar': -double-type.json:2: struct has unknown key 'command' -Valid keys are 'base', 'data', 'features', 'if', 'struct'. +double-type.json:2: expression must have exactly one key 'enum', 'struct',= 'union', 'alternate', 'command', 'event' diff --git a/tests/qapi-schema/missing-type.err b/tests/qapi-schema/missing= -type.err index 5755386a18..cb39569e49 100644 --- a/tests/qapi-schema/missing-type.err +++ b/tests/qapi-schema/missing-type.err @@ -1 +1 @@ -missing-type.json:2: expression is missing metatype +missing-type.json:2: expression must have exactly one key 'enum', 'struct'= , 'union', 'alternate', 'command', 'event' --=20 2.31.1 From nobody Sun May 5 01:05:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630698586; cv=none; d=zohomail.com; s=zohoarc; b=Mn1018rxuHz/sa4gJK76fcK+gzRaay/7guuo0w2Iwtd/Gxxhe1gYkSyCpBCPhIu6hKcxCIz3TweESPeqnV5NZS0yipJD+gC1C5/+8RbT32h6EqABUVvYaD5XndKBTAqn2PdAfXUZeToTnR/QtkXh7C1AtbLJRstPnlV+faBzDls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630698586; h=Content-Type:Content-Transfer-Encoding:Cc: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=k0ZkL//WewHwyhqypAwyHjGL6um2gnP23oBFyE94eTE=; b=jOQEiKmclPuW6qJpg5+Tx5bAqgRljc7Ap3XSWwDnbrPOjkUNDXnd5tQxDLyjnB9+KYvxMeA+OPuPPvCji9Sihq94j4CaNXaP2Z4KZF0S3ud44GdCOStdCGhkGNE/u16teg8BXFLa7txbZFeQjiKSUnUvmv8b7Wi/41lDODwn0Ew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630698586104143.7467037930661; Fri, 3 Sep 2021 12:49:46 -0700 (PDT) Received: from localhost ([::1]:56578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMFC4-0004EL-Ub for importer@patchew.org; Fri, 03 Sep 2021 15:49:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvM-0005xs-4Y for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMEvK-0003hM-CK for qemu-devel@nongnu.org; Fri, 03 Sep 2021 15:32:27 -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-269-LEoHCQD5O7m8OD_F8isEMg-1; Fri, 03 Sep 2021 15:32:22 -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 5154884A5E1; Fri, 3 Sep 2021 19:32:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35FE55C1C5; Fri, 3 Sep 2021 19:32:17 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0B27D11380D0; Fri, 3 Sep 2021 21:32:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630697545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k0ZkL//WewHwyhqypAwyHjGL6um2gnP23oBFyE94eTE=; b=F56sz6Soz+UvaJ4X7TKPsla3JDGynmB54+NJhgC7FaEFHErx4ZT5UVUZCEQJIvYtxqqd/o C+4NRSgqMYdyVtSZfuIoPC2NsyRAzKT/lkX+IZKLjJWjqtbgxxrF0CFzl2c5iOcxV3SxBn 0k/olO4Q/qU1th7sr0Eu6GpvPJl5H6g= X-MC-Unique: LEoHCQD5O7m8OD_F8isEMg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 13/13] qapi: Tweak error messages for unknown / conflicting 'if' keys Date: Fri, 3 Sep 2021 21:32:09 +0200 Message-Id: <20210903193209.1426791-14-armbru@redhat.com> In-Reply-To: <20210903193209.1426791-1-armbru@redhat.com> References: <20210903193209.1426791-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630698586607100001 Signed-off-by: Markus Armbruster Message-Id: <20210831123809.1107782-13-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/expr.py | 7 +++---- tests/qapi-schema/bad-if-key.err | 2 +- tests/qapi-schema/bad-if-keys.err | 2 +- tests/qapi-schema/enum-if-invalid.err | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index ae4437ba08..b62f0a3640 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -286,13 +286,12 @@ def _check_if(cond: Union[str, object]) -> None: raise QAPISemError( info, "'if' condition of %s must be a string or an object" % sou= rce) + check_keys(cond, info, "'if' condition of %s" % source, [], + ["all", "any", "not"]) if len(cond) !=3D 1: raise QAPISemError( info, - "'if' condition dict of %s must have one key: " - "'all', 'any' or 'not'" % source) - check_keys(cond, info, "'if' condition", [], - ["all", "any", "not"]) + "'if' condition of %s has conflicting keys" % source) =20 oper, operands =3D next(iter(cond.items())) if not operands: diff --git a/tests/qapi-schema/bad-if-key.err b/tests/qapi-schema/bad-if-ke= y.err index a69dc9ee86..38cf44b687 100644 --- a/tests/qapi-schema/bad-if-key.err +++ b/tests/qapi-schema/bad-if-key.err @@ -1,3 +1,3 @@ bad-if-key.json: In struct 'TestIfStruct': -bad-if-key.json:2: 'if' condition has unknown key 'value' +bad-if-key.json:2: 'if' condition of struct has unknown key 'value' Valid keys are 'all', 'any', 'not'. diff --git a/tests/qapi-schema/bad-if-keys.err b/tests/qapi-schema/bad-if-k= eys.err index aceb31dc6d..fe87bd30ac 100644 --- a/tests/qapi-schema/bad-if-keys.err +++ b/tests/qapi-schema/bad-if-keys.err @@ -1,2 +1,2 @@ bad-if-keys.json: In struct 'TestIfStruct': -bad-if-keys.json:2: 'if' condition dict of struct must have one key: 'all'= , 'any' or 'not' +bad-if-keys.json:2: 'if' condition of struct has conflicting keys diff --git a/tests/qapi-schema/enum-if-invalid.err b/tests/qapi-schema/enum= -if-invalid.err index 3bb84075a9..2b2bbffb65 100644 --- a/tests/qapi-schema/enum-if-invalid.err +++ b/tests/qapi-schema/enum-if-invalid.err @@ -1,3 +1,3 @@ enum-if-invalid.json: In enum 'TestIfEnum': -enum-if-invalid.json:2: 'if' condition has unknown key 'val' +enum-if-invalid.json:2: 'if' condition of 'data' member 'bar' has unknown = key 'val' Valid keys are 'all', 'any', 'not'. --=20 2.31.1