more C standard progress

There was a transcription error in the comments in cstd.h for
the standard list of header files, where only the description
remained for <stdlib.h>, not the name of the file itself.

Remove several extraneous inclusions of the standard C99 headers.

Tested on the following afterwards:
Linux (using hints/linux.370) including tty, curses, qt6, and X11
macOS (using hints/macOS.370) including tty, curses, qt5, and X11
Windows MSYS2 using sys/windows/GNUmakefile
Windows Visual Studio using sys/windows/Makefile.nmake
msdos cross-compile on Ubuntu using djgpp cross-compiler
This commit is contained in:
nhmall
2024-12-20 10:32:38 -05:00
parent 837da48621
commit 45b2a6c49a
40 changed files with 25 additions and 86 deletions
+8 -4
View File
@@ -27,9 +27,9 @@
* <stddef.h> Common macro definitions * <stddef.h> Common macro definitions
* <stdint.h> (C99) Fixed-width integer types * <stdint.h> (C99) Fixed-width integer types
* <stdio.h> Input/output program utilities * <stdio.h> Input/output program utilities
* * <stdlib.h> General utilities: memory management,
* General utilities: memory management, program utilities, string * program utilities, string conversions,
* conversions, random numbers, algorithms * random numbers, algorithms
* <string.h> String handling * <string.h> String handling
* <tgmath.h> (C99) Type-generic math (macros wrapping math.h and * <tgmath.h> (C99) Type-generic math (macros wrapping math.h and
* complex.h) * complex.h)
@@ -51,13 +51,17 @@
* *
*/ */
#if !defined(__cplusplus) #if !defined(__cplusplus)
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h> #include <ctype.h>
#include <time.h>
#else /* !__cplusplus */
/* for FILE */
#include <stdio.h>
#endif /* !__cplusplus */ #endif /* !__cplusplus */
#endif /* CSTD_H */ #endif /* CSTD_H */
-2
View File
@@ -6,8 +6,6 @@
#ifndef GLOBAL_H #ifndef GLOBAL_H
#define GLOBAL_H #define GLOBAL_H
#include <stdio.h>
/* /*
* Files expected to exist in the playground directory (possibly inside * Files expected to exist in the playground directory (possibly inside
* a dlb container file). * a dlb container file).
-16
View File
@@ -111,33 +111,21 @@
#if defined(_MSC_VER) && (_MSC_VER >= 7) #if defined(_MSC_VER) && (_MSC_VER >= 7)
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h>
#ifdef strcmpi #ifdef strcmpi
#undef strcmpi #undef strcmpi
#endif #endif
#include <string.h> /* Provides prototypes of strncmpi(), etc. */
#include <conio.h> #include <conio.h>
#include <io.h> #include <io.h>
#include <direct.h> #include <direct.h>
#define SIG_RET_TYPE void(__cdecl *)(int) #define SIG_RET_TYPE void(__cdecl *)(int)
#define M(c) ((char) (0x80 | (c)))
#define vprintf printf #define vprintf printf
#define vfprintf fprintf #define vfprintf fprintf
#define vsprintf sprintf #define vsprintf sprintf
#endif #endif
#if defined(__BORLANDC__) && defined(STRNCMPI)
#include <string.h> /* Provides prototypes of strncmpi(), etc. */
#endif
#if defined(__DJGPP__)
#define _NAIVE_DOS_REGS
#include <stdlib.h>
#include <string.h> /* Provides prototypes of strncmpi(), etc. */
#ifndef M #ifndef M
#define M(c) ((char) (0x80 | (c))) #define M(c) ((char) (0x80 | (c)))
#endif #endif
#endif
/* /*
* On the VMS and unix, this option controls whether a delay is done by * On the VMS and unix, this option controls whether a delay is done by
@@ -226,10 +214,6 @@
#define HLOCK "NHPERM" #define HLOCK "NHPERM"
#endif #endif
#ifndef AMIGA
#include <time.h>
#endif
/* the high quality random number routines */ /* the high quality random number routines */
#ifndef USE_ISAAC64 #ifndef USE_ISAAC64
# ifdef RANDOM # ifdef RANDOM
-5
View File
@@ -302,8 +302,6 @@
#if defined(BSD) || defined(ULTRIX) #if defined(BSD) || defined(ULTRIX)
#include <sys/time.h> #include <sys/time.h>
#else
#include <time.h>
#endif #endif
/* these might be needed for include/system.h; /* these might be needed for include/system.h;
@@ -324,10 +322,7 @@
#define SHELL /* do not delete the '!' command */ #define SHELL /* do not delete the '!' command */
#endif #endif
/* #include "system.h" */
#if defined(POSIX_TYPES) || defined(__GNUC__) #if defined(POSIX_TYPES) || defined(__GNUC__)
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
-3
View File
@@ -213,7 +213,6 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then
#include <types.h> #include <types.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <stat.h> #include <stat.h>
#include <errno.h> #include <errno.h>
@@ -246,8 +245,6 @@ typedef int32_t off_t;
#endif #endif
#endif /* _DECC_V4_SOURCE */ #endif /* _DECC_V4_SOURCE */
#include <time.h>
#ifndef VMSVSI #ifndef VMSVSI
#if 0 /* <file.h> is missing for old gcc versions; skip it to save time */ #if 0 /* <file.h> is missing for old gcc versions; skip it to save time */
#include <file.h> #include <file.h>
-6
View File
@@ -165,8 +165,6 @@ typedef SSIZE_T ssize_t;
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#undef randomize #undef randomize
#undef random #undef random
@@ -185,10 +183,6 @@ typedef SSIZE_T ssize_t;
#endif #endif
#define NO_SIGNAL #define NO_SIGNAL
/* Time stuff */
#include <time.h>
#define USE_STDARG #define USE_STDARG
/* Use the high quality random number routines. */ /* Use the high quality random number routines. */
-1
View File
@@ -6,7 +6,6 @@
/* various code that was replicated in *main.c */ /* various code that was replicated in *main.c */
#include "hack.h" #include "hack.h"
#include <ctype.h>
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
#include <signal.h> #include <signal.h>
-1
View File
@@ -5,7 +5,6 @@
/* attribute modification routines. */ /* attribute modification routines. */
#include "hack.h" #include "hack.h"
#include <ctype.h>
/* part of the output on gain or loss of attribute */ /* part of the output on gain or loss of attribute */
static const char static const char
-1
View File
@@ -3,7 +3,6 @@
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include "hack.h" #include "hack.h"
#include <ctype.h>
struct color_names { struct color_names {
const char *name; const char *name;
-1
View File
@@ -9,7 +9,6 @@
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
#include <signal.h> #include <signal.h>
#endif #endif
#include <ctype.h>
#ifndef LONG_MAX #ifndef LONG_MAX
#include <limits.h> #include <limits.h>
#endif #endif
-2
View File
@@ -7,7 +7,6 @@
#include "hack.h" #include "hack.h"
#include "dlb.h" #include "dlb.h"
#include <ctype.h>
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
#include "wintty.h" /* more() */ #include "wintty.h" /* more() */
@@ -45,7 +44,6 @@ const
#if defined(UNIX) && defined(SELECTSAVED) #if defined(UNIX) && defined(SELECTSAVED)
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <stdlib.h>
#endif #endif
#if defined(UNIX) || defined(VMS) || !defined(NO_SIGNAL) #if defined(UNIX) || defined(VMS) || !defined(NO_SIGNAL)
-2
View File
@@ -5,8 +5,6 @@
#include "hack.h" #include "hack.h"
#include <ctype.h>
/* this assumes that a human quest leader or nemesis is an archetype /* this assumes that a human quest leader or nemesis is an archetype
of the corresponding role; that isn't so for some roles (tourist of the corresponding role; that isn't so for some roles (tourist
for instance) but is for the priests and monks we use it for... */ for instance) but is for the priests and monks we use it for... */
-1
View File
@@ -5,7 +5,6 @@
#include "hack.h" #include "hack.h"
#include "mfndpos.h" #include "mfndpos.h"
#include <ctype.h>
staticfn void sanity_check_single_mon(struct monst *, boolean, const char *); staticfn void sanity_check_single_mon(struct monst *, boolean, const char *);
staticfn struct obj *make_corpse(struct monst *, unsigned); staticfn struct obj *make_corpse(struct monst *, unsigned);
-1
View File
@@ -9,7 +9,6 @@
# ifndef NO_SIGNAL # ifndef NO_SIGNAL
#include <signal.h> #include <signal.h>
# endif # endif
#include <ctype.h>
# ifndef LONG_MAX # ifndef LONG_MAX
#include <limits.h> #include <limits.h>
# endif # endif
-1
View File
@@ -3,7 +3,6 @@
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include "hack.h" #include "hack.h"
#include <ctype.h>
#ifdef ENHANCED_SYMBOLS #ifdef ENHANCED_SYMBOLS
-1
View File
@@ -8,7 +8,6 @@
#include "hack.h" #include "hack.h"
#include "dlb.h" #include "dlb.h"
#include <ctype.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <signal.h> #include <signal.h>
#include <pwd.h> #include <pwd.h>
+2 -9
View File
@@ -458,18 +458,11 @@ endif
INCLDIR=$(PDCINCL) -I../include -I../sys/msdos $(LUAINCL) INCLDIR=$(PDCINCL) -I../include -I../sys/msdos $(LUAINCL)
# Debugging # Debugging
#cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS #cflags = -pg -c -D_NAIVE_DOS_REGS $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
#LFLAGS = -pg #LFLAGS = -pg
cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
LFLAGS =
# Debugging
#cflags = -g -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP
#LFLAGS = -g
# Normal # Normal
cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP cflags = -c -O -D_NAIVE_DOS_REGS $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP
LFLAGS = LFLAGS =
#========================================== #==========================================
-1
View File
@@ -15,7 +15,6 @@
#include "pcvideo.h" #include "pcvideo.h"
#include <dos.h> #include <dos.h>
#include <ctype.h>
/* /*
* MS-DOS functions * MS-DOS functions
-4
View File
@@ -18,10 +18,6 @@
#include "pctiles.h" #include "pctiles.h"
/* #include <dos.h> */ /* #include <dos.h> */
#ifndef MONITOR_HEAP
#include <stdlib.h>
#endif
#include <time.h>
#ifdef __GO32__ #ifdef __GO32__
#include <unistd.h> #include <unistd.h>
-1
View File
@@ -105,7 +105,6 @@ void g_pututf8(uint8 *utf8str)
#ifdef NO_TERMS #ifdef NO_TERMS
#include <ctype.h>
#include "wintty.h" #include "wintty.h"
#ifdef __GO32__ #ifdef __GO32__
-1
View File
@@ -18,7 +18,6 @@
#include "wintty.h" #include "wintty.h"
#include <dos.h> #include <dos.h>
#include <ctype.h>
#if defined(_MSC_VER) #if defined(_MSC_VER)
#if _MSC_VER >= 700 #if _MSC_VER >= 700
-1
View File
@@ -14,7 +14,6 @@
#include "font.h" #include "font.h"
#include <dos.h> #include <dos.h>
#include <ctype.h>
#include "wintty.h" #include "wintty.h"
#ifdef __GO32__ #ifdef __GO32__
-2
View File
@@ -12,8 +12,6 @@
#include <signal.h> #include <signal.h>
#endif #endif
#include <ctype.h>
#if !defined(AMIGA) && !defined(__DJGPP__) #if !defined(AMIGA) && !defined(__DJGPP__)
#include <sys\stat.h> #include <sys\stat.h>
#else #else
-1
View File
@@ -10,7 +10,6 @@
#include "hack.h" #include "hack.h"
#include "wintty.h" #include "wintty.h"
#include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#if !defined(MSDOS) && !defined(WIN_CE) && !defined(CROSS_TO_AMIGA) #if !defined(MSDOS) && !defined(WIN_CE) && !defined(CROSS_TO_AMIGA)
#include <process.h> #include <process.h>
+8 -2
View File
@@ -79,8 +79,14 @@ ifeq "$(WANT_DEBUG)" "1"
pwd; echo "$(GDBEXE) not found and WANT_DEBUG=1 specified"; \ pwd; echo "$(GDBEXE) not found and WANT_DEBUG=1 specified"; \
fi; ) fi; )
else else
-rm $(TARGETPFX)pkg/GDB.EXE -( if [ -f $(TARGETPFX)pkg/GDB.EXE ]; \
-rm $(TARGETPFX)pkg/NHGDB.BAT then \
rm $(TARGETPFX)pkg/GDB.EXE; \
fi; )
-( if [ -f $(TARGETPFX)pkg/NHGDB.BAT ]; \
then \
rm $(TARGETPFX)pkg/NHGDB.BAT; \
fi; )
endif endif
-touch $(TARGETPFX)pkg/RECORD -touch $(TARGETPFX)pkg/RECORD
cd $(TARGETPFX)pkg ; zip -9 ../NH370DOS.ZIP * ; cd ../../.. cd $(TARGETPFX)pkg ; zip -9 ../NH370DOS.ZIP * ; cd ../../..
+2
View File
@@ -177,10 +177,12 @@ MSDOS_GPP_CFLAGS = -Wall -Wextra -Wno-missing-field-initializers -Wreturn-type \
MSDOS_TARGET_CFLAGS = -c -O $(DBGFLAGS) -I../include -I../sys/msdos -I../win/share \ MSDOS_TARGET_CFLAGS = -c -O $(DBGFLAGS) -I../include -I../sys/msdos -I../win/share \
$(LUAINCL) -DDLB $(PDCURSESDEF) -DTILES_IN_GLYPHMAP \ $(LUAINCL) -DDLB $(PDCURSESDEF) -DTILES_IN_GLYPHMAP \
-DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \ -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \
-D_NAIVE_DOS_REGS \
$(MSDOS_GCC_CFLAGS) $(MSDOS_GCC_CFLAGS)
MSDOS_TARGET_CXXFLAGS = -c -O $(DBGFLAGS) -I../include -I../sys/msdos -I../win/share \ MSDOS_TARGET_CXXFLAGS = -c -O $(DBGFLAGS) -I../include -I../sys/msdos -I../win/share \
$(LUAINCL) -DDLB $(PDCURSESDEF) \ $(LUAINCL) -DDLB $(PDCURSESDEF) \
-DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \ -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \
-D_NAIVE_DOS_REGS \
$(MSDOS_GPP_CFLAGS) $(MSDOS_GPP_CFLAGS)
PDCINCL += -I$(PDCPORT) PDCINCL += -I$(PDCPORT)
PDC_TARGET_CFLAGS = $(MSDOS_TARGET_CFLAGS) -Wno-unused-parameter \ PDC_TARGET_CFLAGS = $(MSDOS_TARGET_CFLAGS) -Wno-unused-parameter \
-1
View File
@@ -8,7 +8,6 @@
#include "hack.h" #include "hack.h"
#include "dlb.h" #include "dlb.h"
#include <ctype.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <signal.h> #include <signal.h>
#include <pwd.h> #include <pwd.h>
-1
View File
@@ -8,7 +8,6 @@
* routines or substitute for ones where we want behavior modification. * routines or substitute for ones where we want behavior modification.
*/ */
#include "config.h" #include "config.h"
#include <ctype.h>
#ifdef VMSVSI #ifdef VMSVSI
#include <descrip.h> #include <descrip.h>
-1
View File
@@ -20,7 +20,6 @@ struct mail_info *parse_next_broadcast(void);
#ifdef MAIL #ifdef MAIL
#include "wintype.h" #include "wintype.h"
#include "winprocs.h" #include "winprocs.h"
#include <ctype.h>
#include <descrip.h> #include <descrip.h>
#include <errno.h> #include <errno.h>
#ifndef __GNUC__ #ifndef __GNUC__
-1
View File
@@ -29,7 +29,6 @@
#include <stat.h> #include <stat.h>
#undef umask #undef umask
#endif #endif
#include <ctype.h>
extern int debuggable; /* defined in vmsmisc.c */ extern int debuggable; /* defined in vmsmisc.c */
+2
View File
@@ -97,6 +97,8 @@ GCC_EXTRA_WARNINGS = N
# #
#============================================================================== #==============================================================================
$(info Using $(lastword $(MAKEFILE_LIST)))
SKIP_NETHACKW = N SKIP_NETHACKW = N
USE_LUADLL = Y USE_LUADLL = Y
WANT_LUAC = N WANT_LUAC = N
+2 -1
View File
@@ -30,6 +30,8 @@
#error win32api.h should be included first #error win32api.h should be included first
#endif #endif
#include "config.h"
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning(disable : 4142) /* Warning, Benign redefinition of type */ #pragma warning(disable : 4142) /* Warning, Benign redefinition of type */
#pragma pack(8) #pragma pack(8)
@@ -37,7 +39,6 @@
#ifdef DEBUG #ifdef DEBUG
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
-2
View File
@@ -10,8 +10,6 @@
#ifdef DLB #ifdef DLB
#include "dlb.h" #include "dlb.h"
#endif #endif
#include <ctype.h>
#include <stdlib.h>
#include <sys\stat.h> #include <sys\stat.h>
#include <errno.h> #include <errno.h>
#include <ShlObj.h> #include <ShlObj.h>
-1
View File
@@ -20,7 +20,6 @@
#ifndef __BORLANDC__ #ifndef __BORLANDC__
#include <direct.h> #include <direct.h>
#endif #endif
#include <ctype.h>
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
#include "wintty.h" #include "wintty.h"
#endif #endif
+1 -1
View File
@@ -6,7 +6,7 @@
* Routines that define a name-value label widget pair that fit inside a * Routines that define a name-value label widget pair that fit inside a
* form widget. * form widget.
*/ */
#include <stdio.h> /* #include <stdio.h> */
#ifndef SYSV #ifndef SYSV
#define PRESERVE_NO_SYSV /* X11 include files may define SYSV */ #define PRESERVE_NO_SYSV /* X11 include files may define SYSV */
-1
View File
@@ -6,7 +6,6 @@
#include "wintty.h" #include "wintty.h"
#include "func_tab.h" #include "func_tab.h"
#include <ctype.h>
#include <errno.h> #include <errno.h>
#ifdef WIN32 #ifdef WIN32
-1
View File
@@ -11,7 +11,6 @@
#include "cursmisc.h" #include "cursmisc.h"
#include "cursdial.h" #include "cursdial.h"
#include "func_tab.h" #include "func_tab.h"
#include <ctype.h>
#if defined(FILENAME_CMP) && !defined(strcasecmp) #if defined(FILENAME_CMP) && !defined(strcasecmp)
#define strcasecmp FILENAME_CMP #define strcasecmp FILENAME_CMP
-2
View File
@@ -8,8 +8,6 @@
#include "wincurs.h" #include "wincurs.h"
#include "cursinit.h" #include "cursinit.h"
#include <ctype.h>
/* Initialization and startup functions for curses interface */ /* Initialization and startup functions for curses interface */
/* Private declarations */ /* Private declarations */
-1
View File
@@ -8,7 +8,6 @@
#include "wincurs.h" #include "wincurs.h"
#include "cursmesg.h" #include "cursmesg.h"
#include "curswins.h" #include "curswins.h"
#include <ctype.h>
/* defined in sys/<foo>/<foo>tty.c or cursmain.c as last resort; /* defined in sys/<foo>/<foo>tty.c or cursmain.c as last resort;
set up by curses_init_nhwindows() */ set up by curses_init_nhwindows() */
-2
View File
@@ -10,8 +10,6 @@
#include "func_tab.h" #include "func_tab.h"
#include "dlb.h" #include "dlb.h"
#include <ctype.h>
/* Misc. curses interface functions */ /* Misc. curses interface functions */
/* Private declarations */ /* Private declarations */