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 */
|
||||
|
||||
Reference in New Issue
Block a user