do not use the NONNULLxxx macros with djgpp [cross]compiler

For now, this will prevent the NONNULLxxx arguments from being
defined under a djgpp compiler or crosscompiler.

paxed reported a segfault under msdos:

nethack.exe
Exiting due to signal SIGSEGV
Page fault at eip=000c3f8c, error=0004
eax=00000000 ebx=00000000 ecx=00000000 edx=0000000f esi=00000000 edi=00000001
ebp=00589988 esp=00589970 program=C:\NH370\NETHACK.EXE
cs: sel=00a7  base=00400000  limit=0063ffff
ds: sel=00af  base=00400000  limit=0063ffff
es: sel=00af  base=00400000  limit=0063ffff
fs: sel=008f  base=00001a20  limit=0000ffff
gs: sel=00bf  base=00000000  limit=0010ffff
ss: sel=00af  base=00400000  limit=0063ffff
App stack: [00589ba8..00389ba8]  Exceptn stack: [00389af4..00387bb4]

Call frame traceback EIPs:
  0x000c3f8c _read_config_file+19
  0x0017619f _initoptions_finish+577
  0x00176371 _initoptions+157
  0x0025cec4 _pcmain+365
  0x0025d8d9 _main+41

He was able to 'git bisect' to the macro definitions change,
and confirmed that the segfault no longer occurs after this commit.

There may be further investigation on this later.
This commit is contained in:
nhmall
2023-12-18 11:52:16 -05:00
parent c0fdb2e8c4
commit 088717ccec

View File

@@ -373,6 +373,10 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
#define DO_DEFINE_NONNULLS
#endif
#if defined(__DJGPP__) && defined(DO_DEFINE_NONNULLS)
#undef DO_DEFINE_NONNULLS
#endif
#if defined(DO_DEFINE_NONNULLS) && !defined(NONNULLS_DEFINED)
#define NONNULL __attribute__((returns_nonnull))
#define NONNULLPTRS __attribute__((nonnull))