From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDDB1C433B4 for ; Mon, 17 May 2021 11:29:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B204610CB for ; Mon, 17 May 2021 11:29:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B204610CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1libRe-0005Wz-JO for qemu-devel@archiver.kernel.org; Mon, 17 May 2021 07:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1libIQ-0006A9-0P for qemu-devel@nongnu.org; Mon, 17 May 2021 07:20:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1libIM-0006Pm-BK for qemu-devel@nongnu.org; Mon, 17 May 2021 07:20:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621250421; 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: in-reply-to:in-reply-to:references:references; bh=eFzU2pqEj5gXD6qVc+1ng4/0MfloOBdMWmBKErIQkb0=; b=KYTwFGnA74TCcmODPALJR7pBf7QQIk5mBtNf2bRHpvfsrXRL1f5U68ElD9NPk749/AsRY5 JN/ljMVIz/4ANEkzvkJ3c4m3xBAXwUPrjWoUTmgznSqKM5GLdsVHvvkZpA4OgFPtPb08p9 Bti9rfuxMl6lXhm+obQ/3q1uc22vGdE= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-81WA_iHHPL6CloFDQZ_Zgw-1; Mon, 17 May 2021 07:20:14 -0400 X-MC-Unique: 81WA_iHHPL6CloFDQZ_Zgw-1 Received: by mail-pl1-f198.google.com with SMTP id 31-20020a1709020022b02900eeddd708c8so1543615pla.11 for ; Mon, 17 May 2021 04:20:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eFzU2pqEj5gXD6qVc+1ng4/0MfloOBdMWmBKErIQkb0=; b=WLhZ6wcBsX/LShDh4AuB213UiN9ZwWikAoGRp7no/teR6Z9/uJY3w7gLRFFVuaYePU WxkESct0VE4W8L5Q3jXEcPN4qUnSCstvcnWC9cQM4joutY1HoJaRVvRIo3FGwR26O/Y7 aT4+F5PsWDhscmR//PckJoD1TcXgfo2HFH2ny1Mo9OY7GoMdHB3+U3Ii63ywJ8V4xKs/ eNP96oMtBobUAuaqNS6LUCbxuVDg5S8nP4QsI6MOOMBdKHHbR3kpQuQH93J+q8kVPQy1 5Gm1vBZAWLmr2Lwx54MZDxebE1umaGtY6NMYREDcpmt5BCARv4lea7A6Sqm7+U4iq/p2 EJfQ== X-Gm-Message-State: AOAM530XpzOpMH+qAMHio/+gu9bT2H5hcJysKmen42qOT6srI//+HgjJ HbTYhEz4eHSAGAU4a8GAEU+KT7JItjNVwOTYwWts5ma2GqkPWBVpFKCk47u7YIla8kbItApPk6q wITcCGqwJ91CIpheKh23azrHYM7QpSpw= X-Received: by 2002:a17:90a:728f:: with SMTP id e15mr2789562pjg.137.1621250413189; Mon, 17 May 2021 04:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJKYqlUNXfK6Cg9LTKFNKJ+3l/d/OB4r7GnsmCt+JozRCwCBlJtObNDsuVdzgKES2kmO3h0DC2Dv0Eh1dbr6k= X-Received: by 2002:a17:90a:728f:: with SMTP id e15mr2789536pjg.137.1621250412924; Mon, 17 May 2021 04:20:12 -0700 (PDT) MIME-Version: 1.0 References: <20210429134032.1125111-1-marcandre.lureau@redhat.com> <20210429134032.1125111-8-marcandre.lureau@redhat.com> <4ed66620-1e7a-fbc1-78c2-1919484a7ff2@redhat.com> In-Reply-To: <4ed66620-1e7a-fbc1-78c2-1919484a7ff2@redhat.com> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Mon, 17 May 2021 15:20:02 +0400 Message-ID: Subject: Re: [PATCH v3 7/9] qapi: convert 'if' C-expressions to the new syntax tree To: John Snow Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mlureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000f46dc505c284c6ff" Received-SPF: pass client-ip=170.10.133.124; envelope-from=mlureau@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.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel , "Armbruster, Markus" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000f46dc505c284c6ff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Thu, May 13, 2021 at 3:51 AM John Snow wrote: > On 4/29/21 9:40 AM, marcandre.lureau@redhat.com wrote: > > From: Marc-Andr=C3=A9 Lureau > > > > Signed-off-by: Marc-Andr=C3=A9 Lureau > > --- > > qapi/machine-target.json | 20 ++++++++++++++++---- > > qapi/misc-target.json | 13 ++++++++++++- > > 2 files changed, 28 insertions(+), 5 deletions(-) > > > > diff --git a/qapi/machine-target.json b/qapi/machine-target.json > > index e7811654b7..9b56b81bea 100644 > > --- a/qapi/machine-target.json > > +++ b/qapi/machine-target.json > > @@ -213,7 +213,9 @@ > > ## > > { 'struct': 'CpuModelExpansionInfo', > > 'data': { 'model': 'CpuModelInfo' }, > > - 'if': 'defined(TARGET_S390X) || defined(TARGET_I386) || > defined(TARGET_ARM)' } > > + 'if': { 'any': [ 'defined(TARGET_S390X)', > > + 'defined(TARGET_I386)', > > + 'defined(TARGET_ARM)'] } } > > > > ## > > # @query-cpu-model-expansion: > > @@ -252,7 +254,9 @@ > > 'data': { 'type': 'CpuModelExpansionType', > > 'model': 'CpuModelInfo' }, > > 'returns': 'CpuModelExpansionInfo', > > - 'if': 'defined(TARGET_S390X) || defined(TARGET_I386) || > defined(TARGET_ARM)' } > > + 'if': { 'any': [ 'defined(TARGET_S390X)', > > + 'defined(TARGET_I386)', > > + 'defined(TARGET_ARM)' ] } } > > > > ## > > # @CpuDefinitionInfo: > > @@ -316,7 +320,11 @@ > > 'typename': 'str', > > '*alias-of' : 'str', > > 'deprecated' : 'bool' }, > > - 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || > defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } > > + 'if': { 'any': [ 'defined(TARGET_PPC)', > > + 'defined(TARGET_ARM)', > > + 'defined(TARGET_I386)', > > + 'defined(TARGET_S390X)', > > + 'defined(TARGET_MIPS)' ] } } > > > > ## > > # @query-cpu-definitions: > > @@ -328,4 +336,8 @@ > > # Since: 1.2 > > ## > > { 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'= ], > > - 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || > defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } > > + 'if': { 'any': [ 'defined(TARGET_PPC)', > > + 'defined(TARGET_ARM)', > > + 'defined(TARGET_I386)', > > + 'defined(TARGET_S390X)', > > + 'defined(TARGET_MIPS)' ] } } > > diff --git a/qapi/misc-target.json b/qapi/misc-target.json > > index 0c7491cd82..2891df6890 100644 > > --- a/qapi/misc-target.json > > +++ b/qapi/misc-target.json > > @@ -23,7 +23,18 @@ > > ## > > { 'event': 'RTC_CHANGE', > > 'data': { 'offset': 'int' }, > > - 'if': 'defined(TARGET_ALPHA) || defined(TARGET_ARM) || > defined(TARGET_HPPA) || defined(TARGET_I386) || defined(TARGET_MIPS) || > defined(TARGET_MIPS64) || defined(TARGET_MOXIE) || defined(TARGET_PPC) || > defined(TARGET_PPC64) || defined(TARGET_S390X) || defined(TARGET_SH4) || > defined(TARGET_SPARC)' } > > + 'if': { 'any': [ 'defined(TARGET_ALPHA)', > > + 'defined(TARGET_ARM)', > > + 'defined(TARGET_HPPA)', > > + 'defined(TARGET_I386)', > > + 'defined(TARGET_MIPS)', > > + 'defined(TARGET_MIPS64)', > > + 'defined(TARGET_MOXIE)', > > + 'defined(TARGET_PPC)', > > + 'defined(TARGET_PPC64)', > > + 'defined(TARGET_S390X)', > > + 'defined(TARGET_SH4)', > > + 'defined(TARGET_SPARC)' ] } } > > > > ## > > # @rtc-reset-reinjection: > > > > I suppose these are necessary to convert because they were a single > giant string, and not actually a list. > > If you're going to keep the list-of-strings sugar, is it worth just > changing these to a list of strings? > > (How does your rust generator handle the defined(xxx) strings? does it > strip the defined(...) off somehow?) > As you figured out, the next patch removes the C-ism (this is really the purpose of this series) > > Tested-by: John Snow > > --js > > --000000000000f46dc505c284c6ff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Thu, May 13, 2021 at 3:51 AM Joh= n Snow <jsnow@redh= at.com> wrote:
On 4/29/21 9:40 AM, marcandre.lureau@redhat.com wrote:
> From: Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com>
>
> Signed-off-by: Marc-Andr=C3=A9 Lureau <marcandre.lureau@redhat.com> > ---
>=C2=A0 =C2=A0qapi/machine-target.json | 20 ++++++++++++++++----
>=C2=A0 =C2=A0qapi/misc-target.json=C2=A0 =C2=A0 | 13 ++++++++++++-
>=C2=A0 =C2=A02 files changed, 28 insertions(+), 5 deletions(-)
>
> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
> index e7811654b7..9b56b81bea 100644
> --- a/qapi/machine-target.json
> +++ b/qapi/machine-target.json
> @@ -213,7 +213,9 @@
>=C2=A0 =C2=A0##
>=C2=A0 =C2=A0{ 'struct': 'CpuModelExpansionInfo',
>=C2=A0 =C2=A0 =C2=A0'data': { 'model': 'CpuModelInf= o' },
> -=C2=A0 'if': 'defined(TARGET_S390X) || defined(TARGET_I38= 6) || defined(TARGET_ARM)' }
> +=C2=A0 'if': { 'any': [ 'defined(TARGET_S390X)= 9;,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_I386)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_ARM)'] } }
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0##
>=C2=A0 =C2=A0# @query-cpu-model-expansion:
> @@ -252,7 +254,9 @@
>=C2=A0 =C2=A0 =C2=A0'data': { 'type': 'CpuModelExpa= nsionType',
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'model':= 'CpuModelInfo' },
>=C2=A0 =C2=A0 =C2=A0'returns': 'CpuModelExpansionInfo',=
> -=C2=A0 'if': 'defined(TARGET_S390X) || defined(TARGET_I38= 6) || defined(TARGET_ARM)' }
> +=C2=A0 'if': { 'any': [ 'defined(TARGET_S390X)= 9;,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_I386)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_ARM)' ] } }
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0##
>=C2=A0 =C2=A0# @CpuDefinitionInfo:
> @@ -316,7 +320,11 @@
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'typename= 9;: 'str',
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'*alias-of&#= 39; : 'str',
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'deprecated&= #39; : 'bool' },
> -=C2=A0 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) = || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)= 9; }
> +=C2=A0 'if': { 'any': [ 'defined(TARGET_PPC)'= ,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_ARM)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_I386)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_S390X)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_MIPS)' ] } }
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0##
>=C2=A0 =C2=A0# @query-cpu-definitions:
> @@ -328,4 +336,8 @@
>=C2=A0 =C2=A0# Since: 1.2
>=C2=A0 =C2=A0##
>=C2=A0 =C2=A0{ 'command': 'query-cpu-definitions', '= ;returns': ['CpuDefinitionInfo'],
> -=C2=A0 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) = || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)= 9; }
> +=C2=A0 'if': { 'any': [ 'defined(TARGET_PPC)'= ,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_ARM)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_I386)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_S390X)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_MIPS)' ] } }
> diff --git a/qapi/misc-target.json b/qapi/misc-target.json
> index 0c7491cd82..2891df6890 100644
> --- a/qapi/misc-target.json
> +++ b/qapi/misc-target.json
> @@ -23,7 +23,18 @@
>=C2=A0 =C2=A0##
>=C2=A0 =C2=A0{ 'event': 'RTC_CHANGE',
>=C2=A0 =C2=A0 =C2=A0'data': { 'offset': 'int' }= ,
> -=C2=A0 'if': 'defined(TARGET_ALPHA) || defined(TARGET_ARM= ) || defined(TARGET_HPPA) || defined(TARGET_I386) || defined(TARGET_MIPS) |= | defined(TARGET_MIPS64) || defined(TARGET_MOXIE) || defined(TARGET_PPC) ||= defined(TARGET_PPC64) || defined(TARGET_S390X) || defined(TARGET_SH4) || d= efined(TARGET_SPARC)' }
> +=C2=A0 'if': { 'any': [ 'defined(TARGET_ALPHA)= 9;,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_ARM)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_HPPA)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_I386)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_MIPS)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_MIPS64)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_MOXIE)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_PPC)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_PPC64)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_S390X)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_SH4)',
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 'defined(TARGET_SPARC)' ] } }
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0##
>=C2=A0 =C2=A0# @rtc-reset-reinjection:
>

I suppose these are necessary to convert because they were a single
giant string, and not actually a list.

If you're going to keep the list-of-strings sugar, is it worth just changing these to a list of strings?

(How does your rust generator handle the defined(xxx) strings? does it
strip the defined(...) off somehow?)

As= you figured out, the next patch removes the C-ism (this is really the purp= ose of this series)
=C2=A0

Tested-by: John Snow <jsnow@redhat.com>

--js

--000000000000f46dc505c284c6ff--