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 10/10] docs/devel/qapi-code-gen: Discourage use of 'prefix'
Date: Thu,  6 Mar 2025 10:36:01 +0100	[thread overview]
Message-ID: <20250306093601.2264772-11-armbru@redhat.com> (raw)
In-Reply-To: <20250306093601.2264772-1-armbru@redhat.com>

QAPI's 'prefix' feature can make the connection between enumeration
type and its constants less than obvious.  It's best used with
restraint.  Commit 7bbadc60b5..64f5e9db77 eliminated most uses.
Discourage new ones.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250228134335.132278-1-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 docs/devel/qapi-code-gen.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst
index 9fa94251b0..f9cfe8721f 100644
--- a/docs/devel/qapi-code-gen.rst
+++ b/docs/devel/qapi-code-gen.rst
@@ -229,7 +229,8 @@ These are of the form PREFIX_NAME, where PREFIX is derived from the
 enumeration type's name, and NAME from the value's name.  For the
 example above, the generator maps 'MyEnum' to MY_ENUM and 'value1' to
 VALUE1, resulting in the enumeration constant MY_ENUM_VALUE1.  The
-optional 'prefix' member overrides PREFIX.
+optional 'prefix' member overrides PREFIX.  This is rarely necessary,
+and should be used with restraint.
 
 The generated C enumeration constants have values 0, 1, ..., N-1 (in
 QAPI schema order), where N is the number of values.  There is an
-- 
2.48.1



  parent reply	other threads:[~2025-03-06  9:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06  9:35 [PULL 00/10] QAPI patches patches for 2025-03-06 Markus Armbruster
2025-03-06  9:35 ` [PULL 01/10] docs/about/build-platforms: Correct minimum supported Python version Markus Armbruster
2025-03-06  9:35 ` [PULL 02/10] qapi: Eliminate OrderedDict Markus Armbruster
2025-03-06  9:35 ` [PULL 03/10] qapi/introspect: Use @dataclass to simplify Markus Armbruster
2025-03-06  9:35 ` [PULL 04/10] qdev: Delete unused qdev_prop_enum Markus Armbruster
2025-03-06  9:35 ` [PULL 05/10] qdev: Change qdev_prop_pci_devfn member @name from "int32" to "str" Markus Armbruster
2025-03-06  9:35 ` [PULL 06/10] qdev: Rename PropertyInfo member @name to @type Markus Armbruster
2025-03-06  9:35 ` [PULL 07/10] qdev: Change values of PropertyInfo member @type to be QAPI types Markus Armbruster
2025-03-06  9:35 ` [PULL 08/10] qdev: Improve PropertyInfo member @description for enum properties Markus Armbruster
2025-03-06  9:36 ` [PULL 09/10] qdev: Improve a few more PropertyInfo @description members Markus Armbruster
2025-03-06  9:36 ` Markus Armbruster [this message]
2025-03-07  7:18 ` [PULL 00/10] QAPI patches patches for 2025-03-06 Stefan Hajnoczi

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=20250306093601.2264772-11-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).