diff options
| author | Daniel P. Berrangé <berrange@redhat.com> | 2025-02-05 12:35:47 +0000 |
|---|---|---|
| committer | Markus Armbruster <armbru@redhat.com> | 2025-02-10 15:45:04 +0100 |
| commit | d8a22e69fec2aa495665ee95af1997651a20ca1f (patch) | |
| tree | 262b33c14febab93e7672135064c11c5903aca0b /scripts/qapi | |
| parent | 208bd4333583e6e3228e8601a4f1b52595dde291 (diff) | |
| download | focaccia-qemu-d8a22e69fec2aa495665ee95af1997651a20ca1f.tar.gz focaccia-qemu-d8a22e69fec2aa495665ee95af1997651a20ca1f.zip | |
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>
Diffstat (limited to 'scripts/qapi')
| -rw-r--r-- | scripts/qapi/gen.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 6a8abe0041..c53ca72950 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -24,6 +24,7 @@ from typing import ( ) from .common import ( + c_enum_const, c_fname, c_name, guardend, @@ -41,7 +42,7 @@ from .source import QAPISourceInfo 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()] return ' | '.join(special_features) or '0' |