[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/11] curses: Fix compiler warnings (Mingw-w64 redef
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 11/11] curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT) |
Date: |
Wed, 4 Jan 2017 12:21:23 +0100 |
From: Stefan Weil <address@hidden>
For builds with Mingw-w64 as it is included in Cygwin, there are two
header files which define KEY_EVENT with different values.
This results in lots of compiler warnings like this one:
CC vl.o
In file included from /qemu/include/ui/console.h:340:0,
from /qemu/vl.c:76:
/usr/i686-w64-mingw32/sys-root/mingw/include/curses.h:1522:0: warning:
"KEY_EVENT" redefined
#define KEY_EVENT 0633 /* We were interrupted by an event */
In file included from /usr/share/mingw-w64/include/windows.h:74:0,
from /usr/share/mingw-w64/include/winsock2.h:23,
from /qemu/include/sysemu/os-win32.h:29,
from /qemu/include/qemu/osdep.h:100,
from /qemu/vl.c:24:
/usr/share/mingw-w64/include/wincon.h:101:0: note: this is the location of the
previous definition
#define KEY_EVENT 0x1
QEMU only uses the KEY_EVENT macro from wincon.h.
Therefore we can undefine the macro coming from curses.h.
The explicit include statement for curses.h in ui/curses.c is not needed
and was removed.
Those two modifications fix the redefinition warnings.
Signed-off-by: Stefan Weil <address@hidden>
Acked-by: Samuel Thibault <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
include/ui/console.h | 3 +++
ui/curses.c | 1 -
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 753ae93..7fb351f 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -334,7 +334,10 @@ static inline pixman_format_code_t
surface_format(DisplaySurface *s)
}
#ifdef CONFIG_CURSES
+/* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */
+#undef KEY_EVENT
#include <curses.h>
+#undef KEY_EVENT
typedef chtype console_ch_t;
extern chtype vga_to_curses[];
#else
diff --git a/ui/curses.c b/ui/curses.c
index 2e132a7..03cefdf 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -22,7 +22,6 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
-#include <curses.h>
#ifndef _WIN32
#include <sys/ioctl.h>
--
1.8.3.1
- [Qemu-devel] [PULL 01/11] ui/gtk: fix crash at startup when no console is available, (continued)
- [Qemu-devel] [PULL 01/11] ui/gtk: fix crash at startup when no console is available, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 04/11] console: add API to get underlying gui window ID, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 03/11] ps2: Fix lost scancodes by recent changes, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 07/11] egl-helpers: Change file licensing to LGPLv2, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 10/11] ui/vnc: Fix problem with sending too many bytes as server name, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 02/11] ui: use evdev keymap when running under wayland, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 08/11] gtk: avoid oob array access, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 06/11] sdl2: set window ID, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 05/11] console: move window ID code from baum to sdl, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 09/11] ui: drop unused MOUSE_EVENT_WHEEL{UP, DN} defines, Gerd Hoffmann, 2017/01/04
- [Qemu-devel] [PULL 11/11] curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT),
Gerd Hoffmann <=