From 9db124f650762cb3793b62352444b60f52b053a1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 23 Nov 2018 22:16:49 -0500 Subject: [PATCH] Revert "Fix compiler warnings in macos build." This reverts commit 0d59f1a22bb6280999eed2bb2fb567c80a96a17d. --- include/global.h | 3 +- src/decl.c | 2 +- src/hack.c | 4 +-- src/hacklib.c | 16 +++++------ src/objnam.c | 24 ++++++++-------- src/questpgr.c | 10 +++---- src/role.c | 32 +++++++++++----------- sys/unix/NetHack.xcodeproj/project.pbxproj | 2 +- 8 files changed, 46 insertions(+), 47 deletions(-) diff --git a/include/global.h b/include/global.h index 123a96cf3..c1f171651 100644 --- a/include/global.h +++ b/include/global.h @@ -366,8 +366,7 @@ struct savefile_info { /* Supply nhassert macro if not supplied by port */ #ifndef nhassert -#define nhassert(e) ((void)0) +#define nhassert(expression) ((void)0) #endif - #endif /* GLOBAL_H */ diff --git a/src/decl.c b/src/decl.c index 8302d7804..1d0731913 100644 --- a/src/decl.c +++ b/src/decl.c @@ -414,6 +414,6 @@ instance_globals_init() sfcap = default_sfinfo; sfrestinfo = default_sfinfo; sfsaveinfo = default_sfinfo; -} +}; /*decl.c*/ diff --git a/src/hack.c b/src/hack.c index 7a795c373..7a5e48116 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1156,10 +1156,10 @@ int x,y; int tx = u.tx; int ty = u.ty; boolean ret; - int glyph = glyph_at(x,y); + int g = glyph_at(x,y); if (x == u.ux && y == u.uy) return TRUE; - if (isok(x,y) && glyph_is_cmap(glyph) && S_stone == glyph_to_cmap(glyph) + if (isok(x,y) && glyph_is_cmap(g) && S_stone == glyph_to_cmap(g) && !levl[x][y].seenv) return FALSE; u.tx = x; diff --git a/src/hacklib.c b/src/hacklib.c index a6facde7b..d0c6915f0 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1008,33 +1008,33 @@ char *buf; int k; time_t timeresult = (time_t) 0; struct tm t, *lt; - char *d, *p, y[5], mo[3], md[3], h[3], mi[3], s[3]; + char *g, *p, y[5], mo[3], md[3], h[3], mi[3], s[3]; if (buf && strlen(buf) == 14) { - d = buf; + g = buf; p = y; /* year */ for (k = 0; k < 4; ++k) - *p++ = *d++; + *p++ = *g++; *p = '\0'; p = mo; /* month */ for (k = 0; k < 2; ++k) - *p++ = *d++; + *p++ = *g++; *p = '\0'; p = md; /* day */ for (k = 0; k < 2; ++k) - *p++ = *d++; + *p++ = *g++; *p = '\0'; p = h; /* hour */ for (k = 0; k < 2; ++k) - *p++ = *d++; + *p++ = *g++; *p = '\0'; p = mi; /* minutes */ for (k = 0; k < 2; ++k) - *p++ = *d++; + *p++ = *g++; *p = '\0'; p = s; /* seconds */ for (k = 0; k < 2; ++k) - *p++ = *d++; + *p++ = *g++; *p = '\0'; lt = getlt(); if (lt) { diff --git a/src/objnam.c b/src/objnam.c index e91f0fb4a..66e09d746 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -3359,21 +3359,21 @@ retry: } else if (!strcmpi(bp, "looking glass")) { ; /* avoid false hit on "* glass" */ } else if (!BSTRCMPI(bp, p - 6, " glass") || !strcmpi(bp, "glass")) { - register char *s = bp; + register char *g = bp; /* treat "broken glass" as a non-existent item; since "broken" is also a chest/box prefix it might have been stripped off above */ - if (broken || strstri(s, "broken")) + if (broken || strstri(g, "broken")) return (struct obj *) 0; - if (!strncmpi(s, "worthless ", 10)) - s += 10; - if (!strncmpi(s, "piece of ", 9)) - s += 9; - if (!strncmpi(s, "colored ", 8)) - s += 8; - else if (!strncmpi(s, "coloured ", 9)) - s += 9; - if (!strcmpi(s, "glass")) { /* choose random color */ + if (!strncmpi(g, "worthless ", 10)) + g += 10; + if (!strncmpi(g, "piece of ", 9)) + g += 9; + if (!strncmpi(g, "colored ", 8)) + g += 8; + else if (!strncmpi(g, "coloured ", 9)) + g += 9; + if (!strcmpi(g, "glass")) { /* choose random color */ /* 9 different kinds */ typ = LAST_GEM + rnd(9); if (objects[typ].oc_class == GEM_CLASS) @@ -3384,7 +3384,7 @@ retry: char tbuf[BUFSZ]; Strcpy(tbuf, "worthless piece of "); - Strcat(tbuf, s); /* assume it starts with the color */ + Strcat(tbuf, g); /* assume it starts with the color */ Strcpy(bp, tbuf); } } diff --git a/src/questpgr.c b/src/questpgr.c index ede98b1bc..cf6fbdd38 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -282,7 +282,7 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */ which; /* 'h'|'H'|'i'|'I'|'j'|'J' */ { const char *pnoun; - int godgend; + int g; char lwhich = lowc(which); /* H,I,J -> h,i,j */ /* @@ -298,13 +298,13 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */ : (lwhich == 'i') ? "them" : (lwhich == 'j') ? "their" : "?"; } else { - godgend = (who == 'd') ? quest_status.godgend + g = (who == 'd') ? quest_status.godgend : (who == 'l') ? quest_status.ldrgend : (who == 'n') ? quest_status.nemgend : 2; /* default to neuter */ - pnoun = (lwhich == 'h') ? genders[godgend].he - : (lwhich == 'i') ? genders[godgend].him - : (lwhich == 'j') ? genders[godgend].his : "?"; + pnoun = (lwhich == 'h') ? genders[g].he + : (lwhich == 'i') ? genders[g].him + : (lwhich == 'j') ? genders[g].his : "?"; } Strcpy(cvt_buf, pnoun); /* capitalize for H,I,J */ diff --git a/src/role.c b/src/role.c index 31b512349..6b6348f65 100644 --- a/src/role.c +++ b/src/role.c @@ -769,7 +769,7 @@ const struct Align aligns[] = { static struct { boolean roles[SIZE(roles)]; short mask; -} rfilter = { UNDEFINED_VALUES, UNDEFINED_VALUE}; +} rfilter = UNDEFINED_VALUES; STATIC_DCL int NDECL(randrole_filtered); STATIC_DCL char *FDECL(promptsep, (char *, int)); @@ -1757,11 +1757,11 @@ winid where; not_yet[] = " not yet specified", rand_choice[] = " random"; char buf[BUFSZ]; - int r, c, gend, a, allowmask; + int r, c, g, a, allowmask; r = flags.initrole; c = flags.initrace; - gend = flags.initgend; + g = flags.initgend; a = flags.initalign; if (r >= 0) { allowmask = roles[r].allow; @@ -1770,9 +1770,9 @@ winid where; else if (c >= 0 && !(allowmask & ROLE_RACEMASK & races[c].allow)) c = ROLE_RANDOM; if ((allowmask & ROLE_GENDMASK) == ROLE_MALE) - gend = 0; /* role forces male (hypothetical) */ + g = 0; /* role forces male (hypothetical) */ else if ((allowmask & ROLE_GENDMASK) == ROLE_FEMALE) - gend = 1; /* role forces female (valkyrie) */ + g = 1; /* role forces female (valkyrie) */ if ((allowmask & ROLE_ALIGNMASK) == AM_LAWFUL) a = 0; /* aligns[lawful] */ else if ((allowmask & ROLE_ALIGNMASK) == AM_NEUTRAL) @@ -1804,10 +1804,10 @@ winid where; : roles[r].name.m); if (r >= 0 && roles[r].name.f) { /* distinct female name [caveman/cavewoman, priest/priestess] */ - if (gend == 1) + if (g == 1) /* female specified; replace male role name with female one */ Sprintf(index(buf, ':'), ": %s", roles[r].name.f); - else if (gend < 0) + else if (g < 0) /* gender unspecified; append slash and female role name */ Sprintf(eos(buf), "/%s", roles[r].name.f); } @@ -1820,11 +1820,11 @@ winid where; : races[c].noun); putstr(where, 0, buf); Sprintf(buf, "%12s ", "gender:"); - Strcat(buf, (which == RS_GENDER) ? choosing : (gend == ROLE_NONE) + Strcat(buf, (which == RS_GENDER) ? choosing : (g == ROLE_NONE) ? not_yet - : (gend == ROLE_RANDOM) + : (g == ROLE_RANDOM) ? rand_choice - : genders[gend].adj); + : genders[g].adj); putstr(where, 0, buf); Sprintf(buf, "%12s ", "alignment:"); Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE) @@ -1852,7 +1852,7 @@ boolean preselect; anything any; char buf[BUFSZ]; const char *what = 0, *constrainer = 0, *forcedvalue = 0; - int f = 0, r, c, gend, a, i, allowmask; + int f = 0, r, c, g, a, i, allowmask; r = flags.initrole; c = flags.initrace; @@ -1894,16 +1894,16 @@ boolean preselect; case RS_GENDER: what = "gender"; f = flags.initgend; - gend = ROLE_NONE; + g = ROLE_NONE; if (r >= 0) { allowmask = roles[r].allow & ROLE_GENDMASK; if (allowmask == ROLE_MALE) - gend = 0; /* genders[male] */ + g = 0; /* genders[male] */ else if (allowmask == ROLE_FEMALE) - gend = 1; /* genders[female] */ - if (gend >= 0) { + g = 1; /* genders[female] */ + if (g >= 0) { constrainer = "role"; - forcedvalue = genders[gend].adj; + forcedvalue = genders[g].adj; } else if (f >= 0 && (allowmask & ~rfilter.mask) == genders[f].allow) { /* if there is only one gender choice available due to user diff --git a/sys/unix/NetHack.xcodeproj/project.pbxproj b/sys/unix/NetHack.xcodeproj/project.pbxproj index dcb402a98..4a0d53ae5 100644 --- a/sys/unix/NetHack.xcodeproj/project.pbxproj +++ b/sys/unix/NetHack.xcodeproj/project.pbxproj @@ -810,7 +810,6 @@ 3186A3B121A4B0FD0052BF02 /* bitmfile.h */, 3186A36E21A4B0FA0052BF02 /* botl.h */, 3186A38721A4B0FB0052BF02 /* color.h */, - 31B8A30A21A20D730055BD01 /* config.h */, 3186A3C621A4B0FE0052BF02 /* config1.h */, 3186A37121A4B0FA0052BF02 /* context.h */, 3186A3C521A4B0FE0052BF02 /* coord.h */, @@ -902,6 +901,7 @@ 3186A36D21A4B0F90052BF02 /* xwindowp.h */, 3186A3BF21A4B0FD0052BF02 /* you.h */, 3186A3A721A4B0FD0052BF02 /* youprop.h */, + 31B8A30A21A20D730055BD01 /* config.h */, ); name = include; sourceTree = "";