[PATCH v2 2/4] scripts/qapi: allow optional experimental enum values

Vladimir Sementsov-Ogievskiy posted 4 patches 2 years, 9 months ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Hailiang Zhang <zhanghailiang@xfusion.com>, Juan Quintela <quintela@redhat.com>, Jason Wang <jasowang@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Michael Roth <michael.roth@amd.com>
There is a newer version of this series
[PATCH v2 2/4] scripts/qapi: allow optional experimental enum values
Posted by Vladimir Sementsov-Ogievskiy 2 years, 9 months ago
To be used in the next commit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 scripts/qapi/types.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
index c39d054d2c..18f8734047 100644
--- a/scripts/qapi/types.py
+++ b/scripts/qapi/types.py
@@ -61,10 +61,12 @@ def gen_enum_lookup(name: str,
 
         special_features = gen_special_features(memb.features)
         if special_features != '0':
+            feats += memb.ifcond.gen_if()
             feats += mcgen('''
         [%(index)s] = %(special_features)s,
 ''',
                            index=index, special_features=special_features)
+            feats += memb.ifcond.gen_endif()
 
     if feats:
         ret += mcgen('''
-- 
2.34.1
Re: [PATCH v2 2/4] scripts/qapi: allow optional experimental enum values
Posted by Eric Blake 2 years, 9 months ago
On Thu, Apr 20, 2023 at 01:52:30AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> To be used in the next commit.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>  scripts/qapi/types.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
> index c39d054d2c..18f8734047 100644
> --- a/scripts/qapi/types.py
> +++ b/scripts/qapi/types.py
> @@ -61,10 +61,12 @@ def gen_enum_lookup(name: str,
>  
>          special_features = gen_special_features(memb.features)
>          if special_features != '0':
> +            feats += memb.ifcond.gen_if()
>              feats += mcgen('''
>          [%(index)s] = %(special_features)s,
>  ''',
>                             index=index, special_features=special_features)
> +            feats += memb.ifcond.gen_endif()

Perhaps Markus will have a comment here; but in general, changes to
the QAPI that don't have accompanying changes in the testsuite are
hard to prove that they do something useful.

At a minimum, the commit message should at least say what sort of
things are not permitted without this patch that are now possible,
rather than making me figure out what the next patch uses that failed
the QAPI generator without this patch.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Re: [PATCH v2 2/4] scripts/qapi: allow optional experimental enum values
Posted by Vladimir Sementsov-Ogievskiy 2 years, 9 months ago
On 20.04.23 17:43, Eric Blake wrote:
> On Thu, Apr 20, 2023 at 01:52:30AM +0300, Vladimir Sementsov-Ogievskiy wrote:
>> To be used in the next commit.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
>> ---
>>   scripts/qapi/types.py | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
>> index c39d054d2c..18f8734047 100644
>> --- a/scripts/qapi/types.py
>> +++ b/scripts/qapi/types.py
>> @@ -61,10 +61,12 @@ def gen_enum_lookup(name: str,
>>   
>>           special_features = gen_special_features(memb.features)
>>           if special_features != '0':
>> +            feats += memb.ifcond.gen_if()
>>               feats += mcgen('''
>>           [%(index)s] = %(special_features)s,
>>   ''',
>>                              index=index, special_features=special_features)
>> +            feats += memb.ifcond.gen_endif()
> 
> Perhaps Markus will have a comment here; but in general, changes to
> the QAPI that don't have accompanying changes in the testsuite are
> hard to prove that they do something useful.
> 
> At a minimum, the commit message should at least say what sort of
> things are not permitted without this patch that are now possible,
> rather than making me figure out what the next patch uses that failed
> the QAPI generator without this patch.
> 

OK, I'll improve the commit message if we decide to keep patch 3 as is.

Actually patch would be more obvious if have a bit more code context: just above this same gen_if()s are called to generate #ifdefs for enum members.


-- 
Best regards,
Vladimir
Re: [PATCH v2 2/4] scripts/qapi: allow optional experimental enum values
Posted by Juan Quintela 2 years, 9 months ago
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> wrote:
> To be used in the next commit.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

I am cc'd, but this is black magic to me.

Later, Juan.