From: "Jan Beulich" Subject: Re: [PATCH for Xen 4.5] xen/arm: Add support for GICv3 for domU Date: Tue, 18 Nov 2014 16:43:58 +0000 Message-ID: <546B855E0200007800048DB5@mail.emea.novell.com> References: <1414695092-20761-1-git-send-email-julien.grall@linaro.org> <54535E240200007800043DAC@mail.emea.novell.com> <546B5F15.5060702@linaro.org> <546B7EB60200007800048D20@mail.emea.novell.com> <546B71A5.2060104@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xqlsn-00070E-9E for xen-devel@lists.xenproject.org; Tue, 18 Nov 2014 16:44:01 +0000 In-Reply-To: <546B71A5.2060104@linaro.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: ian.campbell@citrix.com, tim@xen.org, Vijaya Kumar K , Ian Jackson , stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org, Daniel De Graaf List-Id: xen-devel@lists.xenproject.org >>> On 18.11.14 at 17:19, wrote: > On 11/18/2014 04:15 PM, Jan Beulich wrote: >>>>> On 18.11.14 at 16:00, wrote: >>> On 10/31/2014 09:02 AM, Jan Beulich wrote: >>>>>>> On 30.10.14 at 19:51, wrote: >>>> The naming suggests that the #if really should be around just the >>>> gic_version field (with a dummy field in the #else case to be C89 >>>> compatible, e.g. a zero width unnamed bitfield) and the >>>> corresponding #define-s above, ... >>> >>> Not really related to this patch... but the way to improve it (via >>> extending createdomain). >>> >>> I need to create an empty structure. Is the dummy field really needed? >>> If so, did you meant? >>> >>> struct >>> { >>> int :0; >>> } >> >> Yes. >> >>> The C spec declare this kind of structure as undefined. >> >> I can't find anything saying so. > > http://c0x.coding-guidelines.com/6.7.2.1.html > > "1401 If the struct-declaration-list contains no named members, the > behavior is undefined." Ah, indeed. I overlooked that clause in the standard, and all compilers I have at hand have no problem compiling such a struct. >>> Would an empty structure and used it be better? >> >> Empty structures (and unions) aren't valid in standard C afaics, up to >> and including C11. That was the whole point of suggesting the above >> alternative, with me (maybe wrongly) believing that this would be valid. > > Right, this is an extension of GCC. As neither of the 2 solutions are > valid, Ian Jackson was suggesting to use > > struct { > char dummy; > } > > Would it be ok for you? Sure - whatever is the smallest possible placeholder (unless, as seems to emerge from the other sub-thread, you need to go with #ifdef-s anyway). Jan