[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v9 26/27] qapi: Remove dead visitor code
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v9 26/27] qapi: Remove dead visitor code |
Date: |
Tue, 10 Nov 2015 23:13:13 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 11/05/2015 12:05 PM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> Commit cbc95538 removed unused start_handle() and end_handle(),
>> but forgot got remove their declarations.
>>
>> Commit 4e27e819 introduced optional visitor callbacks for all
>> sorts of int types, but except for type_uint64 and type_size,
>> none of them have ever been supplied (the generic implementation
>> based on using type_int then bounds-checking works just fine).
>> In the interest of simplicity, it's easier to make the visitor
>> callback interface not have to worry about the other sizes.
>>
>> Signed-off-by: Eric Blake <address@hidden>
>>
> | +
> | + /* Only required to visit uint64 differently than (*type_int)(). */
>
> If you don't supply it, what happens for uint64_t values that aren't
> representable as int64_t?
>
> | + void (*type_uint64)(Visitor *v, uint64_t *obj, const char *name,
> Answering my "what happens" question:
>
> * Input visitor
>
> If your type_int() accepts large positive input values and casts them
> to the corresponding large negative value, *obj = value will cast them
> right back, and the sloppiness cancels out.
>
> If it rejects them, they stay rejected.
>
> * Output visitor
>
> You'll output large positive values as the corresponding large
> negative value.
>
> I doubt not defining this makes much sense. Do we have such visitors?
Yes (qapi-dealloc-visitor.c gets away with it, but qmp-input-visitor.c,
qmp-output-visitor.c, string-input-visitor.c, and
string-output-visitor.c are all afflicted). But we shouldn't. For my
next spin of this patch, I'll first add another patch that guarantees
that all visitors have both signed and unsigned int handled correctly.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v9 08/27] qapi: Provide nicer array names in introspection, (continued)
- [Qemu-devel] [PATCH v9 08/27] qapi: Provide nicer array names in introspection, Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 01/27] qapi: Use generated TestStruct machinery in tests, Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 18/27] qapi: Factor out QAPISchemaObjectTypeMember.check_clash(), Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 20/27] qapi: Simplify QAPISchemaObjectTypeVariants.check(), Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 15/27] qapi: Simplify QAPISchemaObjectTypeMember.check(), Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 22/27] qapi: Remove outdated tests related to QMP/branch collisions, Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 26/27] qapi: Remove dead visitor code, Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 25/27] qapi: Add positive tests to qapi-schema-test, Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 12/27] qapi-types: Simplify gen_struct_field[s], Eric Blake, 2015/11/04
- [Qemu-devel] [PATCH v9 19/27] qapi: Check for qapi collisions of flat union branches, Eric Blake, 2015/11/04
[Qemu-devel] [PATCH v9 04/27] qapi: Simplify error testing in test-qmp-*, Eric Blake, 2015/11/04