qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: stefanha@redhat.com, "Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PULL 3/6] qapi: cope with feature names containing a '-'
Date: Mon, 10 Feb 2025 09:39:43 +0100	[thread overview]
Message-ID: <20250210083946.3553415-4-armbru@redhat.com> (raw)
In-Reply-To: <20250210083946.3553415-1-armbru@redhat.com>

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

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>
---
 scripts/qapi/gen.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 .common import (
+    c_enum_const,
     c_fname,
     c_name,
     guardend,
@@ -41,7 +42,7 @@
 
 
 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'
 
-- 
2.48.1



  parent reply	other threads:[~2025-02-10  8:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10  8:39 [PULL 0/6] QAPI patches patches for 2025-02-10 Markus Armbruster
2025-02-10  8:39 ` [PULL 1/6] qapi: fix colon in Since tag section Markus Armbruster
2025-02-10  8:39 ` [PULL 2/6] qapi/ui: Fix documentation of upper bound value in InputMoveEvent Markus Armbruster
2025-02-10  8:39 ` Markus Armbruster [this message]
2025-02-10  8:39 ` [PULL 4/6] qapi: change 'unsigned special_features' to 'uint64_t features' Markus Armbruster
2025-02-10  8:39 ` [PULL 5/6] qapi: rename 'special_features' to 'features' Markus Armbruster
2025-02-10  8:39 ` [PULL 6/6] qapi: expose all schema features to code Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250210083946.3553415-4-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).