[libvirt] [PATCH libvirt 2/6] include winsock2.h before windows.h

Marc-André Lureau mlureau at redhat.com
Wed Jan 25 22:16:43 UTC 2012



----- Mensaje original -----
> On 01/25/2012 01:13 PM, Marc-André Lureau wrote:
> > windows.h is included by threads.h.
> > winsock2.h should be included before.
> > 
> > Avoid the following warning:
> > 
> > In file included from ../gnulib/lib/unistd.h:51:0,
> >                  from ../src/util/util.h:30,
> >                  from rpc/virkeepalive.c:29:
> > /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2:
> > warning: #warning Please include winsock2.h before windows.h
> > [-Wcpp]
> > ---
> >  src/rpc/virkeepalive.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> NACK.  I agree that things should be fixed, but the fix should live
> in
> the problematic "threads.h" inclusion pattern, not in the downstream
> virkeepalive.c.

I agree, but ff we follow that reasoning, windows.h should include winsock2.h, shouldn't it?

> Does this alternate patch work for you?  (One of these days, I need
> to
> install the mingw64 cross-compiler, so I can test it myself.)

Yes, that works too.

Btw, I don't mind testing patches, but using mingw64 is almost a 'yum install' away :) And you could help to fix the few remaining issues. The most worrying being the gnulib "stat" module, the rest should be in control.

> 
> diff --git i/src/util/threads-win32.h w/src/util/threads-win32.h
> index 8109afd..1b23402 100644
> --- i/src/util/threads-win32.h
> +++ w/src/util/threads-win32.h
> @@ -1,7 +1,7 @@
>  /*
>   * threads-win32.h basic thread synchronization primitives
>   *
> - * Copyright (C) 2009, 2011 Red Hat, Inc.
> + * Copyright (C) 2009, 2011-2012 Red Hat, Inc.
>   *
>   * This library is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU Lesser General Public
> @@ -21,6 +21,9 @@
> 
>  #include "internal.h"
> 
> +#ifdef HAVE_WINSOCK2_H
> +# include <winsock2.h>
> +#endif
>  #include <windows.h>
> 
>  struct virMutex {
> 
> --
> Eric Blake   eblake at redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 
> 




More information about the libvir-list mailing list