Re: [libvirt] mingw warnings

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

 



On Fri, Oct 24, 2008 at 07:50:13PM +0200, Jim Meyering wrote:
> I've been building with mingw to make sure that my gnulib-upgrade-and-extend
> patch doesn't break anything and found some compiler warnings.
> I fixed most of them, but this one is ugly:
> 
>   ../qemud/remote_protocol.c:317: warning: assignment from incompatible pointer type
>   ../qemud/remote_protocol.c:346: warning: assignment from incompatible pointer type
> 
> That's due to the fact that the mingw xdr.h header,
> /usr/i686-pc-mingw32/sys-root/mingw/include/rpc/xdr.h, defines this
> 
> #define	XDR_INLINE(xdrs, len)				\
> 	(*(xdrs)->x_ops->x_inline)(xdrs, len)
> 
> and has an x_inline member of type long*,
> 
> typedef struct {
> 	enum xdr_op	x_op;		/* operation; fast additional param */
> 	struct xdr_ops {
> 		bool_t	(*x_getlong)();	/* get a long from underlying stream */
> 		bool_t	(*x_putlong)();	/* put a long to " */
> 		bool_t	(*x_getbytes)();/* get some bytes from " */
> 		bool_t	(*x_putbytes)();/* put some bytes to " */
> 		u_int	(*x_getpostn)();/* returns bytes off from beginning */
> 		bool_t  (*x_setpostn)();/* lets you reposition the stream */
> 		long *	(*x_inline)();	/* buf quick ptr to buffered data */
> 
> while we're used to one with type matching buf: int32_t*:
> 
> If you're serious about getting rid of warnings even on mingw,
> here's one approach:

I guess I'd agree with Dan that the best place to fix this is in
PortableXDR itself.

Converting that 'long *' -> 'int32_t *' should be OK I think?  Unless
that x_inline member is used for other XDR types.

Rich.

PS. Windows is a strange platform in that when they moved to 64 bits,
they didn't go with LP64, but with LLP64.  So 'long' on Windows is
always 32 bits, even on Win64.  This is only a theoretical concern for
MinGW at the moment, but understanding it may help portability issues
in future.  In particular, all the places which use 'long' in the
libvirt public API are to be considered suspect.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]