From: Eduardo Habkost <ehabkost@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/3] qapi: Add enum_table[] parameter to start_alternate
Date: Fri, 5 May 2017 17:51:45 -0300 [thread overview]
Message-ID: <20170505205145.GO3482@thinpad.lan.raisama.net> (raw)
In-Reply-To: <9f623263-e78c-fbb3-5ac4-5629d68c4bbc@redhat.com>
On Fri, May 05, 2017 at 03:45:01PM -0500, Eric Blake wrote:
> On 05/05/2017 03:11 PM, Eduardo Habkost wrote:
> > The new parameter will be used by the string input visitor to detect
> > alternate types that can't be parsed unambiguously.
> >
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > Changes v1 -> v2:
> > * (new patch added to series)
> > ---
>
> > +++ b/include/qapi/visitor.h
> > @@ -411,13 +411,21 @@ void visit_end_list(Visitor *v, void **list);
> > * @supported_qtypes is a bit mask indicating which QTypes are supported
> > * by the alternate.
> > *
> > + * @enum_table contains the enum value lookup table, in case
> > + * strings in the input are going to be parsed as enums. Visitors
> > + * aren't required to validate string input according to
> > + * enum_table, as visit_type_enum() will be called automatically
> > + * if (*obj)->type is QTYPE_QSTRING.
>
> Presumably, enum_table will be NULL if the alternate type does not
> include an enum? [reads ahead] yes. Should be documented.
>
> I'm less convinced we need this patch, if we can instead guarantee at
> QAPI-generation time that alternates are not possible if they would
> cause an ambiguity.
I am not 100% sure either. I just have the feeling that we are
likely to break the rules and allow ambiguous enums in
exceptional cases in the future, and then this code will be
useful.
That doesn't mean we need to maintain it in the source tree. We
can leave it on the git history, or just on the qemu-devel
archives.
--
Eduardo
next prev parent reply other threads:[~2017-05-05 20:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-05 20:11 [Qemu-devel] [PATCH v2 0/3] string-input-visitor: Support enum/bool alternate types Eduardo Habkost
2017-05-05 20:11 ` [Qemu-devel] [PATCH v2 1/3] visitor: Add 'supported_qtypes' parameter to visit_start_alternate() Eduardo Habkost
2017-05-05 20:26 ` Eric Blake
2017-05-10 13:16 ` Markus Armbruster
2017-05-10 21:10 ` Eduardo Habkost
2017-05-11 7:04 ` Markus Armbruster
2017-05-05 20:11 ` [Qemu-devel] [PATCH v2 2/3] qapi: Add enum_table[] parameter to start_alternate Eduardo Habkost
2017-05-05 20:45 ` Eric Blake
2017-05-05 20:51 ` Eduardo Habkost [this message]
2017-05-10 13:34 ` Markus Armbruster
2017-05-10 13:38 ` Eduardo Habkost
2017-05-05 20:11 ` [Qemu-devel] [PATCH v2 3/3] string-input-visitor: Support alternate types Eduardo Habkost
2017-05-05 20:53 ` Eric Blake
2017-05-05 21:09 ` Eduardo Habkost
2017-05-10 13:45 ` Markus Armbruster
2017-05-10 13:43 ` Markus Armbruster
2017-05-05 20:42 ` [Qemu-devel] [PATCH v2 0/3] string-input-visitor: Support enum/bool " no-reply
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=20170505205145.GO3482@thinpad.lan.raisama.net \
--to=ehabkost@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=mdroth@linux.vnet.ibm.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.