summaryrefslogtreecommitdiffstats
path: root/include/qapi/visitor-impl.h
diff options
context:
space:
mode:
authorEric Blake2015-12-02 06:20:51 +0100
committerMarkus Armbruster2015-12-17 08:21:28 +0100
commitd00341af384665d259af475b14c96bb8414df415 (patch)
treeb8b9f5d8f4804d7174fc75538cddc1a935f79260 /include/qapi/visitor-impl.h
parentqapi: Inline _make_implicit_tag() (diff)
downloadqemu-d00341af384665d259af475b14c96bb8414df415.tar.gz
qemu-d00341af384665d259af475b14c96bb8414df415.tar.xz
qemu-d00341af384665d259af475b14c96bb8414df415.zip
qapi: Fix alternates that accept 'number' but not 'int'
The QMP input visitor allows integral values to be assigned by promotion to a QTYPE_QFLOAT. However, when parsing an alternate, we did not take this into account, such that an alternate that accepts 'number' and some other type, but not 'int', would reject integral values. With this patch, we now have the following desirable table: alternate has case selected for 'int' 'number' QTYPE_QINT QTYPE_QFLOAT no no error error no yes 'number' 'number' yes no 'int' error yes yes 'int' 'number' While it is unlikely that we will ever use 'number' in an alternate other than in the testsuite, it never hurts to be more precise in what we allow. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1449033659-25497-8-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'include/qapi/visitor-impl.h')
-rw-r--r--include/qapi/visitor-impl.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 7cd1313129..74196847fa 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -33,7 +33,7 @@ struct Visitor
void (*type_enum)(Visitor *v, int *obj, const char * const strings[],
const char *kind, const char *name, Error **errp);
/* May be NULL; only needed for input visitors. */
- void (*get_next_type)(Visitor *v, QType *type,
+ void (*get_next_type)(Visitor *v, QType *type, bool promote_int,
const char *name, Error **errp);
void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error **errp);