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:
10
src/invent.c
10
src/invent.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 invent.c $NHDT-Date: 1456354616 2016/02/24 22:56:56 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.195 $ */
|
||||
/* NetHack 3.6 invent.c $NHDT-Date: 1456907837 2016/03/02 08:37:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.196 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1437,7 +1437,7 @@ boolean combo; /* combination menu flag */
|
||||
unsigned *resultflags;
|
||||
{
|
||||
int FDECL((*ckfn), (OBJ_P)) = (int FDECL((*), (OBJ_P))) 0;
|
||||
boolean FDECL((*filter), (OBJ_P)) = (boolean FDECL((*), (OBJ_P))) 0;
|
||||
boolean FDECL((*ofilter), (OBJ_P)) = (boolean FDECL((*), (OBJ_P))) 0;
|
||||
boolean takeoff, ident, allflag, m_seen;
|
||||
int itemcount;
|
||||
int oletct, iletct, unpaid, oc_of_sym;
|
||||
@@ -1455,13 +1455,13 @@ unsigned *resultflags;
|
||||
add_valid_menu_class(0); /* reset */
|
||||
if (taking_off(word)) {
|
||||
takeoff = TRUE;
|
||||
filter = is_worn;
|
||||
ofilter = is_worn;
|
||||
} else if (!strcmp(word, "identify")) {
|
||||
ident = TRUE;
|
||||
filter = not_fully_identified;
|
||||
ofilter = not_fully_identified;
|
||||
}
|
||||
|
||||
iletct = collect_obj_classes(ilets, invent, FALSE, filter, &itemcount);
|
||||
iletct = collect_obj_classes(ilets, invent, FALSE, ofilter, &itemcount);
|
||||
unpaid = count_unpaid(invent);
|
||||
|
||||
if (ident && !iletct) {
|
||||
|
||||
Reference in New Issue
Block a user