This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Clash between ncurses.h and Windows headers
- From: Doug Evans <dje at google dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 29 Apr 2012 11:03:29 -0700
- Subject: Re: Clash between ncurses.h and Windows headers
- References: <83fwbn7vq0.fsf@gnu.org>
On Sat, Apr 28, 2012 at 7:54 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> Like the problem with PDCurses reported here:
>
> ? http://sourceware.org/ml/gdb-patches/2012-01/msg00298.html
>
> I bumped into a similar problem with ncurses on MS-Windows: both the
> Windows API headers and ncurses.h define KEY_EVENT. ?Can we solve this
> in the same way we solved the previous one? ?Here's a patch I propose:
>
> 2012-04-28 ?Eli Zaretskii ?<eliz@gnu.org>
>
> ? ? ? ?* gdb_curses.h: Undefine KEY_EVENT before including curses
> ? ? ? ?headers. ?Move "#undef MOUSE_MOVED" before any curses header
> ? ? ? ?inclusion.
>
>
> --- gdb/gdb_curses.h~0 ?2012-01-13 13:17:56.000000000 +0200
> +++ gdb/gdb_curses.h ? ?2012-04-28 17:05:32.126750000 +0300
> @@ -20,13 +20,6 @@
> ?#ifndef GDB_CURSES_H
> ?#define GDB_CURSES_H 1
>
> -#if defined (HAVE_NCURSES_NCURSES_H)
> -#include <ncurses/ncurses.h>
> -#elif defined (HAVE_NCURSES_H)
> -#include <ncurses.h>
> -#elif defined (HAVE_CURSESX_H)
> -#include <cursesX.h>
> -#elif defined (HAVE_CURSES_H)
> ?#ifdef __MINGW32__
> ?/* Windows API headers, included e.g. by serial.h, define MOUSE_MOVED,
> ? ?and so does PDCurses's curses.h, but for an entirely different
> @@ -34,7 +27,18 @@
> ? ?anywhere, avoid compiler warnings by undefining MOUSE_MOVED before
> ? ?including curses.h. ?*/
> ?#undef MOUSE_MOVED
> +/* Likewise, KEY_EVENT is defined by ncurses.h, but also by Windows
> + ? API headers. ?*/
> +#undef KEY_EVENT
> ?#endif
> +
> +#if defined (HAVE_NCURSES_NCURSES_H)
> +#include <ncurses/ncurses.h>
> +#elif defined (HAVE_NCURSES_H)
> +#include <ncurses.h>
> +#elif defined (HAVE_CURSESX_H)
> +#include <cursesX.h>
> +#elif defined (HAVE_CURSES_H)
> ?#include <curses.h>
> ?#endif
>
Ok by me.