qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
	"Andreas Färber" <afaerber@suse.de>,
	"Anthony Liguori" <aliguori@amazon.com>,
	"Patch Tracking" <patches@linaro.org>
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	[thread overview]
Message-ID: <537F81C6.7050408@redhat.com> (raw)
In-Reply-To: <CAFEAcA-h74b025XoLSoQV4yfp6Xdi9B5tbaRixHAwM+jN0uAAw@mail.gmail.com>

Il 23/05/2014 18:21, Peter Maydell ha scritto:
> On 23 May 2014 15:33, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> Il 23/05/2014 13:50, Peter Maydell ha scritto:
>>> On 23 May 2014 12:23, Andreas Färber <afaerber@suse.de> 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	other threads:[~2014-05-23 17:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 15:56 [Qemu-devel] [PATCH v2 0/4] Allow QOM struct fields to be marked as private Peter Maydell
2014-05-09 15:56 ` [Qemu-devel] [PATCH v2 1/4] Provide infrastructure for marking private QOM struct fields Peter Maydell
2014-05-09 15:56 ` [Qemu-devel] [PATCH v2 2/4] arm_gic: Use new qom_private macro to mark private fields Peter Maydell
2014-05-09 15:56 ` [Qemu-devel] [PATCH v2 3/4] a9scu: Use qom_private " Peter Maydell
2014-05-09 15:56 ` [Qemu-devel] [PATCH v2 4/4] arm11scu: " Peter Maydell
2014-05-23 11:13 ` [Qemu-devel] [PATCH v2 0/4] Allow QOM struct fields to be marked as private Peter Maydell
2014-05-23 11:23   ` Andreas Färber
2014-05-23 11:50     ` Peter Maydell
2014-05-23 14:33       ` Paolo Bonzini
2014-05-23 16:21         ` Peter Maydell
2014-05-23 17:13           ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=537F81C6.7050408@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).