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

View File

@@ -27,9 +27,9 @@
* <stddef.h> Common macro definitions
* <stdint.h> (C99) Fixed-width integer types
* <stdio.h> Input/output program utilities
*
* General utilities: memory management, program utilities, string
* conversions, random numbers, algorithms
* <stdlib.h> General utilities: memory management,
* program utilities, string conversions,
* random numbers, algorithms
* <string.h> String handling
* <tgmath.h> (C99) Type-generic math (macros wrapping math.h and
* complex.h)
@@ -51,13 +51,17 @@
*
*/
#if !defined(__cplusplus)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <assert.h>
#include <stdarg.h>
#include <ctype.h>
#include <time.h>
#else /* !__cplusplus */
/* for FILE */
#include <stdio.h>
#endif /* !__cplusplus */
#endif /* CSTD_H */

View File

@@ -6,8 +6,6 @@
#ifndef GLOBAL_H
#define GLOBAL_H
#include <stdio.h>
/*
* Files expected to exist in the playground directory (possibly inside
* a dlb container file).

View File

@@ -111,33 +111,21 @@
#if defined(_MSC_VER) && (_MSC_VER >= 7)
#include <sys/types.h>
#include <stdlib.h>
#ifdef strcmpi
#undef strcmpi
#endif
#include <string.h> /* Provides prototypes of strncmpi(), etc. */
#include <conio.h>
#include <io.h>
#include <direct.h>
#define SIG_RET_TYPE void(__cdecl *)(int)
#define M(c) ((char) (0x80 | (c)))
#define vprintf printf
#define vfprintf fprintf
#define vsprintf sprintf
#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
#define M(c) ((char) (0x80 | (c)))
#endif
#endif
/*
* On the VMS and unix, this option controls whether a delay is done by
@@ -226,10 +214,6 @@
#define HLOCK "NHPERM"
#endif
#ifndef AMIGA
#include <time.h>
#endif
/* the high quality random number routines */
#ifndef USE_ISAAC64
# ifdef RANDOM

View File

@@ -302,8 +302,6 @@
#if defined(BSD) || defined(ULTRIX)
#include <sys/time.h>
#else
#include <time.h>
#endif
/* these might be needed for include/system.h;
@@ -324,10 +322,7 @@
#define SHELL /* do not delete the '!' command */
#endif
/* #include "system.h" */
#if defined(POSIX_TYPES) || defined(__GNUC__)
#include <stdlib.h>
#include <unistd.h>
#endif

View File

@@ -213,7 +213,6 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then
#include <types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <signal.h>
#include <stat.h>
#include <errno.h>
@@ -246,8 +245,6 @@ typedef int32_t off_t;
#endif
#endif /* _DECC_V4_SOURCE */
#include <time.h>
#ifndef VMSVSI
#if 0 /* <file.h> is missing for old gcc versions; skip it to save time */
#include <file.h>

View File

@@ -165,8 +165,6 @@ typedef SSIZE_T ssize_t;
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef __BORLANDC__
#undef randomize
#undef random
@@ -185,10 +183,6 @@ typedef SSIZE_T ssize_t;
#endif
#define NO_SIGNAL
/* Time stuff */
#include <time.h>
#define USE_STDARG
/* Use the high quality random number routines. */

View File

@@ -6,7 +6,6 @@
/* various code that was replicated in *main.c */
#include "hack.h"
#include <ctype.h>
#ifndef NO_SIGNAL
#include <signal.h>

View File

@@ -5,7 +5,6 @@
/* attribute modification routines. */
#include "hack.h"
#include <ctype.h>
/* part of the output on gain or loss of attribute */
static const char

View File

@@ -3,7 +3,6 @@
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include <ctype.h>
struct color_names {
const char *name;

View File

@@ -9,7 +9,6 @@
#ifndef NO_SIGNAL
#include <signal.h>
#endif
#include <ctype.h>
#ifndef LONG_MAX
#include <limits.h>
#endif

View File

@@ -7,7 +7,6 @@
#include "hack.h"
#include "dlb.h"
#include <ctype.h>
#ifdef TTY_GRAPHICS
#include "wintty.h" /* more() */
@@ -45,7 +44,6 @@ const
#if defined(UNIX) && defined(SELECTSAVED)
#include <sys/types.h>
#include <dirent.h>
#include <stdlib.h>
#endif
#if defined(UNIX) || defined(VMS) || !defined(NO_SIGNAL)

View File

@@ -5,8 +5,6 @@
#include "hack.h"
#include <ctype.h>
/* this assumes that a human quest leader or nemesis is an archetype
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... */

View File

@@ -5,7 +5,6 @@
#include "hack.h"
#include "mfndpos.h"
#include <ctype.h>
staticfn void sanity_check_single_mon(struct monst *, boolean, const char *);
staticfn struct obj *make_corpse(struct monst *, unsigned);

View File

@@ -9,7 +9,6 @@
# ifndef NO_SIGNAL
#include <signal.h>
# endif
#include <ctype.h>
# ifndef LONG_MAX
#include <limits.h>
# endif

View File

@@ -3,7 +3,6 @@
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include <ctype.h>
#ifdef ENHANCED_SYMBOLS

View File

@@ -8,7 +8,6 @@
#include "hack.h"
#include "dlb.h"
#include <ctype.h>
#include <sys/stat.h>
#include <signal.h>
#include <pwd.h>

View File

@@ -458,18 +458,11 @@ endif
INCLDIR=$(PDCINCL) -I../include -I../sys/msdos $(LUAINCL)
# Debugging
#cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
#cflags = -pg -c -D_NAIVE_DOS_REGS $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
#LFLAGS = -pg
cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
LFLAGS =
# Debugging
#cflags = -g -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP
#LFLAGS = -g
# Normal
cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP
cflags = -c -O -D_NAIVE_DOS_REGS $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP
LFLAGS =
#==========================================

View File

@@ -15,7 +15,6 @@
#include "pcvideo.h"
#include <dos.h>
#include <ctype.h>
/*
* MS-DOS functions

View File

@@ -18,10 +18,6 @@
#include "pctiles.h"
/* #include <dos.h> */
#ifndef MONITOR_HEAP
#include <stdlib.h>
#endif
#include <time.h>
#ifdef __GO32__
#include <unistd.h>

View File

@@ -105,7 +105,6 @@ void g_pututf8(uint8 *utf8str)
#ifdef NO_TERMS
#include <ctype.h>
#include "wintty.h"
#ifdef __GO32__

View File

@@ -18,7 +18,6 @@
#include "wintty.h"
#include <dos.h>
#include <ctype.h>
#if defined(_MSC_VER)
#if _MSC_VER >= 700

View File

@@ -14,7 +14,6 @@
#include "font.h"
#include <dos.h>
#include <ctype.h>
#include "wintty.h"
#ifdef __GO32__

View File

@@ -12,8 +12,6 @@
#include <signal.h>
#endif
#include <ctype.h>
#if !defined(AMIGA) && !defined(__DJGPP__)
#include <sys\stat.h>
#else

View File

@@ -10,7 +10,6 @@
#include "hack.h"
#include "wintty.h"
#include <ctype.h>
#include <fcntl.h>
#if !defined(MSDOS) && !defined(WIN_CE) && !defined(CROSS_TO_AMIGA)
#include <process.h>

View File

@@ -79,8 +79,14 @@ ifeq "$(WANT_DEBUG)" "1"
pwd; echo "$(GDBEXE) not found and WANT_DEBUG=1 specified"; \
fi; )
else
-rm $(TARGETPFX)pkg/GDB.EXE
-rm $(TARGETPFX)pkg/NHGDB.BAT
-( if [ -f $(TARGETPFX)pkg/GDB.EXE ]; \
then \
rm $(TARGETPFX)pkg/GDB.EXE; \
fi; )
-( if [ -f $(TARGETPFX)pkg/NHGDB.BAT ]; \
then \
rm $(TARGETPFX)pkg/NHGDB.BAT; \
fi; )
endif
-touch $(TARGETPFX)pkg/RECORD
cd $(TARGETPFX)pkg ; zip -9 ../NH370DOS.ZIP * ; cd ../../..

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 \
$(LUAINCL) -DDLB $(PDCURSESDEF) -DTILES_IN_GLYPHMAP \
-DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \
-D_NAIVE_DOS_REGS \
$(MSDOS_GCC_CFLAGS)
MSDOS_TARGET_CXXFLAGS = -c -O $(DBGFLAGS) -I../include -I../sys/msdos -I../win/share \
$(LUAINCL) -DDLB $(PDCURSESDEF) \
-DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MSDOS \
-D_NAIVE_DOS_REGS \
$(MSDOS_GPP_CFLAGS)
PDCINCL += -I$(PDCPORT)
PDC_TARGET_CFLAGS = $(MSDOS_TARGET_CFLAGS) -Wno-unused-parameter \

