On Wed, 2016-02-03 at 17:18 +0000, Andrew Cooper wrote:
> On 03/02/16 17:12, Olaf Hering wrote:
> > On Mon, Feb 01, Andrew Cooper wrote:
> > 
> > > c/s 2d2f789 "tools: rename libxc's evtchn_port_or_error_t with an xc_
> > > prefix" doesn't cater for older applications which have requested
> > > XC_WANT_COMPAT_EVTCHN_API
> > Not sure, but I think this breaks staging at last in SLES11:
> > 
> > [   93s] gcc  -DPIC -O1 -fno-omit-frame-pointer -m64 -fno-strict-
> > aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-
> > statement   -O0 -g3 -D__XEN_TOOLS__ -MMD -MF .xc_evtchn_compat.opic.d
> > -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls
> > -D_GNU_SOURCE -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-
> > protector -funwind-tables -fasynchronous-unwind-tables
> > -I../../xen/common/libelf -Werror -Wmissing-prototypes -I. -I./include
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/include -pthread
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/libs/toollog/include
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-
> > 4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/libs/evtchn/include
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/include -include
> > /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/config.h -I/usr/src/packages/BUILD/xen-
> > 4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/libs/call/include
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-
> > 4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/libs/foreignmemory/include
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-
> > 4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/libs/gnttab/include
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/include -I/usr/src/packages/BUILD/xen-
> > 4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/libs/gnttab/include
> > -I/usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/include  -fPIC -c -o xc_evtchn_compat.opic
> > xc_evtchn_compat.c
> > [   93s] In file included from ./include/xenctrl.h:2577,
> > [   93s]                  from xc_evtchn_compat.c:9:
> > [   93s] ./include/xenctrl_compat.h:54: error: redefinition of typedef
> > 'evtchn_port_or_error_t'
> > [   93s] /usr/src/packages/BUILD/xen-4.7.20160203T131200.be05b53/non-
> > dbg/tools/libxc/../../tools/libs/evtchn/include/xenevtchn.h:31: error:
> > previous declaration of 'evtchn_port_or_error_t' was here
> > [   93s] make[4]: *** [xc_evtchn_compat.opic] Error 1
> > 
> > Olaf
> 
> Urgh.  This is getting even more complicated.
> 
> This patch is needed to avoid breaking the build for older programs
> using just
> 
> #define XC_WANT_COMPAT_EVTCHN_API
> #include <xenctrl.h>
> 
> so simply reverting it isn't a viable option either.
> 
> Is there any way in C to determine whether a typedef already exists?

Not AFAIK.

A common trick is
#ifndef type_t
#define type_t type_t
typedef int type_t;
#endif

But I think what I'll do instead is have xc_evtchn_compat.c
#define XC_BUILDING_COMPAT_EVTCHN_API and have xc_compat_evtchn.h DTRT
based on that. There's a similar construct
in XC_BUILDING_COMPAT_MAP_FOREIGN_API (although for different reasons).

Patch forthcoming.

Ian.

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

Reply via email to