From: Markus Armbruster <armbru@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/3] string-input-visitor: Support alternate types
Date: Wed, 10 May 2017 15:43:16 +0200 [thread overview]
Message-ID: <8760h825fv.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20170505201128.12099-4-ehabkost@redhat.com> (Eduardo Habkost's message of "Fri, 5 May 2017 17:11:28 -0300")
In addition to Eric's remarks:
Eduardo Habkost <ehabkost@redhat.com> writes:
> When parsing alternates from a string, there are some limitations in
> what we can do, but it is a valid use case in some situations. We can
> support booleans, integer types, and enums.
>
> This will be used to support 'feature=force' in -cpu options, while
> keeping 'feature=on|off|true|false' represented as boolean values.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
> * Updated string_input_visitor_new() documentation
> to mention alternate support (Markus Armbruster)
> * Detect ambiguous alternates at runtime. Test case included.
> * Removed support for integers. We don't need it yet, and
> it would require sorting out the parse_str() mess.
> * Change supported_qtypes to uint32_t (Eric Blake)
> * Update tests/qapi-schema/qapi-schema-test.out to match
> qapi-schema-test.json updates
> (Eric Blake)
> * Code indentation fix (Markus Armbruster)
> * Use &error_abort on test cases instead of g_assert(!err)
> (Markus Armbruster)
> ---
> include/qapi/string-input-visitor.h | 6 +-
> qapi/string-input-visitor.c | 99 +++++++++++++++++++++++++++++----
> tests/test-string-input-visitor.c | 76 +++++++++++++++++++++++++
> tests/qapi-schema/qapi-schema-test.json | 8 +++
> tests/qapi-schema/qapi-schema-test.out | 9 +++
> 5 files changed, 187 insertions(+), 11 deletions(-)
>
> diff --git a/include/qapi/string-input-visitor.h b/include/qapi/string-input-visitor.h
> index 33551340e3..e7f359f225 100644
> --- a/include/qapi/string-input-visitor.h
> +++ b/include/qapi/string-input-visitor.h
> @@ -19,8 +19,12 @@ typedef struct StringInputVisitor StringInputVisitor;
>
> /*
> * The string input visitor does not implement support for visiting
> - * QAPI structs, alternates, null, or arbitrary QTypes. It also
> + * QAPI structs, null, or arbitrary QTypes. It also
> * requires a non-null list argument to visit_start_list().
I'd prefer to have this paragraph refilled.
> + *
> + * Support for alternates is very limited: only bool and enum
> + * members are supported, and only when the enum members'
> + * representations can't be confused with a bool value.
> */
> Visitor *string_input_visitor_new(const char *str);
>
> diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
> index c089491c24..e339b88192 100644
> --- a/qapi/string-input-visitor.c
> +++ b/qapi/string-input-visitor.c
> @@ -19,6 +19,7 @@
> #include "qemu/option.h"
> #include "qemu/queue.h"
> #include "qemu/range.h"
> +#include "qemu/host-utils.h"
Still needed?
>
>
> struct StringInputVisitor
[...]
Skipping the rest for now. I'd like to explore restricting alternates
at compile-time. If that turns out well, we can drop most of this
patch.
next prev parent reply other threads:[~2017-05-10 13:43 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
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 [this message]
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=8760h825fv.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=ehabkost@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.