Commit Graph

2557 Commits

Author SHA1 Message Date
nhkeni
bea2d208dd depend.awk: sort the dependencies
Can be disabled in the BEGIN block (set dosort = 0).

Blame this change on the Department of Motor Vehicles :-)
2024-03-04 13:38:17 -05:00
nhmall
3fb35e390b visual studio project file update 2024-03-03 14:35:55 -05:00
nhmall
02074d7461 Windows Makefile updates 2024-03-03 14:15:53 -05:00
nhmall
dbea5d8684 shorten options.c a little by moving some color stuff out of it
creates new coloratt.c file

Also, this attempts to fulfill a wish-list item by paxed, to
allow naming colors in symbols file by name as an alternative
to using r-g-b values.  The basic color names as well as html
color names are supported.
2024-03-03 14:11:17 -05:00
nhmall
d4dabbfa8d update tested versions of Visual Studio 2024-03-01 2024-03-01 09:33:00 -05:00
RainRat
a3658f85ac fix typos 2024-02-28 20:15:56 -08:00
nhkeni
5f64dd3f1b Make initoptions() call initoptions_init() if that hasn't already happened. 2024-02-23 20:14:03 -05:00
nhkeni
77916d5d73 make depend for previous commit 2024-02-23 18:04:26 -05:00
nhkeni
eadebf0132 Use local md4 implementation instead of libcrypto for linux.
NB: "make depend" needs to be rerun
2024-02-23 17:08:49 -05:00
nhkeni
61f4d972bb Add local md4 implementation and drop libcrypto for linux. 2024-02-23 17:05:45 -05:00
nhmall
4478200964 update tested versions of Visual Studio 2024-02-22 2024-02-22 15:03:13 -05:00
nhkeni
fc100f269c Makefile.top: remove some out-of-date CRASHREPORT code 2024-02-20 14:37:04 -05:00
nhmall
b4f578495c more pointer style consistency 2024-02-20 13:04:32 -05:00
nhmall
688ac6ffbe remove register from variable declarations 2024-02-19 16:30:07 -05:00
nhmall
ef19265438 restore ability to use gdb on NetHack built with mingw-w64 2024-02-16 20:34:58 -05:00
nhmall
b6ad791f5f quiet some Windows warnings; fix fatal link error 2024-02-15 21:57:36 -05:00
nhkeni
72ae3c7282 if makedefs doesn't exist, force NOCRASHREPORT 2024-02-15 20:42:57 -05:00
nhkeni
c02220499b Add CROSSCOMPILE to mdgrep, then use it to stop CRASHREPORT when cross-compiling 2024-02-15 19:37:43 -05:00
nhkeni
727740749e Try to fix linux for installations that don't have openssl includes. 2024-02-15 18:08:58 -05:00
nhkeni
252f70b4b3 Turn off debugging flag in Makefile.mingw32 - that should gix the MinGW build 2024-02-15 17:37:40 -05:00
nhkeni
9c0d2389cb hopefully fix broken MSDOS and MinGW compiles (linux still broken) 2024-02-15 17:07:02 -05:00
nhkeni
3d3ce2369c Merge branch 'keni-wincw2' into NetHack-3.7
Lots of manually resolved conflicts.
2024-02-15 16:25:12 -05:00
nhmall
b96762cdf0 update tested versions of Visual Studio 2024-02-15 2024-02-15 09:29:34 -05:00
nhmall
a8d3d4c8af Windows Makefile.mingw32 2024-02-11 18:20:21 -05:00
nhmall
3119bc1ec2 more Windows Makefile updates
Default to INTERNET_AVAILABLE=Y. If the build computer is not
online with the internet available, an explicit
INTERNET_AVAILABLE=N
will be required for the build, if pdcurses and Lua are not already
staged in the lib folder. That can be done by editing the appropriate line
in the Makefile, or by altering the command line:
    nmake INTERNET_AVAILABLE=N install

With Makefile.nmake:

Store pdcurses wingui and pdcurses wincon object files in separate
directories.

Rename the two pdcurses static libraries.

Because of the static library changes, the following will be required
prior to the next build:
    nmake spotless
