All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v6 21/27] qapi: add #if conditions to generated code members
Date: Mon, 10 Dec 2018 08:17:55 +0100	[thread overview]
Message-ID: <87d0q9onoc.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAMxuvaz6zpraY=1U0UJ6jvneTENk9HzvoGtztvbjQJWon0CuaA@mail.gmail.com> (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Sat, 8 Dec 2018 15:19:49 +0400")

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Hi
> On Thu, Dec 6, 2018 at 9:42 PM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>>
>> > Wrap generated enum/struct members and code with #if/#endif, using the
>>
>> enum and struct members
>
> ok
>
>>
>> > .ifcond members added in the previous patches.
>> >
>> > Some types generate both enum and struct members for example, so a
>> > step-by-step is unnecessarily complicated to deal with (it would
>> > easily generate invalid intermediary code).
>>
>> Can you give an example of a schema definition that would lead to
>> complications?
>>
>
> Honestly, I don't remember well (it's been a while I wrote that code).

I know...

> It must be related to implicit enums, such as union kind... If there
> is no strong need to split this patch, I would rather not do that
> extra work.

I'm not looking for reasons to split this patch, I'm looking for
stronger reasons to keep it just like it is :)

Your hunch that complications would arise for simple unions plausible:
there the same conditional needs to be applied both to the C enum's
member and the C union member.

For the generated C code to compile, each union tag enum member
conditional must imply the corresponding variant conditional.

For flat unions, the two are separate.  The QAPI generator makes no
effort to check the enum member's if condition implies the union
variant's if condition; if you mess them up in the schema, you get to
deal with the C compilation errors.

For simple unions, the two are one.

If we separate the generator updates for enums and for union members,
and do enum members first, then unions with conditional tag members
can't compile.  Corrollary: simple unions with conditional variants
can't compile.

What if we do union members first?

Again, I'm not asking for patch splitting here, I'm just trying to
arrive at a clearer understanding to avoid making insufficiently
supported claims in the commit message.  The combined patch looks small
and clean enough to keep it combined.

[...]

  reply	other threads:[~2018-12-10  7:18 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06 10:57 [Qemu-devel] [PATCH v6 00/27] qapi: add #if pre-processor conditions to generated code (part 2) Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 01/27] qmp-shell: learn to send commands with quoted arguments Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 02/27] json: remove useless return value from lexer/parser Marc-André Lureau
2018-07-08  6:09   ` Thomas Huth
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 03/27] tests: change /0.15/* tests to /qmp/* Marc-André Lureau
2018-07-08  6:05   ` Thomas Huth
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 04/27] qapi: Fix some pycodestyle-3 complaints Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 05/27] qapi: include osdep.h in type headers Marc-André Lureau
2018-12-04 15:23   ` Markus Armbruster
2018-12-04 15:32     ` Marc-André Lureau
2018-12-04 16:30       ` Eric Blake
2018-12-04 16:37       ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 06/27] qapi: do not define enumeration value explicitly Marc-André Lureau
2018-12-05 13:19   ` Markus Armbruster
2018-12-08 11:20     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 07/27] qapi: rename QAPISchemaEnumType.values to .members Marc-André Lureau
2018-12-05 13:42   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 08/27] qapi: change enum visitor and gen_enum* to take QAPISchemaMember Marc-André Lureau
2018-12-05 14:02   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 09/27] tests: print enum type members more like object type members Marc-André Lureau
2018-12-05 14:04   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 10/27] qapi: factor out checking for keys Marc-André Lureau
2018-12-05 16:26   ` Markus Armbruster
2018-12-07 11:26     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 11/27] qapi: improve reporting of unknown or missing keys Marc-André Lureau
2018-12-05 16:38   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 12/27] qapi: add a dictionnary form with 'name' key for enum members Marc-André Lureau
2018-12-05 18:02   ` Markus Armbruster
2018-12-08 11:20     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 13/27] qapi: add 'if' to " Marc-André Lureau
2018-12-05 18:29   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 14/27] qapi-event: add 'if' condition to implicit event enum Marc-André Lureau
2018-12-05 18:30   ` Markus Armbruster
2018-12-06 16:02     ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 15/27] qapi: rename allow_dict to allow_implicit Marc-André Lureau
2018-12-05 18:41   ` Markus Armbruster
2018-12-08 11:20     ` Marc-André Lureau
2018-12-10  8:50       ` Markus Armbruster
2018-12-10 11:15         ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 16/27] qapi: add a dictionary form with 'type' key for members Marc-André Lureau
2018-12-06 15:56   ` Markus Armbruster
2018-12-08 11:20     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 17/27] qapi: add 'if' to implicit struct members Marc-André Lureau
2018-12-06 16:11   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 18/27] qapi: add an error in case a discriminator is conditionnal Marc-André Lureau
2018-12-06 16:25   ` Markus Armbruster
2018-12-06 16:26     ` Markus Armbruster
2018-12-10 18:32     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 19/27] qapi: add 'if' on union members Marc-André Lureau
2018-12-06 16:37   ` Markus Armbruster
2018-12-08 11:20     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 20/27] qapi: add 'if' to alternate members Marc-André Lureau
2018-12-06 16:41   ` Markus Armbruster
2018-12-08 11:20     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 21/27] qapi: add #if conditions to generated code members Marc-André Lureau
2018-12-06 17:42   ` Markus Armbruster
2018-12-08 11:19     ` Marc-André Lureau
2018-12-10  7:17       ` Markus Armbruster [this message]
2018-12-10 10:11         ` Markus Armbruster
2018-12-10 11:17           ` Marc-André Lureau
2018-12-10 18:38           ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 22/27] docs: document schema configuration Marc-André Lureau
2018-12-06 18:14   ` Markus Armbruster
2018-12-08 11:19     ` Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 23/27] qapi: add 'If:' condition to enum values documentation Marc-André Lureau
2018-12-06 18:46   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 24/27] qapi: add 'If:' condition to struct members documentation Marc-André Lureau
2018-12-06 18:47   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 25/27] qapi: add condition to variants documentation Marc-André Lureau
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 26/27] qapi: add more conditions to SPICE Marc-André Lureau
2018-12-06 18:54   ` Markus Armbruster
2018-07-06 10:57 ` [Qemu-devel] [PATCH v6 27/27] qapi: add conditions to REPLICATION type/commands on the schema Marc-André Lureau
2018-12-06 18:55   ` Markus Armbruster
2018-10-02 20:56 ` [Qemu-devel] [PATCH v6 00/27] qapi: add #if pre-processor conditions to generated code (part 2) Marc-André Lureau
2018-11-08 12:22 ` Marc-André Lureau
2018-12-06 19:13 ` 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=87d0q9onoc.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.