Commit Graph

2704 Commits

Author SHA1 Message Date
nhmall
cd032881ad Windows pdcurses: suppress fallthrough warnings
Avoid warning about issues in 3rd party code
2024-11-30 19:19:54 -05:00
nhmall
b89e792873 Some Windows gcc fixes 2024-11-30 19:06:05 -05:00
nhmall
bc88266081 NetHack's regex function prototypes into nhregex.h
There was an issue with Windows mingw build because the function
prototypes were not available. Place them into a distinct
header file nhregex.h and include it from extern.h, and
available for cppregex.cpp to include without the rest of
extern.h (which can give some problems with c++).
2024-11-30 17:08:54 -05:00
nhmall
8f2b979f32 Windows: nmake lualib build bit 2024-11-30 17:05:23 -05:00
nhmall
f8d9b288b9 Merge branch 'NetHack-3.7' of https://github.com/guillaumebrunerie/NetHack into NetHack-3.7 2024-11-30 15:54:21 -05:00
nhmall
df86614318 Windows Visual Studio: another follow-up
Missed a couple of configuration options in previous fix
2024-11-30 15:51:30 -05:00
nhmall
36227fcb6d follow-up: build fix when using VS 2019 2024-11-30 15:47:40 -05:00
nhmall
d94f728a9f Windows visual studio: lualib as separate entity 2024-11-30 15:42:06 -05:00
nhmall
88301902f8 remove a left-over piece of a test 2024-11-30 14:47:04 -05:00
nhmall
0792e5fe9e expand implicit fallthrough detection to non-gcc compilers
gcc has recognized various "magic comments" for white-listing
occurrences of implicit fallthrough in switch statements for
a long time:

    The range and shape of "falls through" comments accepted are
    contingent upon the level of the warning. (The default level is =3.)

    -Wimplicit-fallthrough=0 disables the warning altogether.
    -Wimplicit-fallthrough=1 treats any kind of comment as a "falls through" comment.
    -Wimplicit-fallthrough=2 essentially accepts any comment that contains something
     that matches (case insensitively) "falls?[ \t-]*thr(ough|u)" regular expression.
    -Wimplicit-fallthrough=3 case sensitively matches a wide range of regular
     expressions, listed in the GCC manual. E.g., all of these are accepted:
        /* Falls through. */
        /* fall-thru */
        /* Else falls through. */
        /* FALLTHRU */
        /* ... falls through ... */
       etc.
    -Wimplicit-fallthrough=4 also, case sensitively matches a range of regular
     expressions but is much more strict than level =3.
    -Wimplicit-fallthrough=5 doesn't recognize any comments.

Plenty of other compilers did not recognize the gcc comment convention,
and up until now the compiler warning for detecting unintended
fallthrough had to be suppressed on other compilers. That's because the code
in NetHack has been relying on the gcc approach, and only the gcc approach.

The C23 standard introduces an attribute [[fallthrough]] for the
functionality, when implicit fallthrough warnings have been enabled.

Several popular compilers already support that, or a very similar attribute
style approach, today, even ahead of their C23 support:

       C compiler                       whitelist approach
       ---------------------------   -------------------------------------
       C23 conforming compilers         [[fallthrough]]

       clang versions supporting
       standards prior to
       C23                              __attribute__((__fallthrough__))

       Microsoft Visual Studio
       since VS 2022 17.4.
       The warning C5262 controls
       whether the implict
       fallthrough is detected and
       warned about with
       /std:clatest.                    [[fallthrough]]

This adds support to NetHack for the attribute approach by inserting a
macro FALLTHROUGH to the existing cases that require white-listing, so
other compilers can analyze things too.

The definition of the FALLTHROUGH macro is controlled in include/tradstdc.h.

