xNetHack icon indicating copy to clipboard operation
xNetHack copied to clipboard

Needs old compat code stripped out

Open clausecker opened this issue 3 years ago • 6 comments

The file hacklib.c currently has a lot of code guarded with defined(BSD) that makes various functions use long for time stamps instead of time_t. However, this hasn't been the case for decades. Please fix the code by discarding the BSD special code path.

This was first noticed in by a compiler warning:

hacklib.c:1146:24: warning: incompatible pointer types passing 'long *' to parameter of type 'const time_t *' (aka 'const long long *') [-Wincompatible-pointer-types]
        lt = localtime((long *) (&date));
                       ^~~~~~~~~~~~~~~~
../include/system.h:541:38: note: passing argument to parameter here
E struct tm *localtime(const time_t *);
                                     ^

There are probably more issues coming from this.

clausecker avatar Jul 31 '22 21:07 clausecker

This should probably be reported on the main NetHack/NetHack repo (or by email to [email protected]) since it's not specific to xNetHack. It'd be more appropriately fixed upstream I think.

entrez avatar Jul 31 '22 21:07 entrez

@entrez I have been instructed by aosdict on the IRC channel to file a bug report for this here. I am not interested in chasing after this any more, so feel free to report this to the Nethack dev team yourself.

clausecker avatar Jul 31 '22 21:07 clausecker

Oh, well, @copperwater knows better than I do what is inherited or changed from vanilla NetHack, so if he says it should go here I won't meddle any further. :)

entrez avatar Jul 31 '22 21:07 entrez

When I said to submit a PR for it, I had assumed this issue only existed in NetHack code. If it exists upstream, it should indeed be reported to the DevTeam and fixed there. If you want, I can copy paste your first post as an issue there.

copperwater avatar Aug 08 '22 14:08 copperwater

@copperwater It would be nice if you could do that. I have never interacted with the upstream dev team before.

clausecker avatar Aug 08 '22 17:08 clausecker

Should be fixed by https://github.com/NetHack/NetHack/commit/e815498f074f804dcc6c4f789ccdb7cec80b0e56, when xNetHack next merges it. Up to you @clausecker if you want to close this or wait until that vanilla merge happens (probably version 8.0 release).

copperwater avatar Sep 01 '22 03:09 copperwater

Now that vanilla has been merged, this should be taken care of. Please reopen if that's not the case somehow.

copperwater avatar May 16 '23 22:05 copperwater