From: Ian Campbell <Ian.Campbell@citrix.com>
To: Julien Grall <julien.grall@linaro.org>
Cc: stefano.stabellini@citrix.com, tim@xen.org,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Jan Beulich <JBeulich@suse.com>,
xen-devel@lists.xenproject.org
Subject: Re: 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 16:21:02 +0000 [thread overview]
Message-ID: <1416327662.17982.24.camel@citrix.com> (raw)
In-Reply-To: <546B6AA5.1050409@linaro.org>
On Tue, 2014-11-18 at 15:49 +0000, Julien Grall wrote:
> (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?
arch_vcpu_info isn't at the end of vcpu_info (vcpu_time_info follows it)
and also vcpu_info is part of an array at the start of shared_info (an
array of 1 on ARM, but things still follow it). I'm also not sure of the
impact on the vcpu placement hypercall or the uses of it.
So it looks like changing vcpu_info at least will be hard/impossible. If
we want rid of these empty structs then I think an ifdef at the point of
use is the only option :-(
> >> 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,
>
next prev parent reply other threads:[~2014-11-18 16:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 18:51 [PATCH for Xen 4.5] xen/arm: Add support for GICv3 for domU Julien Grall
2014-10-31 9:02 ` Jan Beulich
2014-10-31 11:23 ` Julien Grall
2014-10-31 13:37 ` Jan Beulich
2014-10-31 13:53 ` Julien Grall
2014-10-31 15:12 ` Jan Beulich
2014-11-01 18:56 ` Julien Grall
2014-11-18 15:00 ` Julien Grall
2014-11-18 15:10 ` Ian Jackson
2014-11-18 15:26 ` Julien Grall
2014-11-18 15:35 ` Ian Jackson
2014-11-18 15:49 ` Empty struct in public headers Was: " Julien Grall
2014-11-18 16:21 ` Ian Campbell [this message]
2014-11-18 16:29 ` Julien Grall
2014-11-18 16:31 ` Ian Campbell
2014-11-18 16:15 ` Jan Beulich
2014-11-18 16:19 ` Julien Grall
2014-11-18 16:43 ` Jan Beulich
2014-10-31 17:45 ` Stefano Stabellini
2014-10-31 18:15 ` Julien Grall
2014-10-31 18:24 ` Stefano Stabellini
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=1416327662.17982.24.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=julien.grall@linaro.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.