qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/14] qapi: cope with special feature names containing a '-'


From: Markus Armbruster
Subject: Re: [PATCH 03/14] qapi: cope with special feature names containing a '-'
Date: Fri, 12 Jul 2024 09:54:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Daniel P. Berrangé <berrange@redhat.com> writes:

> When we shortly allow custom special feature names to be defined, it
> will be valid to include a '-', which must be translated to a '_'
> when generating code.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  scripts/qapi/gen.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
> index 9c590a1c2e..650efc59ed 100644
> --- a/scripts/qapi/gen.py
> +++ b/scripts/qapi/gen.py
> @@ -41,7 +41,7 @@
>  
>  
>  def gen_special_features(features: Sequence[QAPISchemaFeature]) -> str:
> -    special_features = [f"1u << QAPI_FEATURE_{feat.name.upper()}"
> +    special_features = [f"1u << 
> QAPI_FEATURE_{feat.name.upper().replace('-','_')}"
>                          for feat in features if feat.is_special()]
>      return ' | '.join(special_features) or '0'

I'd prefer something like

    f"1 << {c_enum_const('QAPI_FEATURE', feat.name)}"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]