mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: cope with feature names containing a '-'
When we shortly expose all feature names to code, it will be valid to include a '-', which must be translated to a '_' for the enum constants. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20250205123550.2754387-2-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
208bd43335
commit
d8a22e69fe
1 changed files with 2 additions and 1 deletions
|
@ -24,6 +24,7 @@ from typing import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
|
c_enum_const,
|
||||||
c_fname,
|
c_fname,
|
||||||
c_name,
|
c_name,
|
||||||
guardend,
|
guardend,
|
||||||
|
@ -41,7 +42,7 @@ from .source import QAPISourceInfo
|
||||||
|
|
||||||
|
|
||||||
def gen_special_features(features: Sequence[QAPISchemaFeature]) -> str:
|
def gen_special_features(features: Sequence[QAPISchemaFeature]) -> str:
|
||||||
special_features = [f"1u << QAPI_{feat.name.upper()}"
|
special_features = [f"1u << {c_enum_const('qapi', feat.name)}"
|
||||||
for feat in features if feat.is_special()]
|
for feat in features if feat.is_special()]
|
||||||
return ' | '.join(special_features) or '0'
|
return ' | '.join(special_features) or '0'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue