From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Empty struct in public headers Was: Re: [PATCH for Xen 4.5] xen/arm: Add support for GICv3 for domU Date: Tue, 18 Nov 2014 15:49:57 +0000 Message-ID: <546B6AA5.1050409@linaro.org> References: <1414695092-20761-1-git-send-email-julien.grall@linaro.org> <54535E240200007800043DAC@mail.emea.novell.com> <546B5F15.5060702@linaro.org> <21611.24907.144396.509457@mariner.uk.xensource.com> <546B650D.8040304@linaro.org> <21611.26449.963393.613516@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xql2X-0003mh-GI for xen-devel@lists.xenproject.org; Tue, 18 Nov 2014 15:50:01 +0000 Received: by mail-wi0-f172.google.com with SMTP id n3so2299968wiv.11 for ; Tue, 18 Nov 2014 07:49:59 -0800 (PST) In-Reply-To: <21611.26449.963393.613516@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: xen-devel@lists.xenproject.org, stefano.stabellini@citrix.com, ian.campbell@citrix.com, Jan Beulich , tim@xen.org List-Id: xen-devel@lists.xenproject.org (Rename the mail and strip the cc list) On 11/18/2014 03:35 PM, Ian Jackson wrote: > Julien Grall writes ("Re: [PATCH for Xen 4.5] xen/arm: Add support for GICv3 for domU"): >> On 11/18/2014 03:10 PM, Ian Jackson wrote: >>> Empty structs are a gcc extension (`(gcc-4.4) Empty Structures'). I >>> would be very surprised if clang didn't support them too. >> >> AFAIK, clang doesn't complain about empty structures. > > Right. > >>> AIUI our policy, gcc extensions are fine except in the Xen public >>> headers. >> >> We have at least 2 "empty" structure on the ARM public header. > > That ought to be fixed, in case anyone ever wants to build ARM guests > with Norcroft C or something. > > Does the size of these structs matter ? The 2 structures are arch_vcpu_info and arch_shared_info. They are used only at the end of the structure vcpu_info (resp. shared_info). So I guess we could fix it? >> Would something like below be better? >> >> struct >> { >> int dummy:1 >> }; > > I don't see why you wouldn't just do > struct blah { char dummy; }; > or even int dummy; It was to avoid using more bit than necessary. I will use your solution. Regards, -- Julien Grall