All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 2/3] scripts/qapi: reject empty enums
Date: Mon, 27 Jul 2026 10:47:54 +0200	[thread overview]
Message-ID: <87a4rc24zp.fsf@pond.sub.org> (raw)
In-Reply-To: <20260724130044.1369843-3-pbonzini@redhat.com> (Paolo Bonzini's message of "Fri, 24 Jul 2026 15:00:42 +0200")

Paolo Bonzini <pbonzini@redhat.com> writes:

> Raise an error if an enum has no members.  Such enums cannot be populated
> with a valid value, and therefore they can only be used as optional
> members.  But QAPI leaves out optional members from the serialization
> protocol, and therefore the existence of the enum is completely pointless.
>
> The same limitation is not extended to an enum whose members are all
> compiled out; these can still be useful as optional members.  However they
> cannot implicitly block usage of parent structures because, by virtue
> of having only conditional members, they are "enums with conditional
> first item" and must therefore be optional.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

This one definitely needs to update docs/devel/qapi-code-gen.rst,
because that one has

    Nothing prevents an empty enumeration, although it is probably not
    useful.



  reply	other threads:[~2026-07-27  8:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 13:00 [PATCH resend 0/3] scripts/qapi: non-Rust-specific preparatory patches Paolo Bonzini
2026-07-24 13:00 ` [PATCH 1/3] scripts/qapi: enum with conditional first item must be optional Paolo Bonzini
2026-07-25  6:15   ` Markus Armbruster
2026-07-25 12:20     ` Paolo Bonzini
2026-07-27  9:32       ` Markus Armbruster
2026-07-24 13:00 ` [PATCH 2/3] scripts/qapi: reject empty enums Paolo Bonzini
2026-07-27  8:47   ` Markus Armbruster [this message]
2026-07-24 13:00 ` [PATCH 3/3] scripts/qapi: pull c_name and lstrip from camel_to_upper to caller Paolo Bonzini

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=87a4rc24zp.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.