From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: John Snow <jsnow@redhat.com>, QEMU <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [PATCH v4 8/9] qapi: make 'if' condition strings simple identifiers
Date: Fri, 21 May 2021 16:26:12 +0400 [thread overview]
Message-ID: <CAJ+F1C+st7399x7RYfW38DjQKWMFWhXq+C+x0QGkZnD23mDofw@mail.gmail.com> (raw)
In-Reply-To: <871ra05m6r.fsf@dusky.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 2634 bytes --]
On Fri, May 21, 2021 at 4:03 PM Markus Armbruster <armbru@redhat.com> wrote:
> marcandre.lureau@redhat.com writes:
>
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Change the 'if' condition strings to be C-agnostic and be simple
> > identifiers.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> > Tested-by: John Snow <jsnow@redhat.com>
> > ---
>
> [...]
>
> > diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
> > index c1cb6f987d..edaaf7ec40 100644
> > --- a/docs/devel/qapi-code-gen.txt
> > +++ b/docs/devel/qapi-code-gen.txt
> > @@ -791,7 +791,7 @@ will then be guarded by #if STRING for each STRING
> in the COND list.
> > Example: a conditional struct
> >
> > { 'struct': 'IfStruct', 'data': { 'foo': 'int' },
> > - 'if': ['defined(CONFIG_FOO)', 'defined(HAVE_BAR)'] }
> > + 'if': ['CONFIG_FOO', 'HAVE_BAR'] }
> >
> > gets its generated code guarded like this:
> >
> > @@ -810,7 +810,7 @@ member 'bar'
> >
> > { 'struct': 'IfStruct', 'data':
> > { 'foo': 'int',
> > - 'bar': { 'type': 'int', 'if': 'defined(IFCOND)'} } }
> > + 'bar': { 'type': 'int', 'if': 'IFCOND'} } }
> >
> > A union's discriminator may not be conditional.
> >
> > @@ -822,7 +822,7 @@ value 'bar'
> >
> > { 'enum': 'IfEnum', 'data':
> > [ 'foo',
> > - { 'name' : 'bar', 'if': 'defined(IFCOND)' } ] }
> > + { 'name' : 'bar', 'if': 'IFCOND' } ] }
> >
> > Likewise, features can be conditional. This requires the longhand
> > form of FEATURE.
> > @@ -832,7 +832,7 @@ Example: a struct with conditional feature
> 'allow-negative-numbers'
> > { 'struct': 'TestType',
> > 'data': { 'number': 'int' },
> > 'features': [ { 'name': 'allow-negative-numbers',
> > - 'if': 'defined(IFCOND)' } ] }
> > + 'if': 'IFCOND' } ] }
> >
> > Please note that you are responsible to ensure that the C code will
> > compile with an arbitrary combination of conditions, since the
>
> At this point in your series, the documentation does not yet reflect the
> code changes you've made. You now add another change together with a
> doc update. Now the docs match *no* version of the code, past, present,
> or future. I find this confusing. Swap the last two patches?
>
> How do you feel about updating documentation before the code?
>
I thought it would be simpler to update the doc in one go as the last patch
of this series. But if you prefer intermediary doc update, I can do that.
--
Marc-André Lureau
[-- Attachment #2: Type: text/html, Size: 4185 bytes --]
next prev parent reply other threads:[~2021-05-21 12:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 16:30 [PATCH v4 0/9] qapi: untie 'if' conditions from C preprocessor marcandre.lureau
2021-05-17 16:30 ` [PATCH v4 1/9] qapi: replace List[str] by QAPISchemaIfCond marcandre.lureau
2021-06-07 14:18 ` Eric Blake
2021-06-08 11:38 ` Marc-André Lureau
2021-05-17 16:30 ` [PATCH v4 2/9] qapi: make gen_if/gen_endif take a simple string marcandre.lureau
2021-05-17 16:30 ` [PATCH v4 3/9] qapi: start building an 'if' predicate tree marcandre.lureau
2021-05-17 16:30 ` [PATCH v4 4/9] qapi: introduce IfPredicateList and IfAny marcandre.lureau
2021-05-17 16:30 ` [PATCH v4 5/9] qapi: add IfNot marcandre.lureau
2021-05-17 16:30 ` [PATCH v4 6/9] qapi: normalize 'if' condition to IfPredicate tree marcandre.lureau
2021-05-17 16:30 ` [PATCH v4 7/9] qapi: convert 'if' C-expressions to the new syntax tree marcandre.lureau
2021-05-17 16:30 ` [PATCH v4 8/9] qapi: make 'if' condition strings simple identifiers marcandre.lureau
2021-05-21 12:02 ` Markus Armbruster
2021-05-21 12:26 ` Marc-André Lureau [this message]
2021-05-21 15:07 ` Markus Armbruster
2021-05-17 16:30 ` [PATCH v4 9/9] docs: update the documentation about schema configuration marcandre.lureau
2021-05-21 11:56 ` Markus Armbruster
2021-05-21 12:29 ` Marc-André Lureau
2021-05-21 15:24 ` [PATCH v4 0/9] qapi: untie 'if' conditions from C preprocessor Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJ+F1C+st7399x7RYfW38DjQKWMFWhXq+C+x0QGkZnD23mDofw@mail.gmail.com \
--to=marcandre.lureau@gmail.com \
--cc=armbru@redhat.com \
--cc=jsnow@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).