2024-02-10 20:20:14 -05:00
nhmall
9e6872d982 Windows Install.windows correction 2024-02-10 12:44:13 -05:00
nhmall
cc7618438c Windows Install.windows and nhsetup.bat updates 2024-02-10 12:39:49 -05:00
nhmall
49fa532fa8 update Windows Makefiles 2024-02-09 17:42:12 -05:00
Pasi Kallinen
b37f1408d8 Self-recover for linux
Compile-time option SELF_RECOVER was implemented for Windows;
add it to unix systems too, with it being on by default when
compiling with the linux hints file.
2024-02-08 11:34:59 +02:00
nhkeni
dbe5c98dca add CRASHREPORT directly to browser
add CRASHREPORT for Windows
add ^P info to report (via DUMPLOG)

new options: crash_email, crash_name, crash_urlmax
new game command: #bugreport
new config option: CRASHREPORT_EXEC_NOSTDERR
new command line option: --bidshow

deleted helper scripts:
    NetHackCrashReport.Javascript
    nhcrashreport.lua

misc:
    update CRASHREPORTURL (will need to be updated before release)
    update bitrot in winchain
    winchain for Windows
    add missing synch_wait for NetHackW --showpaths
    add PANICTRACE (and CRASHREPORT) in mdlib.c:build_opts

missing:
    packaging (Windows needs the pdb file)
    no testing with MSVC command line build

port status:
    linux: working, but glibc's backtrace doesn't show static functions
    Windows VS: working.  pdb file is large - looking into options
    MacOS: working
    msdos: not supported
    VMS: not supported
    MSVC: planned, but not attempted
    MSYS2: working, but libbacktrace not showing symbols (yet?)
2024-02-06 18:33:59 -05:00
nhmall
b783b3daad update tested versions of Visual Studio 2024-02-06 2024-02-06 15:33:47 -05:00
nhmall
0dfe92ac61 more italic support
There might be some follow-ups to this.
2024-01-29 08:40:05 -05:00
nhmall
bac8ebad34 revisit Makefile sysconf steps
Add distinct potential steps into Makefile.top for putting
sysconf into place, instead of appending the steps for doing so
to the generic POSTINSTALL.

SYSCONFINSTALL is used for 'make install' and unconditionally
copies sys/unix/sysconf to the install directory.

SYSCONFENSURE is used for 'make update' and only copies
sys/unix/sysconf to the installation directory if it doesn't
already exist.

The initial trigger for revisiting this was because of new reports
that cp from (GNU coreutils) 9.4 is now issuing a warning during
NetHack builds. The warning pertains to deprecated use of the '-n'
switch with cp, which is used to only copy the file if the target
does not exist.

After this update, the shell is used to make that determination,
and if the file doesn't exist, cp is now invoked on Linux without
the '-n' switch.

For the macOS hints file, macOS.370, cp wasn't being used for sysconf
anyway, a utility script was being invoked and this doesn't change
that. macOS.370 was updated to remain in sync with linux.370 and
Makefile.top regarding the use of SYSCONFINSTALL and SYSCONFENSURE.
2024-01-27 18:12:18 -05:00
nhmall
a82317e364 update tested versions of Visual Studio 2024-01-17 2024-01-17 12:28:33 -05:00
nhmall
c3ffc284ad uudecode follow-up 2024-01-05 06:25:47 -05:00
nhmall
f8230eff4b quiet compiler warnings building sys/share/uudecode.c 2024-01-05 00:33:47 -05:00
nhkeni
9bcff7b896 Merge branch 'keni-luabits2' into NetHack-3.7 2024-01-04 10:40:27 -05:00
nhkeni
c7ab9a0565 Some lua catchup and cleanup
- add nhl_pcall_handle() to wrap all nhl_pcall calls that didn't check
  return value and either panic() or impossible()
