address #H4266 - build problem with clang Modules
Report states that using OSX Xcode IDE results in use of 'clang Modules', whatever those are, and role.c's 'filter' struct ends up conflicting with a function declared by <curses.h> (or possibly <ncurses.h> since one includes the other). src/role.c does not include <curses.h>, so this smacks of the problems caused by using precompiled headers on pre-OSX Mac. Instead of trying to import nethack into Xcode, I temporarily inserted '#include <curses.h>' at the end of unixconf.h. gcc did complain about 'filter' in role.c (but not in invent.c, despite -Wshadow), and then complained about termcap.c using TRUE when it wasn't defined (after in had been #undef'd, where there's a comment stating that it won't be used in the rest of that file), and also complained about static function winch() in wintty.c conflicting with external winch() in curses. This renames 'filter' and 'winch()' to things that won't conflict. Also, our winch() is a signal handler but had the wrong signature for one. And the troublesome use of TRUE was in code that was supposed to be dealing with int rather than boolean.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 termcap.c $NHDT-Date: 1447234979 2015/11/11 09:42:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.23 $ */
|
||||
/* NetHack 3.6 termcap.c $NHDT-Date: 1456907853 2016/03/02 08:37:33 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.24 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1246,6 +1246,7 @@ int color;
|
||||
xputs(hilites[color]);
|
||||
}
|
||||
|
||||
/* not to be confused with has_colors() in unixtty.c */
|
||||
int
|
||||
has_color(color)
|
||||
int color;
|
||||
@@ -1253,23 +1254,24 @@ int color;
|
||||
#ifdef X11_GRAPHICS
|
||||
/* XXX has_color() should be added to windowprocs */
|
||||
if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "X11"))
|
||||
return TRUE;
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef GEM_GRAPHICS
|
||||
/* XXX has_color() should be added to windowprocs */
|
||||
if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Gem"))
|
||||
return TRUE;
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef QT_GRAPHICS
|
||||
/* XXX has_color() should be added to windowprocs */
|
||||
if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Qt"))
|
||||
return TRUE;
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef AMII_GRAPHICS
|
||||
/* hilites[] not used */
|
||||
return iflags.use_color;
|
||||
#endif
|
||||
return iflags.use_color ? 1 : 0;
|
||||
#else
|
||||
return hilites[color] != (char *) 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* TEXTCOLOR */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 wintty.c $NHDT-Date: 1453514601 2016/01/23 02:03:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.124 $ */
|
||||
/* NetHack 3.6 wintty.c $NHDT-Date: 1456907854 2016/03/02 08:37:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.125 $ */
|
||||
/* Copyright (c) David Cohrs, 1991 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -31,8 +31,7 @@ extern void msmsg(const char *, ...);
|
||||
#include "wintty.h"
|
||||
|
||||
#ifdef CLIPPING /* might want SIGWINCH */
|
||||
#if defined(BSD) || defined(ULTRIX) || defined(AIX_31) \
|
||||
|| defined(_BULL_SOURCE)
|
||||
#if defined(BSD) || defined(ULTRIX) || defined(AIX_31) || defined(_BULL_SOURCE)
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#endif
|
||||
@@ -226,8 +225,21 @@ const char *mesg;
|
||||
}
|
||||
|
||||
#if defined(SIGWINCH) && defined(CLIPPING)
|
||||
STATIC_DCL void FDECL(winch_handler, (int));
|
||||
|
||||
/*
|
||||
* This really ought to just set a flag like the hangup handler does,
|
||||
* then check the flag at "safe" times, in case the signal arrives
|
||||
* while something fragile is executing. Better to have a brief period
|
||||
* where display updates don't fit the new size than for tty internals
|
||||
* to become corrupted.
|
||||
*
|
||||
* 'winch_seen' has been "notyet" for a long time....
|
||||
*/
|
||||
/*ARGUSED*/
|
||||
STATIC_OVL void
|
||||
winch()
|
||||
winch_handler(sig_unused) /* signal handler is called with at least 1 arg */
|
||||
int sig_unused UNUSED;
|
||||
{
|
||||
int oldLI = LI, oldCO = CO, i;
|
||||
register struct WinDesc *cw;
|
||||
@@ -345,7 +357,7 @@ char **argv UNUSED;
|
||||
ttyDisplay->lastwin = WIN_ERR;
|
||||
|
||||
#if defined(SIGWINCH) && defined(CLIPPING) && !defined(NO_SIGNAL)
|
||||
(void) signal(SIGWINCH, winch);
|
||||
(void) signal(SIGWINCH, (SIG_RET_TYPE) winch_handler);
|
||||
#endif
|
||||
|
||||
/* add one a space forward menu command alias */
|
||||
|
||||
Reference in New Issue
Block a user