]> git.proxmox.com Git - mirror_qemu.git/commit - tests/test-qmp-input-visitor.c
qapi: Fix alternates that accept 'number' but not 'int'
authorEric Blake <eblake@redhat.com>
Wed, 2 Dec 2015 05:20:51 +0000 (22:20 -0700)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 17 Dec 2015 07:21:28 +0000 (08:21 +0100)
commitd00341af384665d259af475b14c96bb8414df415
treeb8b9f5d8f4804d7174fc75538cddc1a935f79260
parent9d3f3494c5b941774e2c3e7639332d53bbe6f8be
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>
include/qapi/visitor-impl.h
include/qapi/visitor.h
qapi/qapi-visit-core.c
qapi/qmp-input-visitor.c
scripts/qapi-visit.py
tests/test-qmp-input-visitor.c