[Top][All Lists]
[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: |
Anthony Liguori |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties |
Date: |
Fri, 17 Jul 2009 15:05:21 -0500 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
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.
typedef struct MyDeviceStruct
{
SysBusDevice parent;
/* public */
QDEV_PROP(uint32_t, queue_depth);
QDEV_PROP(uint32_t, tx_mitigation_delay);
QDEV_PROP(CharDriverState *, chr);
} MyDeviceStruct;
Normally, we:
#define QDEV_PROP(a, b) a b
But then we could also do something like:
#define QDEV_PROP(a, b) QPROP_CANARY stringify(a) stringify(b)
Then run through CPP and grep 'CANARY | typedef struct' and then parse
the output to build the table at build time.
Of course, we could just do QDEV_PROP like I originally proposed and
then if we ever support something other than GCC, we can introduce a CPP
post-processor to build the tables at compile time.
This is the approach we're taking for constructors after all.
--
Regards,
Anthony Liguori
- [Qemu-devel] Re: [PATCH 1/2] Introduce CharDriverState qdev property type, (continued)
[Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Anthony Liguori, 2009/07/17
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Blue Swirl, 2009/07/17
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Anthony Liguori, 2009/07/17
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Paul Brook, 2009/07/17
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Anthony Liguori, 2009/07/17
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Blue Swirl, 2009/07/17
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties,
Anthony Liguori <=
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Paul Brook, 2009/07/17
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Jamie Lokier, 2009/07/18
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Anthony Liguori, 2009/07/18
- Re: [Qemu-devel] [PATCH 2/2] Introduce macro for defining qdev properties, Jamie Lokier, 2009/07/19
[Qemu-devel] Re: [PATCH 2/2] Introduce macro for defining qdev properties, Gerd Hoffmann, 2009/07/21