From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH XEN v8 02/29] tools: Refactor /dev/xen/evtchn wrappers into libxenevtchn. Date: Mon, 25 Jan 2016 09:39:02 -0500 Message-ID: <56A63386.8040506@oracle.com> References: <1452864168.32341.97.camel@citrix.com> <1452864188-2417-1-git-send-email-ian.campbell@citrix.com> <1452864188-2417-3-git-send-email-ian.campbell@citrix.com> <56A262FF.8060806@oracle.com> <1453715326.4320.112.camel@citrix.com> <22182.12970.424449.937569@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <22182.12970.424449.937569@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 , Ian Campbell Cc: wei.liu2@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 01/25/2016 09:35 AM, Ian Jackson wrote: > Ian Campbell writes ("Re: [Xen-devel] [PATCH XEN v8 02/29] tools: Refactor /dev/xen/evtchn wrappers into libxenevtchn."): >> Various of the tools/libs/*/include/*.h have a >> >> /* Callers who don't care don't need to #include */ >> typedef struct xentoollog_logger xentoollog_logger; >> >> but since that typedef matches in all cases I think it is allowed to be >> repeated like this, isn't it? > No, I'm afraid not. It is permitted to repeatedly mention `struct > xentoollog_logger', but the typedef must only occur once in any > translation unit. > > If it is desirable to let callers avoid including xentoollog.h, then > all those headers need to say: > > struct xentoollog_logger; > int some_function(..., struct xentoollog_logger *lg, ...); > > So in your patches something like: > > struct xentoollog_logger; > > xenevtchn_handle *xenevtchn_open(struct xentoollog_logger *logger, > unsigned open_flags); > > The separate `struct xentoollog_logger;' is needed because otherwise > the `struct xentoollog_logger *logger' in the formal parameters of > xenevtchn_open is a declaration, rather than a reference to a > previously-declared thing, and if it is a declaration its scope is > only the contained function prototype, so other mentions of `struct > xentoollog_logger' are treated as references to a different type. > This is, of course, insane. > (I was just about to respond to IanC's earlier message) It builds on my desktop (gcc 4.9.2) but not on an older setup (4.4.7). BTW, I should have explicitly said so: I haven't bisected to this commit --- it just looked like this ould be the culprit. -boris