qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev propertie


From: Paul Brook
Subject: Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties
Date: Fri, 17 Jul 2009 23:58:41 +0100
User-agent: KMail/1.11.4 (Linux/2.6.29-2-amd64; KDE/4.2.4; x86_64; ; )

On Friday 17 July 2009, Anthony Liguori wrote:
> Blue Swirl wrote:
> >> I'm not sure how to do this without GCC extensions.  We could
> >> potentially add macro decorators and use a sparse-like tool to extract
> >> property lists automatically from device state.
> >
> > Then there is the template way:
>
> Yes, I also considered that.
>
> Another option would be comment decorators along with a post-processor.

QDEV_PROP(uint32, field) and QDEV_PROP_UINT32(field) are pretty much 
isomorphic. Both cases it can be implemented with standard C preprocessor 
functionality, and maybe GCC extensions for compile time checking. I don't 
mind requiring gcc for debug builds and consistency checking.

There is some duplication, with the type specified in both the property macro 
and the structure member definition. As long as we have compile time checking 
I'm willing to accept that.


However I don't think it is possible to implement QDEV_PROP(field) without 
fancy GCC extensions or fairly invasive preprocessing. It feels a little too 
clever for comfort, verging on a custom device description langage.

Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]