- add --loglua (unix only) to dump Lua memory and steps info to livelog
- remove old logging
- set memory and step limits on all Lua VMs
2024-01-04 10:37:38 -05:00
Michael Meyer
a831bf576b Add WANT_SOURCE_INSTALL to linux.370 hints file
WANT_SOURCE_INSTALL=1 can be specified when compiling to build NetHack
within the repo/source tree, rather than in the normal system install
location.  I find it useful for development on OSX, but it wasn't
present in any other hints files, so I've been using a custom hints file
on Linux for a while that adds the same option.  The code is based on
the macOS.370 hints file.
2023-12-30 16:40:54 -08:00
nhmall
9f5f4b3c32 fix broken 'make install' with hints/linux.370 2023-12-28 11:45:36 -05:00
nhmall
e69c98c14a Windows follow-up: minimize pragma scope
Avoid disruption to mingw32-x64 build, by placing
some Visual Studio pragmas in #ifdef _MSC_VER
conditional blocks.
2023-12-27 15:00:08 -05:00
nhmall
3eb0fab317 Windows error checking and warnings 2023-12-27 14:56:03 -05:00
nhmall
ab74019dcb another fetch-lua follow-up 2023-12-20 22:04:22 -05:00
nhmall
e9bd28d0d8 fetch-lua follow-up 2023-12-20 21:31:58 -05:00
nhmall
a18333633f fetch-lua update
Try the mirror if the primary fails
2023-12-20 21:17:13 -05:00
nhmall
99db2433d6 update tested versions of Visual Studio 2023-12-18 2023-12-18 23:10:34 -05:00
nhmall
90fcce8903 follow-up to only attempt unzip if download was ok 2023-12-18 14:59:01 -05:00
nhmall
c197dfe29b include symify.exe in the NetHack msdos package
Before using this updated packaging you will need
to do the following (one time):
    sh sys/msdos/fetch-cross-compiler.sh

And you'll need to update your Makefiles as follows.

On Linux:
    sh sys/msdos/setup.sh sys/unix/hints/linux.370

or on macOS;
    sh sys/msdos/setup.sh sys/unix/hints/macOS.370

Create the msdos package with:
    make CROSS_TO_MSDOS=1 package
2023-12-18 14:48:10 -05:00
nhmall
978ec6a3a7 augment include/extern.h with nonnull arg info
Define some macros in include/tradstdc.h, for compilers that support
__attribute__((nonnull)), to assist in identifying which parameters
on functions are not supposed to be null pointers.

Next, for the majority of functions declared in include/extern.h, this
adds the appropriate macro that matches the actual use of each function's
parameters. The additions were done after performing some analysis.

These were the rules that were followed when determining which function
parameters should be nonnul, and which are nullable:

    1. If the first use of, or reference to, the pointer parameter in the
       function is a dereference, then the parameter will be considered
       nonnull.

    2. If there is code in the function that tests for the pointer parameter
       being null, and adjusts the code-path accordingly so that no segfault
       will occur, then the parameter will not be considered nonnull (it can
       be null).

The use of the nonnull attributes allows the compiler to detect code in
callers of the function where a null parameter could get passed to the function.

If a warning is received the developer will have to do one of the following:

     - If the null being passed to the function is now appropriate,
       and the function should be able to expect a null parameter, then the
       NONNULLxxx macro will have to be removed from the function's prototype.

    or

     - If the null being passed to the function is not appropriate,
       correct the caller so it is not passing null.

    or

     - If the warning is about comparing to null, it may indicate an
       unnecessary null check in the code involved. If it is deemed to be
       unnecessary, it can then be removed.

Some static analysis tools apparently can work with the attribute, as well.

Following this, it was discovered that some functions were using one of the
(now) nonnull parameters in the first argument to the 'is_art(obj, ART)'
macro, which is defined like so:
 =>   #define is_art(o,art) ((o) && (o)->oartifact == (art))

That macro expansion inline resulted in a diagnostic warning because of the
'(o)' portion of the expanded macro, anywhere the macro was used with one of
the nonnull parameters. A test against null for a 'nonnull parameter' causes
a diagnostic warning.

To work around that, I replaced the is_art() macro with a function in
artifact.c, that accomplishes the same thing as the macro.

 =>   boolean
      is_art(struct obj *obj, int art)
      {
          if (obj && obj->oartifact == art)
              return TRUE;
          return FALSE;
      }

Some documentation...

