[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH XEN v8 02/29] tools: Refactor /dev/xen/evtchn wrappers into libxenevtchn.



On Mon, 2016-01-25 at 14:49 +0000, Andrew Cooper wrote:
> On 25/01/16 14:47, Ian Campbell wrote:
> > On Mon, 2016-01-25 at 14:35 +0000, 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 <xentoollog.h>
> > > > */
> > > > ÂÂÂÂ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.
> > For some reason I thought the typedef's could be repeated so long as
> > they
> > were identical.
> > 
> > Seems at least Debian's gcc tolerates such things (which makes me
> > wonder
> > how many more instances of this might have snuck in, I guess folks like
> > Boris would have spotted them pretty quick).
> > 
> > > 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);
> > I'll do something like this for tools/libs/*/include.
> > 
> > FYI the underlying patches are all in since Friday.
> 
> How about doing the header strictness check on all headers at one?ÂÂIf
> repeating typedefs is a gccism, that should catch it.

AFAICT the issue here is that newer gcc tolerates duplicate typedefs under
many circumstances. Seems to take -pedantic-errors to make it not, and I
don't see another to enable the warning.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.