qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 0/4] Allow QOM struct fields to be marked as


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 0/4] Allow QOM struct fields to be marked as private
Date: Fri, 23 May 2014 19:13:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Il 23/05/2014 18:21, Peter Maydell ha scritto:
On 23 May 2014 15:33, Paolo Bonzini <address@hidden> wrote:
Il 23/05/2014 13:50, Peter Maydell ha scritto:
On 23 May 2014 12:23, Andreas Färber <address@hidden> wrote:
Am 23.05.2014 13:13, schrieb Peter Maydell:
Ping?

I believe I remarked that in the example
typedef struct Foo {
would be more in line with our Coding Style and majority of users.

Other than that, I have no objections and assumed you'll take it through
your arm queue.

Oops, yes, I'd forgotten that conversation. I'll remove
the newline preceding the '{' and am happy to put this
through the target-arm queue.

Semi-serious proposal:

    #define comma_if_empty_ ,
    #define CPP_IFEMPTY(macro, t, f)      CPP_IFEMPTY1(macro, t, f)
    #define CPP_IFEMPTY1(value, t, f)     CPP_IF2(comma_if_empty_##value, t, f)
    #define CPP_IF2(comma_if_true, t, f)  CPP_IF3(comma_if_true t, f)
    #define CPP_IF3(_, v, ...) v

    #define qom_private(macro) CPP_IFEMPTY(IMPLEMENTING_##macro,, 
QEMU_PRIVATE_ATTR)

To be used as:

    qom_private(A9_SCU) MemoryRegion iomem;

Interesting. That means we can avoid the irritating
boilerplate in each include file to define and undefine
qom_private, at the cost of the tag on each field in the
struct being a bit longer. I'm not entirely sure which
I prefer...

You could also

#define a9_scu_private qom_private(A9_SCU)

   a9_scu_private MemoryRegion iommu;

where the difference becomes a wash.

Paolo




reply via email to

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