[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 14/22] qapi: add an error in case a discrimin
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v8 14/22] qapi: add an error in case a discriminator is conditional |
Date: |
Thu, 13 Dec 2018 16:45:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> Marc-André Lureau <address@hidden> writes:
>
>> Making a discriminator conditional doesn't make much sense. "qapi:
I guess it could be made to work as long as the discriminator's
condition implies each variant's condition. Example:
{ 'union': 'BlockdevQcow2Encryption',
'base': {
'format': { 'type': 'BlockdevQcow2EncryptionFormat',
'if': 'defined(CONFIG_AES) || defined(CONFIG_LUKS)' } },
'discriminator': 'format',
'data': {
'aes': { 'type': 'QCryptoBlockOptionsQCow',
'if': 'defined(CONFIG_AES)' },
'luks': 'type': 'QCryptoBlockOptionsLUKS',
'if': 'defined(CONFIG_LUKS)' } }
Now, this example looks like a bad idea. Whether there's a more
legitimate use remains to be seen. Until then, outlawing conditional
discriminators is totally fine with me.
>> add a dictionary form for TYPE" allows it, this patch fixes
>> it. Eventually the two could be merged, but for clarity of review it
>> is kept separate.
>>
>> Signed-off-by: Marc-André Lureau <address@hidden>
>
> Reviewed-by: Markus Armbruster <address@hidden>
>
> I may accept the offer to let me squash it into the previous patch when
> I apply.
Squashed patch's commit message:
qapi: Add 'if' to implicit struct members
The generated code is for now *unconditional*. Later patches generate
the conditionals.
Note that union discriminators may not have 'if' conditionals.
Avoids passing judgement :)
- Re: [Qemu-devel] [PATCH v8 07/22] qapi: pass long form enum to make_enum_members, (continued)
- [Qemu-devel] [PATCH v8 08/22] qapi: simplify make_enum_members(), Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 09/22] qapi: add 'if' to enum members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 10/22] qapi-events: add 'if' condition to implicit event enum, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 11/22] qapi: rename allow_dict to allow_implicit, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 13/22] qapi: add 'if' to implicit struct members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 12/22] qapi: add a dictionary form for TYPE, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 14/22] qapi: add an error in case a discriminator is conditional, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 15/22] qapi: add 'if' to union members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 16/22] qapi: add 'if' to alternate members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 17/22] qapi: add #if conditions to generated code members, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 18/22] qapi: add 'If:' condition to enum values documentation, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 19/22] qapi: add 'If:' condition to struct members documentation, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 20/22] qapi: add condition to variants documentation, Marc-André Lureau, 2018/12/13
- [Qemu-devel] [PATCH v8 22/22] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2018/12/13