Re: [libvirt] [PATCH] always compile iptables.c

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

 



On Fri, Nov 07, 2008 at 02:49:43PM +0100, Jim Meyering wrote:
> This is slightly different from the previous version.
> The new part is the addition of the virRun stub to prevent
> a mingw link failure when building with shared libraries.
> Now, configured like this, it builds without error:
> 
> /usr/bin/mingw32-configure --without-sasl --without-avahi \
>   --without-polkit --without-python --without-xen --without-qemu \
>   --without-lxc --without-openvz --without-libvirtd \
>   --prefix=/tmp/libvirt-inst --enable-compile-warnings=maximum

OK, looks good to me, +1.

On an unrelated point, probably any usage of __MINGW32__ is suspect, eg:

>  #else /* __MINGW32__ */

Our MinGW cross-compiler defines the symbol 'WIN32', and so do all
compilers on Windows itself[1][2].

Therefore it's better to use #ifdef WIN32 ... #endif for any code that
is specific to the Win32 API.

The __MINGW32__ symbol has a place for code which is specific to the
MinGW version of GCC, eg. if it had a bug that we needed to work
around.

The attached patch appears to work with some light testing.

Rich.

[1] Even for 64-bit code.

[2] The exception is Cygwin, but you can argue that Cygwin is really a
Unix API.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 68 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Index: src/console.c
===================================================================
RCS file: /data/cvs/libvirt/src/console.c,v
retrieving revision 1.7
diff -u -r1.7 console.c
--- src/console.c	10 Apr 2008 16:53:29 -0000	1.7
+++ src/console.c	7 Nov 2008 14:06:57 -0000
@@ -22,7 +22,7 @@
 
 #include <config.h>
 
-#ifndef __MINGW32__
+#ifndef WIN32
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -197,4 +197,4 @@
     return ret;
 }
 
-#endif /* !__MINGW32__ */
+#endif /* !WIN32 */
Index: src/console.h
===================================================================
RCS file: /data/cvs/libvirt/src/console.h,v
retrieving revision 1.5
diff -u -r1.5 console.h
--- src/console.h	20 Aug 2008 20:48:35 -0000	1.5
+++ src/console.h	7 Nov 2008 14:06:57 -0000
@@ -23,10 +23,10 @@
 #ifndef __VIR_CONSOLE_H__
 #define __VIR_CONSOLE_H__
 
-#ifndef __MINGW32__
+#ifndef WIN32
 
 int vshRunConsole(const char *tty);
 
-#endif /* !__MINGW32__ */
+#endif /* !WIN32 */
 
 #endif /* __VIR_CONSOLE_H__ */
Index: src/storage_backend.c
===================================================================
RCS file: /data/cvs/libvirt/src/storage_backend.c,v
retrieving revision 1.26
diff -u -r1.26 storage_backend.c
--- src/storage_backend.c	4 Nov 2008 22:30:34 -0000	1.26
+++ src/storage_backend.c	7 Nov 2008 14:06:57 -0000
@@ -246,7 +246,7 @@
         return -2;
 
     if (S_ISREG(sb.st_mode)) {
-#ifndef __MINGW32__
+#ifndef WIN32
         vol->allocation = (unsigned long long)sb.st_blocks *
             (unsigned long long)sb.st_blksize;
 #else
@@ -421,7 +421,7 @@
 }
 
 
-#ifndef __MINGW32__
+#ifndef WIN32
 /*
  * Run an external program.
  *
Index: src/util.c
===================================================================
RCS file: /data/cvs/libvirt/src/util.c,v
retrieving revision 1.66
diff -u -r1.66 util.c
--- src/util.c	6 Nov 2008 16:36:07 -0000	1.66
+++ src/util.c	7 Nov 2008 14:06:58 -0000
@@ -116,7 +116,7 @@
 }
 
 
-#ifndef __MINGW32__
+#ifndef WIN32
 
 static int virSetCloseExec(int fd) {
     int flags;
@@ -577,7 +577,7 @@
     return ret;
 }
 
-#else /* __MINGW32__ */
+#else /* WIN32 */
 
 int
 virExec(virConnectPtr conn,
@@ -594,7 +594,7 @@
     return -1;
 }
 
-#endif /* __MINGW32__ */
+#endif /* WIN32 */
 
 /* Like gnulib's fread_file, but read no more than the specified maximum
    number of bytes.  If the length of the input is <= max_len, and
Index: src/virsh.c
===================================================================
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.170
diff -u -r1.170 virsh.c
--- src/virsh.c	13 Oct 2008 16:46:29 -0000	1.170
+++ src/virsh.c	7 Nov 2008 14:07:02 -0000
@@ -481,7 +481,7 @@
     {NULL, 0, 0, NULL}
 };
 
-#ifndef __MINGW32__
+#ifndef WIN32
 
 static int
 cmdConsole(vshControl *ctl, const vshCmd *cmd)
@@ -531,7 +531,7 @@
     return ret;
 }
 
-#else /* __MINGW32__ */
+#else /* WIN32 */
 
 static int
 cmdConsole(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
@@ -540,7 +540,7 @@
     return FALSE;
 }
 
-#endif /* __MINGW32__ */
+#endif /* WIN32 */
 
 /*
  * "list" command
--
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]