[libvirt] [PATCH] build: fix build on mingw with netcf available

The autobuilder pointed out an odd failure on mingw: ../../src/interface/netcf_driver.c:644:5: error: unknown field 'close_used_without_including_unistd_h' specified in initializer cc1: warnings being treated as errors This is because the gnulib headers #define close in order to work around some odd mingw problems with close(), but it happens to also affect field members declared with a name of struct foo.close. As long as the same headers are included for the definition and use of the struct, the #define doesn't matter, but the netcf file hit an instance where things were in a different order. Fix this for all clients that use a struct member named 'close'. * src/driver.h: Include <unistd.h> before using 'close'. --- I don't have netcf for mingw locally, so I'd like a review before pushing this, since I couldn't confirm whether it fixed the broken build on the autobuilder. src/driver.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/driver.h b/src/driver.h index ec4abf3..24636a4 100644 --- a/src/driver.h +++ b/src/driver.h @@ -8,6 +8,7 @@ # include "config.h" +# include <unistd.h> # include <libxml/uri.h> # include "internal.h" -- 1.7.7.5

On Wed, Jan 11, 2012 at 07:09:37AM -0700, Eric Blake wrote:
The autobuilder pointed out an odd failure on mingw: ../../src/interface/netcf_driver.c:644:5: error: unknown field 'close_used_without_including_unistd_h' specified in initializer cc1: warnings being treated as errors
This is because the gnulib headers #define close in order to work around some odd mingw problems with close(), but it happens to also affect field members declared with a name of struct foo.close. As long as the same headers are included for the definition and use of the struct, the #define doesn't matter, but the netcf file hit an instance where things were in a different order. Fix this for all clients that use a struct member named 'close'.
* src/driver.h: Include <unistd.h> before using 'close'. ---
I don't have netcf for mingw locally, so I'd like a review before pushing this, since I couldn't confirm whether it fixed the broken build on the autobuilder.
src/driver.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/driver.h b/src/driver.h index ec4abf3..24636a4 100644 --- a/src/driver.h +++ b/src/driver.h @@ -8,6 +8,7 @@
# include "config.h"
+# include <unistd.h> # include <libxml/uri.h>
# include "internal.h"
ACK. I sent another patch to avoid triggering this bug too, which we probably still want to add. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 01/11/2012 07:16 AM, Daniel P. Berrange wrote:
On Wed, Jan 11, 2012 at 07:09:37AM -0700, Eric Blake wrote:
The autobuilder pointed out an odd failure on mingw: ../../src/interface/netcf_driver.c:644:5: error: unknown field 'close_used_without_including_unistd_h' specified in initializer cc1: warnings being treated as errors
This is because the gnulib headers #define close in order to work around some odd mingw problems with close(), but it happens to also affect field members declared with a name of struct foo.close. As long as the same headers are included for the definition and use of the struct, the #define doesn't matter, but the netcf file hit an instance where things were in a different order. Fix this for all clients that use a struct member named 'close'.
ACK.
Pushed.
I sent another patch to avoid triggering this bug too, which we probably still want to add.
Yes, yours also makes sense to push. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake