From df84da3ec2f38460e137a4bdfb25148262d544c2 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 7 Mar 2019 17:12:01 -0800 Subject: [PATCH] vms update Suppress Isaac64 on VAX were there isn't an easy way to do 64-bit arithmetic. (Hard way isn't worth it for just an alternate RNG.) Eliminate or suppress some diagnostics: 1) In strict ANSI mode, DEC C was reporting that '$' in identifier is an extension (one time for each file in sys/vms/*.c). (It doesn't do that for the default 'relaxed ANSI' mode.) 2) DEC C uses WIDENED_PROTOTYPES but widens uchar (unsigned char) differently depending upon the mode it is operating in. (Applies to Unix as well as VMS; based on documentation rather than testing.) Update the comment in tradstdc.h about WIDENED vs UNWIDENED_PROTOTYPES. An old comment in config1.h about a problem with the earliest version of DEC C was probably based on an incorrect assumption of what was really going, but I have no way to go back in time to verify that.... --- include/config1.h | 10 ++++++---- include/tradstdc.h | 20 +++++++++++++------- include/unixconf.h | 9 ++++++++- include/vmsconf.h | 34 ++++++++++++++++++++++++++++++---- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/include/config1.h b/include/config1.h index 738fd96fa..ee9e5c921 100644 --- a/include/config1.h +++ b/include/config1.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 config1.h $NHDT-Date: 1432512781 2015/05/25 00:13:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */ +/* NetHack 3.6 config1.h $NHDT-Date: 1552007489 2019/03/08 01:11:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -146,7 +146,9 @@ #undef UNIX #ifdef __DECC #ifndef __DECC_VER /* buggy early versions want widened prototypes */ -#define NOTSTDC /* except when typedefs are involved */ +#define NOTSTDC /* except when typedefs are involved */ + /* [25 or so years later... That was probably uchar widening to */ + /* 'unsigned int' rather than anything to do with typedefs. pr] */ #define USE_VARARGS #else #define NHSTDC @@ -200,10 +202,10 @@ /* Because: * #define FOO => FOO={} => defined( ) => (-1 != - - 1) => 1 * #define FOO 1 or on command-line -DFOO - * => defined(1) => (-1 != - 1 - 1) => 1 + * => defined(1) => (-1 != - 1 - 1) => 1 * if FOO isn't defined, FOO=0. But some compilers default to 0 instead of 1 * for -DFOO, oh well. - * => defined(0) => (-1 != - 0 - 1) => 0 + * => defined(0) => (-1 != - 0 - 1) => 0 * * But: * defined("") => (-1 != - "" - 1) diff --git a/include/tradstdc.h b/include/tradstdc.h index 468ebdea8..881787235 100644 --- a/include/tradstdc.h +++ b/include/tradstdc.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 tradstdc.h $NHDT-Date: 1545270756 2018/12/20 01:52:36 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.34 $ */ +/* NetHack 3.6 tradstdc.h $NHDT-Date: 1552007504 2019/03/08 01:11:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -278,12 +278,16 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #endif /* - * According to ANSI, prototypes for old-style declarations must widen the - * arguments to int. However, the MSDOS compilers accept shorter arguments - * (char, short, etc.) in prototypes and do typechecking with them. Therefore - * this mess to allow the better typechecking while also allowing some - * prototypes for the ANSI compilers so people quit trying to fix the - * prototypes to match the standard and thus lose the typechecking. + * According to ANSI C, prototypes for old-style function definitions like + * int func(arg) short arg; { ... } + * must specify widened arguments (char and short to int, float to double), + * int func(int); + * same as how narrow arguments get passed when there is no prototype info. + * However, various compilers accept shorter arguments (char, short, etc.) + * in prototypes and do typechecking with them. Therefore this mess to + * allow the better typechecking while also allowing some prototypes for + * the ANSI compilers so people quit trying to fix the prototypes to match + * the standard and thus lose the typechecking. */ #if defined(MSDOS) && !defined(__GO32__) #define UNWIDENED_PROTOTYPES @@ -332,7 +336,9 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #ifdef WIDENED_PROTOTYPES #define CHAR_P int #define SCHAR_P int +#ifndef UCHAR_P #define UCHAR_P int +#endif #define XCHAR_P int #define SHORT_P int #define BOOLEAN_P int diff --git a/include/unixconf.h b/include/unixconf.h index 9b5abeed3..63dbddcae 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 unixconf.h $NHDT-Date: 1550532737 2019/02/18 23:32:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.39 $ */ +/* NetHack 3.6 unixconf.h $NHDT-Date: 1552007506 2019/03/08 01:11:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.40 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -271,6 +271,13 @@ #endif #endif +/* Digital Unix/HP Tru64 -- see vmsconf.h for explanation */ +#if defined(__DECC) && (!defined(__STDC__) || !__STDC__) +#define UCHAR_P unsigned int +#else +#define UCHAR_P int +#endif + /* * BSD/ULTRIX systems are normally the only ones that can suspend processes. * Suspending NetHack processes cleanly should be easy to add to other systems diff --git a/include/vmsconf.h b/include/vmsconf.h index 40cde73a0..da77be35a 100644 --- a/include/vmsconf.h +++ b/include/vmsconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 vmsconf.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */ +/* NetHack 3.6 vmsconf.h $NHDT-Date: 1552007507 2019/03/08 01:11:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.28 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -160,6 +160,12 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then #define RANDOM /* use sys/share/random.c instead of vaxcrtl rand */ +/* config.h defines USE_ISAAC64; we'll use it on Alpha or IA64 but not VAX; + it overrides RANDOM */ +#if (defined(VAX) || defined(vax) || defined(__vax)) && defined(USE_ISAAC64) +#undef ISAAC64 +#endif + #define FCMASK 0660 /* file creation mask */ /* @@ -186,6 +192,21 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then #endif #endif +/* ANSI C uses "value preserving rules", where 'unsigned char' and + 'unsigned short' promote to 'int' if signed int is big enough to hold + all possible values, rather than traditional "sign preserving rules" + where 'unsigned char' and 'unsigned short' promote to 'unsigned int'. + However, the ANSI C rules aren't binding on non-ANSI compilers. + When DEC C (aka Compaq C, then HP C) is in non-standard 'common' mode + it supports prototypes that expect widened types, but it uses the old + sign preserving rules for how to widen narrow unsigned types. (In its + default 'relaxed' mode, __STDC__ is 1 and uchar widens to 'int'.) */ +#if defined(__DECC) && (!defined(__STDC__) || !__STDC__) +#define UCHAR_P unsigned int +#else +#define UCHAR_P int +#endif + #ifdef __DECC #define STRICT_REF_DEF /* used in lev_main.c */ #endif @@ -237,6 +258,12 @@ typedef __mode_t mode_t; #define tgetch vms_getchar +#if defined(__DECC_VER) && (__DECC_VER >= 50000000) + /* for cc/Standard=ANSI89, suppress notification that '$' in identifiers + is an extension; sys/vms/*.c needs it regardless of strict ANSI mode */ + #pragma message disable DOLLARID +#endif + #include "system.h" #define index strchr @@ -247,8 +274,7 @@ typedef __mode_t mode_t; # if defined(RANDOM) # define Rand() random() /* VMS V7 adds these entry points to DECC$SHR; stick with the nethack-supplied - code to avoid having to deal with version-specific conditionalized builds - */ + code to avoid having to deal with version-specific conditionalized builds */ # define random nh_random # define srandom nh_srandom # define initstate nh_initstate @@ -270,7 +296,7 @@ typedef __mode_t mode_t; #define link(f1, f2) vms_link(f1, f2) /* vmsfiles.c */ #define open(f, k, m) vms_open(f, k, m) /* vmsfiles.c */ #define fopen(f, m) vms_fopen(f, m) /* vmsfiles.c */ -/* #define unlink(f0) vms_unlink(f0) /* vmsfiles.c */ +/* #define unlink(f0) vms_unlink(f0) /* vmsfiles.c */ #ifdef VERYOLD_VMS #define unlink(f0) delete (f0) /* vaxcrtl */ #else -- 2.40.0