From: Samuel Thibault <samuel.thibault@gnu.org>
To: Stefan Weil <sw@weilnetz.de>
Cc: QEMU Developer <qemu-devel@nongnu.org>,
QEMU Trivial <qemu-trivial@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH for-2.8] curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT)
Date: Sat, 19 Nov 2016 21:04:09 +0100 [thread overview]
Message-ID: <20161119200409.GF3422@var.home> (raw)
In-Reply-To: <20161119185318.10564-1-sw@weilnetz.de>
Stefan Weil, on Sat 19 Nov 2016 19:53:18 +0100, wrote:
> 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 <sw@weilnetz.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> 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 e2589e2..e5ae506 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -337,7 +337,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>
> --
> 2.10.2
>
>
--
Samuel
Now I know someone out there is going to claim, "Well then, UNIX is intuitive,
because you only need to learn 5000 commands, and then everything else follows
from that! Har har har!"
(Andy Bates in comp.os.linux.misc, on "intuitive interfaces", slightly
defending Macs.)
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Stefan Weil <sw@weilnetz.de>
Cc: QEMU Developer <qemu-devel@nongnu.org>,
QEMU Trivial <qemu-trivial@nongnu.org>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.8] curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT)
Date: Sat, 19 Nov 2016 21:04:09 +0100 [thread overview]
Message-ID: <20161119200409.GF3422@var.home> (raw)
In-Reply-To: <20161119185318.10564-1-sw@weilnetz.de>
Stefan Weil, on Sat 19 Nov 2016 19:53:18 +0100, wrote:
> 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 <sw@weilnetz.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> 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 e2589e2..e5ae506 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -337,7 +337,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>
> --
> 2.10.2
>
>
--
Samuel
Now I know someone out there is going to claim, "Well then, UNIX is intuitive,
because you only need to learn 5000 commands, and then everything else follows
from that! Har har har!"
(Andy Bates in comp.os.linux.misc, on "intuitive interfaces", slightly
defending Macs.)
next prev parent reply other threads:[~2016-11-19 20:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-19 18:53 [Qemu-trivial] [PATCH for-2.8] curses: Fix compiler warnings (Mingw-w64 redefinition of macro KEY_EVENT) Stefan Weil
2016-11-19 18:53 ` [Qemu-devel] " Stefan Weil
2016-11-19 20:04 ` Samuel Thibault [this message]
2016-11-19 20:04 ` Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161119200409.GF3422@var.home \
--to=samuel.thibault@gnu.org \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.