These are the macros that have been defined for use when specifying the nonnull
parameters in a function prototype:

   ----------------------------------------------------------------------------
   |      Macro     |              Purpose                                    |
   +----------------+---------------------------------------------------------+
   | NONULL         | The function return value is never NULL.                |
   +----------------+---------------------------------------------------------+
   | NONNULLPTRS    | Every pointer argument is declared nonnull.             |
   +----------------+---------------------------------------------------------+
   | NONNULLARG1    | The 1st argument is declared nonnull.                   |
   +----------------+---------------------------------------------------------+
   | NONNULLARG2    | The 2nd argument is declared nonnull.                   |
   +----------------+---------------------------------------------------------+
   | NONNULLARG3    | The 3rd argument is declared nonnull.                   |
   +----------------+---------------------------------------------------------+
   | NONNULLARG4    | The 4th argument is declared nonnull (not used).        |
   +----------------+---------------------------------------------------------+
   | NONNULLARG5    | The 5th argument is declared nonnull.                   |
   +----------------+---------------------------------------------------------+
   | NONNULLARG7    | The 7th argument is declared nonnull (bhit).            |
   +----------------+---------------------------------------------------------+
   | NONNULLARG12   | The 1st and 2nd arguments are declared nonnull.         |
   +----------------+---------------------------------------------------------+
   | NONNULLARG13   | The 1st and 3rd arguments are declared nonnull.         |
   +----------------+---------------------------------------------------------+
   | NONNULLARG123  | The 1st, 2nd and 3rd arguments are declared nonnull.    |
   +----------------+---------------------------------------------------------+
   | NONNULLARG14   | The 1st and 4th arguments are declared nonnull.         |
   +----------------+---------------------------------------------------------+
   | NONNULLARG134  | The 1st, 3rd and 4th arguments are declared nonnull.    |
   +----------------+---------------------------------------------------------+
   | NONNULLARG17   | The 1st and 7th arguments are declared nonnull (this    |
   |                | was a special-case added for askchain(), where the      |
   |                | arguments are spread out that way. This macro           |
   |                | could be removed if the askchain arguments in the       |
   |                | prototype and callers were changed to make the          |
   |                | nonnull arguments side-by-side).                        |
   +----------------+---------------------------------------------------------+
   | NONNULLARG145  | The 1st, 4th and 5th arguments are declared nonnull     |
   |                | (this was a special-case added for find_roll_to_hit(),  |
   |                | in uhitm.c, where the arguments are spread out that way.|
   |                | We can't just use NONNULLPTRS there because the 3rd     |
   |                | argument 'weapon' can be NULL).                         |
   +----------------+---------------------------------------------------------+
   | NONNULLARG24   | The 2nd and 4th arguments are declared nonnull (this    |
   |                | was a special-case added for query_objlist()            |
   |                | in invent.c).                                           |
   +----------------+---------------------------------------------------------+
   | NONNULLARG45   | The 4th and 5th arguments are declared nonnull (this    |
   |                | was a special-case added for do_screen_description(),   |
   |                | in pager.c, where the arguments are spread out that     |
   |                | way. We can't just use NONNULLPTRS there because the    |
   |                | 6th argument can be NULL).                              |
   +----------------+---------------------------------------------------------+
   | NO_NONNULLS    | This macro expands to nothing. It is just used to       |
   |                | mark that analysis has been done on the function,       |
   |                | and concluded that none of the arguments could be       |
   |                | marked nonnull.That distinguishes a function that has   |
   |                | not been analyzed (yet), from one that has.             |
   +----------------+---------------------------------------------------------+

The NO_NONNULLS macro is meant to place a flag on the prototype to
make people aware that an assessed function was determined to not
be eligible for nonnull parameters. It expands to nothing.

Unfortunately, that macro was added partway through this exercise, so there
aren't many instances of it in the upper parts of include/extern.h, even though
the functions there were likely assessed and categorized as not having any
eligible nonnull parameters. It just never got any macro at all, in that case.

Following the parameter usage analysis that was done, the following was
noted:

       Some NetHack functions have added a test to catch a passed null
       parameter, and exit the function early as a result, or call
       impossible(), and then exit. While that approach prevents segfaults
       from dereferencing a null parameter, the early return is silent
       (when impossible is not called anyway), and the function's true
       purpose is not fulfilled. Also, the calling function may have no
       awareness that the function did not complete its intended purpose,
       in many instances.

       Functions with such a test and early return, cannot have the parameter
       declared 'nonnull', because the code to test for 'null' will cause a
       diagnostic to be issued if the parameter is nonnull.

       It might be good to revisit some of those functions and consider,
       on a case by case basis, declaring the parameter nonnull in the
       prototype, and the test/code-path commented out.
2023-12-14 20:06:03 -05:00
nhmall
8b821d0e00 follow-up for Lua mirror target
Use a variable
2023-12-09 12:11:27 -05:00