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

Eric Blake eblake at redhat.com
Wed Jan 25 22:00:28 UTC 2012


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.

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.)

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120125/1b0bbff8/attachment-0001.sig>


More information about the libvir-list mailing list