]> xenbits.xensource.com Git - libvirt.git/commitdiff
domsuspend: Fix warning on mingw build
authorAndrea Bolognani <abologna@redhat.com>
Wed, 10 Feb 2016 18:44:01 +0000 (19:44 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 12 Feb 2016 15:36:34 +0000 (16:36 +0100)
Commit d82170d introduced a workaround for domtop: in that example
program, we define a symbol called ERROR for our own use, but since
a symbol with the same name is already defined in one of mingw's
header files, we get a warning when using that compiler.

domsuspend defines the same problematic symbol, so the workaround
has been copied over.

examples/domsuspend/suspend.c

index 11f7302a4a29b83a5d685c41b635d91e6db88ff5..3e3f70e235780b0aba9c9b3b6b93179b94acb5f3 100644 (file)
 
 static int debug;
 
+/* On mingw, there's a header file that poisons the well:
+ *
+ *
+ *  CC       domtop.o
+ *domtop.c:40:0: warning: "ERROR" redefined [enabled by default]
+ * #define ERROR(...)                                              \
+ * ^
+ *In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:71:0,
+ *                 from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
+ *                 from ../../gnulib/lib/unistd.h:48,
+ *                 from domtop.c:35:
+ * /usr/i686-w64-mingw32/sys-root/mingw/include/wingdi.h:75:0: note: this is the location of the previous definition
+ * #define ERROR 0
+ */
+#undef ERROR
 #define ERROR(...)                                              \
 do {                                                            \
     fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__);  \