The gcc comment approach has also been left in place at this time.
2024-11-30 14:16:27 -05:00
nhmall
d6beba7b6a Windows: fix hacklib subproject settings in VS 2024-11-30 11:57:20 -05:00
Guillaume Brunerie
52876c4798 WASM fixes 2024-11-30 17:07:10 +01:00
nhmall
c1c74db90c update tested versions of Visual Studio 2024-11-27 2024-11-27 09:48:35 -05:00
PatR
dab4784842 Unix 'make spotless' - remove lev_comp + dgn_comp
In case someone switches from NetHack-3.6 to NetHack-3.7 and does
'make spotless' after the switch instead of before, get rid of out
of date lev_comp and dgn_comp.
2024-11-26 21:52:47 -08:00
nhmall
37793be6eb more quieting of Qt6 build warnings 2024-11-20 09:56:01 -05:00
nhmall
3e903fd79a quiet warnings on recent Qt, macOS Sequoia 15.1, latest Xcode 2024-11-17 10:03:04 -05:00
nhmall
7932497450 follow-up for Makefile.nmake 2024-11-16 10:45:22 -05:00
nhmall
21b495f835 Makefile.nmake build fix when no curses options
Resolves #1325
2024-11-16 10:10:10 -05:00
nhmall
13db1aed0d replace stray tabs that have crept in 2024-11-14 11:54:39 -05:00
nhmall
52a9af7278 early_init() was being called twice on Windows GUI 2024-11-13 13:57:18 -05:00
nhmall
c85b5d3e56 rearrange function layout in Windows windmain.c 2024-11-13 13:48:03 -05:00
nhmall
724f8f865c more memory freeing before exit on Windows 2024-11-12 18:51:04 -05:00
nhmall
0e52eac184 update tested versions of Visual Studio 2024-11-12 2024-11-12 18:00:37 -05:00
nhmall
7414b906b2 release some memory before exit under Windows 2024-11-11 16:50:57 -05:00
nhkeni
91c38355e7 Merge branch 'keni-gitset2' into NetHack-3.7 2024-11-11 11:27:27 -05:00
nhkeni
36e8d9e6fc nhgitset version 4
To update, run "perl DEVEL/nhgitset.pl"

Fixes:
- "nhcommit -a" has been fixed
- NHDT was hardwired in places
- no longer complain about a missing dat directory outside of the
    NetHack source tree
- make update of gitinfo atomic
- Replace some hardwired directory separators with OS-dependent constructs

Backwards Incompatibilities:
- NH_DATESUB's DATE() is now Date() to match the other variables
- MSYS2 requires an additional Perl package - the MSYS2 docs have
    been updated

New Help System:
- git nhhelp
   This command mirrors "git help" for nh* commands.
- See git nhhelp nhsub for general help on substitution variables

New Substitution Variables:
-Brev()
    An aBREViation of $PREFIX-Branch$:$PREFIX-Revision$ - this
    may help get line length under control in file headers.
-Assert(TYPE=VALUE)
    If TYPE does not match VALUE, do not substitute on this line.
    TYPE P checks VALUE against nethack.substprefix
-Project(arg)
    Returns nethack.projectname if there is no arg and an uppercase
    version if arg is uc.

Other New Features:
- Add nethack.projectname
- Documentation updates - see "git nhhelp nhsub"
- On checkout or merge of a branch, check for nhgitset version updates
  and provide an optional message to the user.
- Move NH_DATESUB substitutions here from cron job to keep dates in sync
- PREFIX-* keywords now available in NH_DATESUB templates
- Support use of nhgitset.pl from a different repo; note that update
  checks will be dependent on keeping the original source repo up-to-date
  and in the same location.
2024-11-11 09:15:49 -05:00
nhmall
e83e04dbb3 fix some memory leaks 2024-11-10 22:24:45 -05:00
nhmall
70a5b06c45 Makefile.nmake fix for target spotless under x64 2024-11-02 09:15:20 -04:00
Pasi Kallinen
696af89299 Change MSGHANDLER from compile-time to sysconf 2024-10-19 10:47:53 +03:00
PatR
1f36b98b8f 'selectsaved' extension
Instead of a menu listing
 a - hero1
 b - hero2
 n - New game
 q - Quit
show
 a - hero1-role1-race1-gend1-algn1
 b - hero2-role2-race2-gend2-algn2
 n - New game
 q - Quit
or
 a - - hero1-role1-race1-gend1-algn1
 b - X hero2-role2-race2-gend2-algn2
 c - D wizard-role3-race3-gend3-algn3
 n - New game
 q - Quit
when any game in the list wasn't saved during normal play.  (Those
are sorted by character name; the playmode is just coincidence.)

