From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wnt2Y-0004Yu-7K for qemu-devel@nongnu.org; Fri, 23 May 2014 13:13:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wnt2S-0005K6-AT for qemu-devel@nongnu.org; Fri, 23 May 2014 13:13:53 -0400 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]:49043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wnt2S-0005Jy-3c for qemu-devel@nongnu.org; Fri, 23 May 2014 13:13:48 -0400 Received: by mail-ee0-f43.google.com with SMTP id d17so3847227eek.16 for ; Fri, 23 May 2014 10:13:47 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <537F81C6.7050408@redhat.com> Date: Fri, 23 May 2014 19:13:42 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1399650964-21067-1-git-send-email-peter.maydell@linaro.org> <537F2FCF.4060406@suse.de> <537F5C44.7060002@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 0/4] Allow QOM struct fields to be marked as private List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , Anthony Liguori , Patch Tracking Il 23/05/2014 18:21, Peter Maydell ha scritto: > On 23 May 2014 15:33, Paolo Bonzini wrote: >> Il 23/05/2014 13:50, Peter Maydell ha scritto: >>> On 23 May 2014 12:23, Andreas Färber 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