[libvirt] mingw warnings
Jim Meyering
jim at meyering.net
Mon Oct 27 10:09:46 UTC 2008
"Richard W.M. Jones" <rjones at redhat.com> wrote:
> 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.
For libvirt it's certainly ok, since the includer can ensure
that int32_t is always defined via gnulib's <stdint.h>.
More information about the libvir-list
mailing list