The dash for 'normal' doesn't look great but -/X/D are codes used in
entries written to paniclog.  The whole playmode prefix doesn't look
particularly good but I suspect that most players relying on restore
via menu won't see it.

It should work when the character name has dashes in it but that
hasn't been properly tested.

The gender and alignment suffices reflect their value at the time of
save rather than at the start of the game.  That might be considered
a bug but it was easiest.

Increments EDITLEVEL; existing save and bones files are invalidated.
2024-10-10 23:14:25 -07:00
nhmall
ac3031932f update tested versions of Visual Studio 2024-10-10 2024-10-10 18:14:57 -04:00
nhmall
a70ad42d22 address Windows windsys.c analyzer complaints
sys/windows/windsys.c(419): warning C6387: 'hMod' could be '0':
  this does not adhere to the specification for the function 'GetProcAddress'.

sys/windows/windsys.c(437): warning C28159:
  Consider using 'GetTickCount64' instead of 'GetTickCount'.
  Reason: GetTickCount overflows roughly every 49 days.  Code that does not
          take that into account can loop indefinitely.
          GetTickCount64 operates on 64 bit values and does not have that
          problem
2024-10-08 11:57:46 -04:00
nhmall
19d8ec6d12 address Windows consoletty.c analyzer complaints
sys/windows/consoletty.c: warning C6388: '&reserved' might not be '0':
  this does not adhere to the specification for the function 'WriteConsoleA'.
sys/windows/consoletty.c(2514): warning C28159:
  Consider using 'IsWindows*' instead of 'GetVersion'. Reason: Deprecated.
Use VerifyVersionInfo* or IsWindows* macros from VersionHelpers.
2024-10-08 11:32:58 -04:00
nhmall
0e68118c53 follow-up: Makefile_utl.vms 2024-10-06 09:02:01 -04:00
nhmall
b61c3e5138 repair msdos cross-compile (take 2) 2024-10-05 17:40:03 -04:00
nhmall
575030548a repair msdos cross-compile 2024-10-05 16:48:52 -04:00
nhmall
fb70aadbb5 improve copy_bytes() maintenance
Remove the copy_bytes() function from files.c and util/recover.c
and place a single copy into hacklib.
2024-10-05 15:55:20 -04:00
nhmall
5af723669e some static analyzer items 2024-10-04 12:34:09 -04:00
G. Branden Robinson
d116052796 Build *roff documents with groff warnings enabled.
...some of them, at any rate.  We shut off (1) warnings provoked by Matt
Bishop's "mn" macro package, and (2) warnings spuriously emitted by
groff 1.23 and previous when "-wall" (or "-ww") is specified.

Also update explanatory comments.
2024-09-14 09:58:12 -05:00
nhmall
33652b8288 remove extraneous script file (Windows) 2024-09-07 10:13:04 -04:00
nhkeni
aa542afe53 Merge branch 'NetHack-3.7' into keni-prefix 2024-09-06 15:07:19 -04:00
nhkeni
6b4173688f Documentation cleanup and streamlining. 2024-09-06 12:44:19 -04:00
nhmall
9a09bcdfc9 remove extraneous change from pr 2024-09-03 12:22:37 -04:00
Peter de Vroomen
fd3b3cfcf9 Fix project for Macos builds with Xcode. Builds for MacOs Sequoia (15) and Xcode 16 beta 3. 2024-09-03 12:18:10 -04:00
nhmall
78042680b8 update tested versions of Visual Studio 2024-09-01 2024-09-01 09:39:56 -04:00
nhkeni
3f2d46823a add nhlua target (for internal use) 2024-08-10 16:25:35 -04:00
nhmall
2ed95119f1 update tested versions of Visual Studio 2024-08-02 2024-08-02 13:24:20 -04:00
nhkeni
90cfeccdfd Merge branch 'NetHack-3.7' into keni-fetchlua 2024-07-29 17:07:17 -04:00
nhmall
4353ee49d8 sed substitution went too far (wasm cross-compile)
Also, link with hacklib
2024-07-28 12:27:02 -04:00
nhkeni
93ece2c9b4 update fetch-lua-TARGET targets 2024-07-27 18:24:41 -04:00