aboutsummaryrefslogtreecommitdiff
path: root/qapi/opts-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-03 13:32:45 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-05 09:14:20 +0100
commita4a1c70dc759e5b81627e96564f344ab43ea86eb (patch)
tree56d44358c6e76c57a01aed7ee789b68965dcc2ff /qapi/opts-visitor.c
parent86ca0dbe04d8eeebf460b56111c9af125e14528f (diff)
qapi: Make input visitors detect unvisited list tails
Fix the design flaw demonstrated in the previous commit: new method check_list() lets input visitors report that unvisited input remains for a list, exactly like check_struct() lets them report that unvisited input remains for a struct or union. Implement the method for the qobject input visitor (straightforward), and the string input visitor (less so, due to the magic list syntax there). The opts visitor's list magic is even more impenetrable, and all I can do there today is a stub with a FIXME comment. No worse than before. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1488544368-30622-26-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qapi/opts-visitor.c')
-rw-r--r--qapi/opts-visitor.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
index c50dc4bbbf..026d25b767 100644
--- a/qapi/opts-visitor.c
+++ b/qapi/opts-visitor.c
@@ -273,6 +273,16 @@ opts_next_list(Visitor *v, GenericList *tail, size_t size)
static void
+opts_check_list(Visitor *v, Error **errp)
+{
+ /*
+ * FIXME should set error when unvisited elements remain. Mostly
+ * harmless, as the generated visits always visit all elements.
+ */
+}
+
+
+static void
opts_end_list(Visitor *v, void **obj)
{
OptsVisitor *ov = to_ov(v);
@@ -539,6 +549,7 @@ opts_visitor_new(const QemuOpts *opts)
ov->visitor.start_list = &opts_start_list;
ov->visitor.next_list = &opts_next_list;
+ ov->visitor.check_list = &opts_check_list;
ov->visitor.end_list = &opts_end_list;
ov->visitor.type_int64 = &opts_type_int64;