Commit Graph

2007 Commits

Author SHA1 Message Date
nhmall
29aca6276e fix some VS warnings that recently appeared
..\src\explode.c(884): warning C4028: formal parameter 1 different from declaration

  That one stems from commit 6b60618e0e.
  Adjust the prototype in include/extern.h to match the function definition in
  src/explode.c

  Also, a recent update to the Microsoft Visual Studio 2019 causes the
  compiler to complain while compiling a vendor c++ header (string) if
  warning C4774 is enabled.

  We force that warning to be enabled during the Makefile build, even though
  it is not enabled by default.

  Only do so in the Makefile.msc for c source files, and not for c++
  (sys/share/cppregex.cpp).

  See below for an example of the compiler complaint.

  cppregex.cpp
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  warning C4774: '_scprintf' : format string expected in argument 1 is
  not a string literal
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  note: e.g. instead of printf(name); use printf("%s", name); because
  format specifiers in 'name' may pose a security issue
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(530):
  note: consider using constexpr specifier for named string literals
  C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\string(583):
  note: see reference to function template instantiation 'std::string
  std::_Floating_to_string<float>(const char *,_Ty)' being compiled
          with
	[
	   _Ty=float
	]
2021-08-14 15:36:54 -04:00
nhmall
2baadd6a29 header files sym.h and defsym.h
There were multiple symbol-related lists that had to be kept
in sync in various places.

Consolidate some of that into a single new file
    defsym.h
with a set of morphing macros that can be custom-called from
the various places that use the sym info without maintaining
multiple occurrences. Most maintenance can be done there.

Rename monsym.h to sym.h since it looks after some
symbols not related to monsters now too.

The defsym.h header file is included in multiple places to
produce different code depending on its use and the controlling
macro definitions in place prior to including it.

Its purpose is to have a definitive source for
pchar, objclass and mon symbol maintenance.

