[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator |
Date: |
Tue, 16 Oct 2012 09:20:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 |
Il 15/10/2012 18:35, Michael Roth ha scritto:
>> - immutable/derived/broken/elsewhere (and the default, let's call it
>> serialized) are really five cases of the same QIDL property. Perhaps
>> this could be enforced in the extended syntax like this:
>>
>> #define q_immutable QIDL(serialize(immutable))
>> #define q_derived QIDL(serialize(derived))
>> #define q_broken QIDL(serialize(broken))
>> #define q_elsewhere QIDL(serialize(elsewhere))
>>
>> I would also make it possible to explicitly specify the fifth state, if
>> only for symmetry.
>
> Agreed, that's a more proper grouping. Though, for consistency with
> QIDL(property, ...), I would do QIDL(serialize, ...)
Sure.
>> - it would be _much_ better if you could automatically derive properties
>> information for embedded structs. For example, Notifiers and qemu_irqs
>> are always q_immutable. NotifierLists probably are always q_elsewhere,
>> because the owner of the notifiers should add themselves back.
>
> q_inherit maybe? Otherwise we're overriding "q_default" in subtle
> ways that may not always be desired.
I think the default should be "whatever makes more sense", which for
QIDL_DECLAREd types means making the member q_immutable if it makes
sense for the type.
It's too fragile to expect all subclasses to know whether their
superclass is immutable or has to be serialized, so q_inherit should be
the default. For atomic types, q_inherit is the same as q_serialized.
That said, an alternative is just to never declare the superclass
q_immutable. That would work as long as you do not restrict QIDL to
DeviceState subclasses---see attached patch.
>> In general, if struct X is QIDL_DECLAREd and only has q_immutable
>> fields, it can be taken as q_immutable. Hence for example the base
>> class should not need any decoration; ISADevice will be seen as
>> q_immutable, but PCIDevice will be seen as serialized. But even if a
>> struct is not QIDL_DECLAREd, it should be possible to apply a tag to a
>> typedef, and have it always applied to the members.
Hmm, this wasn't the best choice of words. What I actually meant was
"to apply a tag to a typedef, and have it always applied to members of
that type in other structs". Like
typedef struct Notifier Notifier q_immutable;
Note that Notifier will never have any serializable state, hence it will
not be QIDL_DECLAREd. It is just a proxy that specifies a function to call.
While in principle it is possible to change the function at run-time,
that's not the way that Notifiers are used. That can still be
documented using q_elsewhere, but I think that sane defaults other than
q_serialized are useful to avoid cluttering the declarations. However,
this is a very minor qualm.
Paolo
0001-qidl-allow-marking-Object-as-QIDL_DECLARE.patch
Description: Text Data
- [Qemu-devel] [PATCH v4 20/26] qdev: move Property-related declarations to qdev-properties.h, (continued)
- [Qemu-devel] [PATCH v4 20/26] qdev: move Property-related declarations to qdev-properties.h, Michael Roth, 2012/10/12
- [Qemu-devel] [PATCH v4 21/26] qidl: add documentation, Michael Roth, 2012/10/12
- [Qemu-devel] [PATCH v4 22/26] qidl: add lexer library (based on QC parser), Michael Roth, 2012/10/12
- [Qemu-devel] [PATCH v4 23/26] qidl: add C parser (based on QC parser), Michael Roth, 2012/10/12
- [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator, Michael Roth, 2012/10/12
- Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator, Paolo Bonzini, 2012/10/15
- Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator, Paolo Bonzini, 2012/10/15
- Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator, Michael Roth, 2012/10/15
- Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator, Michael Roth, 2012/10/15
- Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator, Michael Roth, 2012/10/18
- Re: [Qemu-devel] [PATCH v4 24/26] qidl: add QAPI-based code generator, Paolo Bonzini, 2012/10/19
[Qemu-devel] [PATCH v4 25/26] qidl: qidl.h, definitions for qidl annotations, Michael Roth, 2012/10/12
[Qemu-devel] [PATCH v4 26/26] qidl: unit tests and build infrastructure, Michael Roth, 2012/10/12
Re: [Qemu-devel] [PATCH v4 00/26] Add infrastructure for QIDL-based device serialization, Paolo Bonzini, 2012/10/15