View File

@@ -8,7 +8,6 @@
#include "hack.h"
#include "dlb.h"
#include <ctype.h>
#include <sys/stat.h>
#include <signal.h>
#include <pwd.h>

View File

@@ -8,7 +8,6 @@
* routines or substitute for ones where we want behavior modification.
*/
#include "config.h"
#include <ctype.h>
#ifdef VMSVSI
#include <descrip.h>

View File

@@ -20,7 +20,6 @@ struct mail_info *parse_next_broadcast(void);
#ifdef MAIL
#include "wintype.h"
#include "winprocs.h"
#include <ctype.h>
#include <descrip.h>
#include <errno.h>
#ifndef __GNUC__

View File

@@ -29,7 +29,6 @@
#include <stat.h>
#undef umask
#endif
#include <ctype.h>
extern int debuggable; /* defined in vmsmisc.c */

View File

@@ -97,6 +97,8 @@ GCC_EXTRA_WARNINGS = N
#
#==============================================================================
$(info Using $(lastword $(MAKEFILE_LIST)))
SKIP_NETHACKW = N
USE_LUADLL = Y
WANT_LUAC = N

View File

@@ -30,6 +30,8 @@
#error win32api.h should be included first
#endif
#include "config.h"
#if defined(_MSC_VER)
#pragma warning(disable : 4142) /* Warning, Benign redefinition of type */
#pragma pack(8)
@@ -37,7 +39,6 @@
#ifdef DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif

View File

@@ -10,8 +10,6 @@
#ifdef DLB
#include "dlb.h"
#endif
#include <ctype.h>
#include <stdlib.h>
#include <sys\stat.h>
#include <errno.h>
#include <ShlObj.h>

View File

@@ -20,7 +20,6 @@
#ifndef __BORLANDC__
#include <direct.h>
#endif
#include <ctype.h>
#ifdef TTY_GRAPHICS
#include "wintty.h"
#endif

View File

@@ -6,7 +6,7 @@
* Routines that define a name-value label widget pair that fit inside a
* form widget.
*/
#include <stdio.h>
/* #include <stdio.h> */
#ifndef SYSV
#define PRESERVE_NO_SYSV /* X11 include files may define SYSV */

View File

@@ -6,7 +6,6 @@
#include "wintty.h"
#include "func_tab.h"
#include <ctype.h>
#include <errno.h>
#ifdef WIN32

View File

@@ -11,7 +11,6 @@
#include "cursmisc.h"
#include "cursdial.h"
#include "func_tab.h"
#include <ctype.h>
#if defined(FILENAME_CMP) && !defined(strcasecmp)
#define strcasecmp FILENAME_CMP

View File

@@ -8,8 +8,6 @@
#include "wincurs.h"
#include "cursinit.h"
#include <ctype.h>
/* Initialization and startup functions for curses interface */
/* Private declarations */

View File

@@ -8,7 +8,6 @@
#include "wincurs.h"
#include "cursmesg.h"
#include "curswins.h"
#include <ctype.h>
/* defined in sys/<foo>/<foo>tty.c or cursmain.c as last resort;
set up by curses_init_nhwindows() */

View File

@@ -10,8 +10,6 @@
#include "func_tab.h"
#include "dlb.h"
#include <ctype.h>
/* Misc. curses interface functions */
/* Private declarations */