The controlling macros used to morph the resulting code are
used in these places:
  - in include/sym.h for enums of some S_ symbol values
    (define PCHAR_ENUM, MONSYMS_ENUM prior to #include defsym.h)
  - in include/objclass.h for enums of some S_ symbol values
    (define OBJCLASS_ENUM prior to #include defsym.h)
  - in src/symbols.c for parsing S_ entries in config files
    (define PCHAR_PARSE, MONSYMS_PARSE, OBJCLASS_PARSE prior
    to #include defsym.h)
  - in src/drawing.c for initializing some data structures/arrays
    (define PCHAR_DRAWING, MONSYMS_DRAWING, OBJCLASS_DRAWING prior
    to #include defsym.h)
  - in win/share/tilemap.c for processing a tile file
    (define PCHAR_TILES prior to #include defsym.h).
2021-08-10 13:35:25 -04:00
nhmall
e16b98b61d NetHackW before and after tile additions
The NetHackW.res file wasn't being forced to be rebuilt if
the tiles were changed as they were recently.

Fix the Makefile.msc dependency so that it is.
Also have 'nmake clean' clear the generated *.res files.
2021-08-04 15:48:17 -04:00
PatR
9c71b7dc4a Unix 'make clean' bit
When deleting obsolete generated files (monstr.c, vis_tab.[ch])
for src 'make clean' or clean called from src 'make spotless' or
from top Makefile, don't complain if they aren't present.

Deletion failure wasn't stopping 'make' but did result in looking
like something might be wrong.
Before:
 rm monstr.c vis_tab.c ../include/vis_tab.h  #obsolete generated files
 rm: monstr.c: No such file or directory
 rm: vis_tab.c: No such file or directory
 rm: ../include/vis_tab.h: No such file or directory
 make[1]: [clean] Error 1 (ignored)
After:
 rm -f monstr.c vis_tab.c ../include/vis_tab.h #obsolete generated files
(no extra feedback from rm or make).
2021-07-22 08:32:25 -07:00
nhmall
bed1645f5b Guidebook.txt to July 21, 2021 current (retry) 2021-07-21 14:58:06 -04:00
nhmall
cd87283ba4 recognize vs2019 16.10.4 in sys/windows/Makefile.msc 2021-07-21 11:23:10 -04:00
Pasi Kallinen
29a8153170 Add a new bigroom variant "boulder maze" 2021-07-09 18:18:31 +03:00
nhmall
216c26aaef do vs2017 warnings.h a little differently than vs2019
fixes #545
2021-07-07 09:05:22 -04:00
nhmall
ca7b1d5df0 another nhsetup.bat tweak 2021-06-08 14:15:36 -04:00
nhmall
e6d9e6be0b no need to check vs version in nhsetup.bat 2021-06-08 13:56:02 -04:00
nhmall
0305a14a27 windows substitution error in gcc Makefile 2021-06-04 21:46:03 -04:00
nhmall
7439c8b060 windsys.c name tidbit 2021-06-04 08:51:42 -04:00
nhmall
631e80c47a msdos Install.dos tidbit 2021-06-04 08:49:20 -04:00
nhmall
80d3178d25 windows doc update tidbit 2021-06-04 00:24:46 -04:00
nhmall
254c6c55f5 Windows build warning and Makefile update
.\hack.c(2657): warning C4389: '!=': signed/unsigned mismatch
Visual Studio autodetection update for Makefile.msc
2021-06-04 00:14:37 -04:00
nhmall
91ab71f0f9 windows and visual studio follow-up bit 2021-06-03 23:43:32 -04:00
nhmall
0a10bd632d change references from winnt to windows
rename sys/winnt to sys/windows
move vs (visual studio) folder out of win/win32 and into sys/windows
rename include/ntconf.h to include/windconf.h
rename winnt.c to windsys.c
place visual studio projects into individual subfolders.

This will hopefully resolve GitHub issue #484 as well.
2021-06-03 23:26:00 -04:00
PatR
acfbf20958 unix/Makefile.top fetch-Lua bit
% make spotless
% sh sys/unix/setup.sh sys/unix/hints/macOS.2020
% make fetch-Lua

worked, but the last ended with

|rm include/nhlua.h
|rm: include/nhlua.h: No such file or directory
|make: [fetch-Lua] Error 1 (ignored)

which might frighten skittish users (like me).  Check whether the
constructed header file exists (so is assumed to be for an earlier
Lua version) and only delete it in that case.  No more scary report
of benign failure when it isn't there (after 'make spotless' or for
brand new source setup).

Also, some time ago we came to the conclusion that 'if [ ]' was an
extension for GNU 'bash' and wouldn't work with some older actual
'sh' implementations.  This replaces the one post-3.6 instance of
|if [ ! -d foo ] then bar; fi
in Makefile.top with
|if test -d foo; then true; else bar; fi
Testing was successful but done with bash rather than an old sh. :-}
2021-06-02 17:13:56 -07:00
nhmall
5c95603a82 Makefile command echo suppression 2021-06-02 19:21:37 -04:00
nhmall
e69808987e support for build with current Lua version 5.4.3
On some platforms this may require:
	make spotless
	make fetch-lua

I did attempt to force a reminder message about the latter to
Makefile.top this time, and hope that works correctly for everyone.
2021-06-02 19:12:47 -04:00
PatR
0cdb91aa50 Unix 'make update'
Revise Makefile.top to remove the obsolete commands which change
the last modified date of save and bones files during 'make update'.
Using file dates to validate save files against nethack hasn't been
useful for many years.

Also, update assorted comments.
2021-05-23 18:14:13 -07:00
Pasi Kallinen
29868036f1 Lua: nhcore script with function callbacks
Adds possible callbacks for "start_new_game", "restore_old_game",
"moveloop_turn", and "game_exit" which when defined, will be called
from core code at the appropriate time.

Adds lua hooks for dump_fmtstr (only if DUMPLOG), dnum_name, u.moves,
u.uhave_amulet, and u.depth.
2021-05-21 21:24:59 +03:00
nhmall
49c008fcee Windows nmake build - recognize VS 16.8.5 2021-02-20 11:53:17 -05:00
nhmall
c4d9ceda9d Windows sys/winnt/Makefile.msc update 2021-02-05 19:54:15 -05:00
nhmall
30bb6525b2 add -Wdeprecated-copy if clang and clang >= 9 2021-02-05 16:28:09 -05:00
nhmall
d344e61da1 typo fix 2021-02-05 10:03:18 -05:00
nhmall
5003a0578c sync some macOS hints changes to linux hints 2021-02-05 09:51:07 -05:00
nhmall
769b8877fc separate the C compiler flags and C++ compiler flags where needed 2021-02-05 09:45:03 -05:00
nhmall
f8785792bd potential fix for the macOS issue encountered
Some build flags were unintentionally overlooked in a previous change
2021-02-05 09:38:35 -05:00
nhmall
d714eca924 roll back a Makefile.src change due to macOS issue afterwards
Requires further investigation
2021-02-05 07:43:51 -05:00
nhmall
b14c47132f more cross-compile warning bits
maximize warnings for NetHack sources
minimize warnings for Lua and pdcurses which we won't be changing
2021-02-04 19:42:07 -05:00
nhmall
c87b556f42 more msdos cross-compile pdcurses warning suppression 2021-02-04 18:53:18 -05:00
nhmall
fd970e58a2 warnings in cross-compile of pdcurses are not desired 2021-02-04 18:41:07 -05:00
nhmall
4380b4e3e4 progress detail in the CI log file is too verbose 2021-02-04 18:04:11 -05:00
nhmall
91558e5ce9 another duplicate entry in Xcode project file 2021-02-03 22:04:15 -05:00
nhmall
b00677223d remove a duplicate entry in Xcode project file 2021-02-03 22:03:04 -05:00
nhmall
2cfd5784f2 add missing lua files to Xcode build 2021-02-03 21:52:42 -05:00
PatR
bb87d620a9 Couple of Xcode setup documenation bits 2021-02-03 17:10:49 -08:00
nhmall
5e93fd06c0 ensure build with old linux-qt5 hints 2021-02-03 13:46:13 -05:00
nhmall
8b21a170fb clear a number of Qt build warnings on linux related to compiler flags
option ‘-Wimplicit’ is valid for C/ObjC but not for C++
option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++
option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++
option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
option ‘-Wmissing-parameter-type’ is valid for C/ObjC but not for C++
option ‘-Wold-style-definition’ is valid for C/ObjC but not for C++
option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
2021-02-03 13:18:43 -05:00
nhmall
7b454f8ba3 Windows format string bits 2021-02-02 21:55:34 -05:00
nhmall
9684b75f54 whitelist some macOS clang format-nonliteral warnings 2021-02-02 19:50:07 -05:00
nhmall
5b1d668c44 enable -Wformat-nonliteral for linux and equivalent for windows compilers
Whitelist all the verified existing triggers:
makedefs.c: In function ‘name_file’
attrib.c: one compiler balks at a ? b : c for fmtstring
cmd.c: In function ‘extcmd_via_menu’
cmd.c: In function ‘wiz_levltyp_legend’
do.c: In function ‘goto_level’
do_name.c: In function ‘coord_desc’
dungeon.c: In function ‘overview_stats’
eat.c:  one compiler balks at a ? b : c for fmtstring
end.c:  one compiler balks at a ? b : c for fmtstring
engrave.c: In function ‘engr_stats’
hack:c one compiler balks at a ? b : c for fmtstring
hacklib.c: one compiler balks at a ? b : c for fmtstring
insight.c: one compiler balks at a ? b : c for fmtstring
invent.c: In function ‘let_to_name’
light.c: In function ‘light_stats’
mhitm.c: In function ‘missmm’
options.c: In function ‘handler_symset’
options.c: In function ‘basic_menu_colors’
options.c: In function ‘optfn_o_autopickup_exceptions’
options.c: In function ‘optfn_o_menu_colors’
options.c: In function ‘optfn_o_message_types’
options.c: In function ‘optfn_o_status_cond’
options.c: In function ‘optfn_o_status_hilites’
options.c: In function ‘doset’
options.c: In function ‘doset_add_menu’
options.c: In function ‘show_menu_controls’
options.c: In function ‘handle_add_list_remove’
pager.c: In function ‘do_supplemental_info’
pager.c: In function ‘dohelp’
region.c: In function ‘region_stats’
rumors.c: sscanf usage
sounds.c: In function ‘domonnoise’
spell.c: In function ‘dospellmenu’
timeout.c: In function ‘timer_stats’
topten.c: In function ‘outentry’, fscanf, sscanf, fprintf usage
windows.c: In function ‘genl_status_update’
zap.c: one compiler balks at a ? b : c for fmtstring
win/curses/cursstat.c: In function ‘curses_status_update’
win/tty/wintty.c: In function ‘tty_status_update’
win/win32/mswproc.c: In function ‘mswin_status_update’
2021-02-02 19:03:12 -05:00
nhmall
32c417d788 Windows nmake build warnings during compiles of Lua sources 2021-02-01 13:03:32 -05:00
nhmall
a6631e3bb0 suppress a particular warning for an individual function; useful for non-gcc
Microsoft and other non-GNU compilers don't recognize gcc tricks
like  /*NOTREACHED*/ to suppress individual warnings. clang recognizes most
of them because it tries to be gcc-compatible. Because of that, a lot of
potentially useful warnings have had to be completely suppressed in the
past in all source files when using the non-gcc compatible compilers.

Now that the code is C99, take advantage of a way to suppress warnings for
individual functions, a big step up from suppressing the warnings
altogether.

Unfortunately, it does require a bit of ugliness caused by the
insertion of some macros in a few spots, but I'm not aware of
a cleaner alternative that still allows warnings to be enabled
in general, while suppressing a warning for known white-listed
instances.

Prior to the warning-tiggering function, place whichever one of
the following is needed to suppress the warning being encountered:

DISABLE_WARNING_UNREACHABLE_CODE
DISABLE_WARNING_CONDEXPR_IS_CONSTANT

After the warning-triggering function, place this:

RESTORE_WARNINGS

Under the hood, the compiler-appropriate warning-disabling
mechanics involve the use of C99 _Pragma, which can be used
in macros.

For unrecognized or inappropriate compilers, or if
DISABLE_WARNING_PRAGMAS is defined, the macros expand
to nothing.
2021-02-01 12:54:19 -05:00
nhmall
113ee039e7 outdated files in Xcode project 2021-01-31 21:18:48 -05:00
nhmall
5c3582d27a Xcode project fix when NetHack source directory path contains spaces
Underlying shell scripts configued in the Xcode project were not
coded to accommodate spaces in the path
2021-01-31 20:07:50 -05:00
PatR
0b1f5ea45e outdated vs Unix 'make depend'
After the most recent round of moving old stuff to 'outdated',
src/windows.c contained two references to non-existent files.
That broke 'make depend'.  Updating it to turn those two into
comments seems risky because someone might add an include for
some new interface later in the file.  So comment them out in
the source instead.  Also, redo previous 'make depend' update
from about three weeks ago to do the same thing.
2021-01-31 13:05:32 -08:00
nhmall
322293993f follow-up to remove some remnant wingem.h references
this should correct the broken mingw tty build
2021-01-31 13:44:15 -05:00
nhmall
b851b28cbe FDECL and NDECL in sys/vms 2021-01-31 12:49:22 -05:00