From 5c62ec2d8f281901a1ee0ffdcac6d8bf7ce4617c Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sat, 5 Nov 2016 16:24:18 -0400 Subject: [PATCH 01/11] Assume ANSI C in modules/src/flt_arith Remove the #include "ansi.h" and always use the prototypes. --- modules/src/flt_arith/flt_arith.h | 26 ++++++++++++-------------- modules/src/flt_arith/flt_misc.h | 10 +++++----- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/modules/src/flt_arith/flt_arith.h b/modules/src/flt_arith/flt_arith.h index bd6ecb157..964c19580 100644 --- a/modules/src/flt_arith/flt_arith.h +++ b/modules/src/flt_arith/flt_arith.h @@ -7,8 +7,6 @@ #ifndef __FLT_INCLUDED__ #define __FLT_INCLUDED__ -#include "ansi.h" - #ifndef arith #define arith long #endif @@ -33,17 +31,17 @@ extern int flt_status; #define FLT_STRLEN 32 /* max length of result of flt_flt2str() */ -_PROTOTYPE(void flt_add, (flt_arith *, flt_arith *, flt_arith *)); -_PROTOTYPE(void flt_sub, (flt_arith *, flt_arith *, flt_arith *)); -_PROTOTYPE(void flt_mul, (flt_arith *, flt_arith *, flt_arith *)); -_PROTOTYPE(void flt_div, (flt_arith *, flt_arith *, flt_arith *)); -_PROTOTYPE(void flt_modf, (flt_arith *, flt_arith *, flt_arith *)); -_PROTOTYPE(int flt_cmp, (flt_arith *, flt_arith *)); -_PROTOTYPE(void flt_str2flt, (char *, flt_arith *)); -_PROTOTYPE(void flt_flt2str, (flt_arith *, char *, int)); -_PROTOTYPE(void flt_arith2flt, (arith, flt_arith *, int)); -_PROTOTYPE(arith flt_flt2arith, (flt_arith *, int)); -_PROTOTYPE(void flt_b64_sft, (struct flt_mantissa *, int)); -_PROTOTYPE(void flt_umin, (flt_arith *)); +void flt_add(flt_arith *, flt_arith *, flt_arith *); +void flt_sub(flt_arith *, flt_arith *, flt_arith *); +void flt_mul(flt_arith *, flt_arith *, flt_arith *); +void flt_div(flt_arith *, flt_arith *, flt_arith *); +void flt_modf(flt_arith *, flt_arith *, flt_arith *); +int flt_cmp(flt_arith *, flt_arith *); +void flt_str2flt(char *, flt_arith *); +void flt_flt2str(flt_arith *, char *, int); +void flt_arith2flt(arith, flt_arith *, int); +arith flt_flt2arith(flt_arith *, int); +void flt_b64_sft(struct flt_mantissa *, int); +void flt_umin(flt_arith *); #endif /* __FLT_INCLUDED__ */ diff --git a/modules/src/flt_arith/flt_misc.h b/modules/src/flt_arith/flt_misc.h index ec850697f..c5cf5a7cf 100644 --- a/modules/src/flt_arith/flt_misc.h +++ b/modules/src/flt_arith/flt_misc.h @@ -21,8 +21,8 @@ #define flt_b64_add _flt_64add #define flt_split _flt_split -_PROTOTYPE(int ucmp, (long, long)); -_PROTOTYPE(void flt_nrm, (flt_arith *)); -_PROTOTYPE(void flt_chk, (flt_arith *)); -_PROTOTYPE(int flt_b64_add, (struct flt_mantissa *, struct flt_mantissa *)); -_PROTOTYPE(void flt_split, (flt_arith *, unsigned short *)); +int ucmp(long, long); +void flt_nrm(flt_arith *); +void flt_chk(flt_arith *); +int flt_b64_add(struct flt_mantissa *, struct flt_mantissa *); +void flt_split(flt_arith *, unsigned short *); From 3bb41d391038f56b74bd5e34a820d31a4dbd658f Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sat, 5 Nov 2016 17:00:24 -0400 Subject: [PATCH 02/11] Switch flt_mantissa fields from long to uint32_t. This seems to fix an error when flt_arith converts a literal double-precision float to IEEE format. For example, 0.5 and 0.75 got converted to slightly below their correct values. My host gcc for amd64 has 64-bit long, but flt_arith needs only 32 bits. The code (at least flt_add.c) can make 32-bit overflows. Such overflows would set the higher bits of a 64-bit long, which might cause problems later. I need to use uint32_t and not int32_t because the code still uses long, and the sign extension from int32_t to long would cause problems. The mantissa represents a value in [0, 2) that can't be negative, so unsigned type is better. Also, signed overflow is undefined behavior in C, so flt_add.c better make overflows with uint32_t and not int32_t. This commit doesn't touch lang/cem/libcc.ansi/stdlib/ext_fmt.h which continues to use unsigned long for its mantissa fields. --- modules/src/flt_arith/flt_arith.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/src/flt_arith/flt_arith.h b/modules/src/flt_arith/flt_arith.h index 964c19580..9a21e5135 100644 --- a/modules/src/flt_arith/flt_arith.h +++ b/modules/src/flt_arith/flt_arith.h @@ -7,13 +7,15 @@ #ifndef __FLT_INCLUDED__ #define __FLT_INCLUDED__ +#include + #ifndef arith #define arith long #endif struct flt_mantissa { - long flt_h_32; /* high order 32 bits of mantissa */ - long flt_l_32; /* low order 32 bits of mantissa */ + uint32_t flt_h_32; /* high order 32 bits of mantissa */ + uint32_t flt_l_32; /* low order 32 bits of mantissa */ }; typedef struct flt_arith { From daeeb5aca3a18ff8e240a534bad1f0941523cf9c Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sat, 5 Nov 2016 21:29:03 -0400 Subject: [PATCH 03/11] Simplify flt_arith now that mantissa uses uint32_t. It seems that someone wanted to build flt_arith with a compiler that had long but not unsigned long. This required extra code to accomplish unsigned right shift, unsigned division, and unsigned comparison using the signed operations. Now that we use uint32_t, we can simply use the unsigned operations and remove the ucmp() function. We have similar code in mach/proto/fp/ and in lang/cem/libcc.ansi/stdlib/ext_comp.c where we use the unsigned operations. Some long variables become uint32_t, and some masks with 0xFFFFFFFF disappear because uint32_t has only 32 bits. Update flt_arith.3 to show that mantissa uses uint32_t. Provide a target to install modules/src/flt_arith/test.c as flt_test so I can run the tests. --- modules/src/flt_arith/b64_add.c | 10 +++---- modules/src/flt_arith/b64_sft.c | 15 ++++------ modules/src/flt_arith/build.lua | 15 +++++++++- modules/src/flt_arith/flt_add.c | 9 +++--- modules/src/flt_arith/flt_arith.3 | 4 +-- modules/src/flt_arith/flt_div.c | 47 +++++++++++++------------------ modules/src/flt_arith/flt_misc.h | 2 -- modules/src/flt_arith/flt_mul.c | 13 +++++---- modules/src/flt_arith/flt_nrm.c | 5 ++-- modules/src/flt_arith/test.c | 5 +++- modules/src/flt_arith/ucmp.c | 21 -------------- 11 files changed, 64 insertions(+), 82 deletions(-) delete mode 100644 modules/src/flt_arith/ucmp.c diff --git a/modules/src/flt_arith/b64_add.c b/modules/src/flt_arith/b64_add.c index ca03e84a0..71bd66607 100644 --- a/modules/src/flt_arith/b64_add.c +++ b/modules/src/flt_arith/b64_add.c @@ -5,6 +5,7 @@ /* $Id$ */ +#include #include "flt_misc.h" int @@ -15,16 +16,15 @@ flt_b64_add(e1,e2) int carry; /* add higher pair of 32 bits */ - overflow = ucmp((long)0xFFFFFFFF - e1->flt_h_32, e2->flt_h_32) < 0; + overflow = (0xFFFFFFFFUL - e1->flt_h_32 < e2->flt_h_32); e1->flt_h_32 += e2->flt_h_32; /* add lower pair of 32 bits */ - carry = ucmp((long)0xFFFFFFFF - e1->flt_l_32, e2->flt_l_32) < 0; + carry = (0xFFFFFFFFUL - e1->flt_l_32 < e2->flt_l_32); e1->flt_l_32 += e2->flt_l_32; - if ((carry) && ((++e1->flt_h_32 &~0xFFFFFFFF) || e1->flt_h_32 == 0)) { - e1->flt_h_32 = 0; + if ((carry) && (++e1->flt_h_32 == 0)) return(1); /* had a 64 bit overflow */ - } + return(overflow); /* return status from higher add */ } diff --git a/modules/src/flt_arith/b64_sft.c b/modules/src/flt_arith/b64_sft.c index f891c6936..ef6d74a9e 100644 --- a/modules/src/flt_arith/b64_sft.c +++ b/modules/src/flt_arith/b64_sft.c @@ -23,12 +23,10 @@ flt_b64_sft(e,n) n -= 32; } if (n > 0) { - e->flt_l_32 = (e->flt_l_32 >> 1) & 0x7FFFFFFF; - e->flt_l_32 >>= (n - 1); + e->flt_l_32 >>= n; if (e->flt_h_32 != 0) { - e->flt_l_32 |= (e->flt_h_32 << (32 - n)) & 0xFFFFFFFF; - e->flt_h_32 = (e->flt_h_32 >> 1) & 0x7FFFFFFF; - e->flt_h_32 >>= (n - 1); + e->flt_l_32 |= (e->flt_h_32 << (32 - n)); + e->flt_h_32 >>= n; } } n = -n; @@ -38,11 +36,10 @@ flt_b64_sft(e,n) n -= 32; } if (n > 0) { - e->flt_h_32 = (e->flt_h_32 << n) & 0xFFFFFFFF; + e->flt_h_32 <<= n; if (e->flt_l_32 != 0) { - long l = (e->flt_l_32 >> 1) & 0x7FFFFFFF; - e->flt_h_32 |= (l >> (31 - n)); - e->flt_l_32 = (e->flt_l_32 << n) & 0xFFFFFFFF; + e->flt_h_32 |= (e->flt_l_32 >> (32 - n)); + e->flt_l_32 <<= n; } } } diff --git a/modules/src/flt_arith/build.lua b/modules/src/flt_arith/build.lua index e6ac2dd40..54aa3b097 100644 --- a/modules/src/flt_arith/build.lua +++ b/modules/src/flt_arith/build.lua @@ -15,7 +15,6 @@ clibrary { "./flt_umin.c", "./flt_chk.c", "./split.c", - "./ucmp.c", }, hdrs = { "./flt_arith.h" }, deps = { @@ -24,4 +23,18 @@ clibrary { } } +-- The test program isn't built by default. Here is a target +-- modules/src/flt_arith+pkg to install it as flt_test +cprogram { + name = "test", + srcs = { "./test.c" }, + deps = { "+lib" }, +} + +installable { + name = "pkg", + map = { + ["$(INSDIR)/bin/flt_test"] = "+test", + }, +} diff --git a/modules/src/flt_arith/flt_add.c b/modules/src/flt_arith/flt_add.c index d9d4d57c5..ca9830ec3 100644 --- a/modules/src/flt_arith/flt_add.c +++ b/modules/src/flt_arith/flt_add.c @@ -44,11 +44,10 @@ flt_add(e1,e2,e3) } if (e1->flt_sign != e2->flt_sign) { /* e2 + e1 = e2 - (-e1) */ - int tmp = ucmp(e1->m1, e2->m1); - int tmp2 = ucmp(e1->m2, e2->m2); - if (tmp > 0 || (tmp == 0 && tmp2 > 0)) { + if (e1->m1 > e2->m1 || + (e1->m1 == e2->m1 && e1->m2 > e2->m2)) { /* abs(e1) > abs(e2) */ - if (tmp2 < 0) { + if (e1->m2 < e2->m2) { e1->m1 -= 1; /* carry in */ } e1->m1 -= e2->m1; @@ -56,7 +55,7 @@ flt_add(e1,e2,e3) *e3 = *e1; } else { - if (tmp2 > 0) + if (e1->m2 > e2->m2) e2->m1 -= 1; /* carry in */ e2->m1 -= e1->m1; e2->m2 -= e1->m2; diff --git a/modules/src/flt_arith/flt_arith.3 b/modules/src/flt_arith/flt_arith.3 index 2e6a5feb1..91bce44ea 100644 --- a/modules/src/flt_arith/flt_arith.3 +++ b/modules/src/flt_arith/flt_arith.3 @@ -9,8 +9,8 @@ flt_arith \- high precision floating point arithmetic .if t .ta 3m 13m 22m .if n .ta 5m 25m 40m struct flt_mantissa { - long flt_h_32; /* high order 32 bits of mantissa */ - long flt_l_32; /* low order 32 bits of mantissa */ + uint32_t flt_h_32; /* high order 32 bits of mantissa */ + uint32_t flt_l_32; /* low order 32 bits of mantissa */ }; typedef struct { diff --git a/modules/src/flt_arith/flt_div.c b/modules/src/flt_arith/flt_div.c index 11b74c0e1..3295fe63b 100644 --- a/modules/src/flt_arith/flt_div.c +++ b/modules/src/flt_arith/flt_div.c @@ -5,14 +5,15 @@ /* $Id$ */ +#include #include "flt_misc.h" void flt_div(e1,e2,e3) register flt_arith *e1,*e2,*e3; { - long result[2]; - register long *lp; + uint32_t result[2]; + register uint32_t *rp; unsigned short u[9], v[5]; register int j; register unsigned short *u_p = u; @@ -44,7 +45,7 @@ flt_div(e1,e2,e3) while (! v[maxv]) maxv--; result[0] = 0; result[1] = 0; - lp = result; + rp = result; /* * Use an algorithm of Knuth (The art of programming, Seminumerical @@ -52,35 +53,25 @@ flt_div(e1,e2,e3) * with base 65536. */ for (j = 0; j <= 3; j++, u_p++) { - long q_est, temp; - long v1 = v[1]; + uint32_t q_est, temp; - if (j == 2) lp++; + if (j == 2) rp++; if (u_p[0] == 0 && u_p[1] < v[1]) continue; - temp = ((long)u_p[0] << 16) + u_p[1]; + temp = ((uint32_t)u_p[0] << 16) + u_p[1]; if (u_p[0] >= v[1]) { - q_est = 0x0000FFFFL; + q_est = 0x0000FFFFUL; } else if (v[1] == 1) { q_est = temp; } - else if (temp >= 0) { - q_est = temp / v1; - } else { - long rem; - q_est = (0x7FFFFFFF/v1)+((temp&0x7FFFFFFF)/v1); - rem = (0x7FFFFFFF%v1)+((temp&0x7FFFFFFF)%v1)+1; - while (rem >= v1) { - q_est++; - rem -= v1; - } + q_est = temp / v[1]; } - temp -= q_est * v1; + temp -= q_est * v[1]; while (!(temp&0xFFFF0000) && - ucmp((long)v[2]*q_est,(temp<<16)+(long)u_p[2]) > 0) { + v[2]*q_est > (temp<<16)+u_p[2]) { q_est--; - temp += v1; + temp += v[1]; } /* Now, according to Knuth, we have an estimate of the quotient, that is either correct or one too big, but @@ -88,11 +79,11 @@ flt_div(e1,e2,e3) */ if (q_est != 0) { int i; - long k = 0; + uint32_t k = 0; int borrow = 0; for (i = maxv; i > 0; i--) { - long tmp = q_est * (long)v[i] + k + borrow; + uint32_t tmp = q_est * v[i] + k + borrow; unsigned short md = tmp & 0xFFFF; borrow = (md > u_p[i]); @@ -100,7 +91,7 @@ flt_div(e1,e2,e3) k = (tmp >> 16) & 0xFFFF; } k += borrow; - borrow = (long)u_p[0] < k; + borrow = u_p[0] < k; u_p[0] -= k; if (borrow) { @@ -110,15 +101,15 @@ flt_div(e1,e2,e3) q_est--; borrow = 0; for (i = maxv; i > 0; i--) { - long tmp - = v[i]+(long)u_p[i]+borrow; - + uint32_t tmp + = v[i]+(uint32_t)u_p[i]+borrow; + u_p[i] = tmp & 0xFFFF; borrow = (tmp >> 16) & 0xFFFF; } u_p[0] += borrow; } - *lp |= (j & 1) ? q_est : (q_est<<16); + *rp |= (j & 1) ? q_est : (q_est<<16); } } e3->m1 = result[0]; diff --git a/modules/src/flt_arith/flt_misc.h b/modules/src/flt_arith/flt_misc.h index c5cf5a7cf..64b6865aa 100644 --- a/modules/src/flt_arith/flt_misc.h +++ b/modules/src/flt_arith/flt_misc.h @@ -15,13 +15,11 @@ #define EXT_MIN (-16384) /* min exponent */ /* hiding of names: */ -#define ucmp _flt_ucmp #define flt_nrm _flt_nrm #define flt_chk _flt_chk #define flt_b64_add _flt_64add #define flt_split _flt_split -int ucmp(long, long); void flt_nrm(flt_arith *); void flt_chk(flt_arith *); int flt_b64_add(struct flt_mantissa *, struct flt_mantissa *); diff --git a/modules/src/flt_arith/flt_mul.c b/modules/src/flt_arith/flt_mul.c index e6972ab54..4d989382b 100644 --- a/modules/src/flt_arith/flt_mul.c +++ b/modules/src/flt_arith/flt_mul.c @@ -5,6 +5,7 @@ /* $Id$ */ +#include #include "flt_misc.h" void @@ -43,9 +44,9 @@ flt_mul(e1,e2,e3) */ for(i=4, pres = &result[4];i--;pres--) if (mp[i]) { unsigned short k = 0; - long mpi = mp[i]; + uint32_t mpi = mp[i]; for(j=4;j--;) { - long tmp = (long)pres[j] + k; + long tmp = (uint32_t)pres[j] + k; if (mc[j]) tmp += mpi * mc[j]; pres[j] = tmp & 0xFFFF; k = (tmp >> 16) & 0xFFFF; @@ -64,12 +65,12 @@ flt_mul(e1,e2,e3) /* * combine the registers to a total */ - e3->m1 = ((long)result[0] << 16) + result[1]; - e3->m2 = ((long)result[2] << 16) + result[3]; + e3->m1 = ((uint32_t)result[0] << 16) + result[1]; + e3->m2 = ((uint32_t)result[2] << 16) + result[3]; if (result[4] & 0x8000) { - if (++e3->m2 == 0 || (e3->m2 & ~ 0xFFFFFFFF)) { + if (++e3->m2 == 0) { e3->m2 = 0; - if (++e3->m1 == 0 || (e3->m1 & ~ 0xFFFFFFFF)) { + if (++e3->m1 == 0) { e3->m1 = 0x80000000; e3->flt_exp++; } diff --git a/modules/src/flt_arith/flt_nrm.c b/modules/src/flt_arith/flt_nrm.c index 14762b616..3520ee5b4 100644 --- a/modules/src/flt_arith/flt_nrm.c +++ b/modules/src/flt_arith/flt_nrm.c @@ -5,6 +5,7 @@ /* $Id$ */ +#include #include "flt_misc.h" void @@ -24,8 +25,8 @@ flt_nrm(e) e->m2 = 0L; e->flt_exp -= 32; } - if ((e->m1 & 0x80000000) == 0) { - long l = 0x40000000; + if ((e->m1 & 0x80000000UL) == 0) { + uint32_t l = 0x40000000UL; int cnt = -1; while (! (l & e->m1)) { diff --git a/modules/src/flt_arith/test.c b/modules/src/flt_arith/test.c index bf9c43c69..dfc4a694a 100644 --- a/modules/src/flt_arith/test.c +++ b/modules/src/flt_arith/test.c @@ -1,3 +1,5 @@ +#include +#include #include "flt_arith.h" struct tests { @@ -22,6 +24,7 @@ struct tests { { 0, 0, 0, 0} }; +int main() { register struct tests *p = tests; @@ -31,7 +34,7 @@ main() if (! dotest(p)) exit_status = 1; p++; } - exit(exit_status); + return exit_status; } int diff --git a/modules/src/flt_arith/ucmp.c b/modules/src/flt_arith/ucmp.c deleted file mode 100644 index c4b7bc0a4..000000000 --- a/modules/src/flt_arith/ucmp.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - (c) copyright 1989 by the Vrije Universiteit, Amsterdam, The Netherlands. - See the copyright notice in the ACK home directory, in the file "Copyright". -*/ - -/* $Id$ */ - -#include "flt_misc.h" - -int -ucmp(l1,l2) - long l1,l2; -{ - if (l1 == l2) return 0; - if (l2 >= 0) { - if (l1 > l2 || l1 < 0) return 1; - return -1; - } - if (l1 >= 0 || l1 < l2) return -1; - return 1; -} From 19ca28e22f6de12cbff8f0be250a0a30b74b3c92 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 6 Nov 2016 15:01:25 -0500 Subject: [PATCH 04/11] Undo commit bfeb736 for lang/cem/libcc.ansi/headers/float.h This restores the correct values of DBL_MAX, DBL_MIN_EXP, and related constants. This fixes some range checks within libc, causing atof("-36e90") and atof("1.44e-288") to return the correct values. --- lang/cem/libcc.ansi/headers/float.h | 108 ++++++++++++++++++---------- 1 file changed, 72 insertions(+), 36 deletions(-) diff --git a/lang/cem/libcc.ansi/headers/float.h b/lang/cem/libcc.ansi/headers/float.h index 43656651b..8cdb34c4f 100644 --- a/lang/cem/libcc.ansi/headers/float.h +++ b/lang/cem/libcc.ansi/headers/float.h @@ -1,43 +1,79 @@ /* - -- simple version used by "gimplify" + * float.h - implementation limits + */ +/* $Id$ */ - last edit: 2007-02-12 D A Gwyn -*/ +#if !defined(_FLOAT_H) +#define _FLOAT_H -/* Does not exactly fit any model, and is minimal for "universality". */ +#if defined(__vax) || defined(__pdp) +#define FLT_DIG 6 +#define FLT_EPSILON 5.96046448e-08F +#define FLT_MANT_DIG 8 +#define FLT_MAX 1.70141173e+38F +#define FLT_MAX_10_EXP 38 +#define FLT_MAX_EXP 127 +#define FLT_MIN 2.93873588e-39F +#define FLT_MIN_10_EXP (-38) +#define FLT_MIN_EXP (-127) -#define FLT_ROUNDS (-1) -#define FLT_EVAL_METHOD (-1) -#define FLT_RADIX 2 -#define DECIMAL_DIG 10 +#define DBL_DIG 16 +#define DBL_EPSILON 1.38777878078144568e-17 +#define DBL_MANT_DIG 8 +#define DBL_MAX 1.70141183460469229e+38 +#define DBL_MAX_10_EXP 38 +#define DBL_MAX_EXP 127 +#define DBL_MIN 2.93873587705571877e-39 +#define DBL_MIN_10_EXP (-38) +#define DBL_MIN_EXP (-127) -/* assumes that "gimplify" specifies "-Dfloat=double" */ -#define FLT_MANT_DIG 10 -#define FLT_EPSILON (1E-9F) -#define FLT_DIG 10 -#define FLT_MIN_EXP (-31) -#define FLT_MIN (1E-37F) -#define FLT_MIN_10_EXP (-37) -#define FLT_MAX_EXP 37 -#define FLT_MAX (1E+37F) -#define FLT_MAX_10_EXP 37 +#define LDBL_DIG 16 +#define LDBL_EPSILON 1.38777878078144568e-17L +#define LDBL_MANT_DIG 8 +#define LDBL_MAX 1.70141183460469229e+38L +#define LDBL_MAX_10_EXP 38 +#define LDBL_MAX_EXP 127 +#define LDBL_MIN 2.93873587705571877e-39L +#define LDBL_MIN_10_EXP (-38) +#define LDBL_MIN_EXP (-127) -#define DBL_MANT_DIG 10 -#define DBL_EPSILON (1E-9) -#define DBL_DIG 10 -#define DBL_MIN_EXP (-31) -#define DBL_MIN (1E-37) -#define DBL_MIN_10_EXP (-37) -#define DBL_MAX_EXP 37 -#define DBL_MAX (1E+37) -#define DBL_MAX_10_EXP 37 +#define FLT_ROUNDS 1 +#define FLT_RADIX 2 -#define LDBL_MANT_DIG 10 -#define LDBL_EPSILON (1E-9L) -#define LDBL_DIG 10 -#define LDBL_MIN_EXP (-31) -#define LDBL_MIN (1E-37L) -#define LDBL_MIN_10_EXP (-37) -#define LDBL_MAX_EXP 37 -#define LDBL_MAX (1E+37L) -#define LDBL_MAX_10_EXP 37 +#else /* IEEE format */ +#define FLT_DIG 6 +#define FLT_EPSILON 1.19209290e-07F +#define FLT_MANT_DIG 24 +#define FLT_MAX 3.40282347e+38F +#define FLT_MAX_10_EXP 38 +#define FLT_MAX_EXP 128 +#define FLT_MIN 1.17549435e-38F +#define FLT_MIN_10_EXP (-37) +#define FLT_MIN_EXP (-125) + +#define DBL_DIG 15 +#define DBL_EPSILON 2.2204460492503131e-16 +#define DBL_MANT_DIG 53 +#define DBL_MAX 1.7976931348623157e+308 +#define DBL_MAX_10_EXP 308 +#define DBL_MAX_EXP 1024 +#define DBL_MIN 2.2250738585072014e-308 +#define DBL_MIN_10_EXP (-307) +#define DBL_MIN_EXP (-1021) + +#define LDBL_DIG 15 +#define LDBL_EPSILON 2.2204460492503131e-16L +#define LDBL_MANT_DIG 53 +#define LDBL_MAX 1.7976931348623157e+308L +#define LDBL_MAX_10_EXP 308 +#define LDBL_MAX_EXP 1024 +#define LDBL_MIN 2.2250738585072014e-308L +#define LDBL_MIN_10_EXP (-307) +#define LDBL_MIN_EXP (-1021) + +#define FLT_ROUNDS 1 +#define FLT_RADIX 2 + +#endif /* vax, pdp or ieee */ + +#endif /* _FLOAT_H */ From 08f9869a63d85a4634ec87c826212b01f935af8e Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 6 Nov 2016 15:49:47 -0500 Subject: [PATCH 05/11] Remove unused defines from lang/cem/libcc.ansi/math/localmath.h This undoes part of bfeb736, and returns to using DBL_MAX_EXP and DBL_MIN_EXP from float.h. Add a dependency on math/localmath.h and other local header files so libc is rebuilt when those headers change. --- lang/cem/libcc.ansi/build.lua | 20 ++++++++++++-------- lang/cem/libcc.ansi/math/localmath.h | 17 ++--------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/lang/cem/libcc.ansi/build.lua b/lang/cem/libcc.ansi/build.lua index 3ca95b629..601a50de4 100644 --- a/lang/cem/libcc.ansi/build.lua +++ b/lang/cem/libcc.ansi/build.lua @@ -28,9 +28,9 @@ normalrule { } for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { + acklibrary { + name = "lib_"..plat, + srcs = { "+ctype_files", "+ctype_tab", "./ctype/*.c", @@ -43,20 +43,24 @@ for _, plat in ipairs(vars.plats) do "./setjmp/*.c", "./setjmp/*.e", "./signal/*.c", - "./assert/*.c", + "./assert/*.c", "./stdio/*.c", "./stdlib/*.c", "./string/*.c", "./time/*.c", - - }, + }, hdrs = {}, -- must be empty deps = { "lang/cem/libcc.ansi/headers+headers", "plat/"..plat.."/include+headers", + "./malloc/malloc.h", + "./math/localmath.h", + "./stdio/loc_incl.h", + "./stdlib/ext_fmt.h", + "./time/loc_time.h", }, - vars = { plat = plat } - } + vars = { plat = plat } + } ackfile { name = "crt_"..plat, diff --git a/lang/cem/libcc.ansi/math/localmath.h b/lang/cem/libcc.ansi/math/localmath.h index 7c9a67465..e85c81c0a 100644 --- a/lang/cem/libcc.ansi/math/localmath.h +++ b/lang/cem/libcc.ansi/math/localmath.h @@ -18,18 +18,5 @@ #define POLYNOM12(x, a) (POLYNOM11((x),(a)+1)*(x)+(a)[0]) #define POLYNOM13(x, a) (POLYNOM12((x),(a)+1)*(x)+(a)[0]) -/* These are set up for 64-bit doubles. */ - -#ifndef M_MAX_D -#define M_MAX_D 1.7976931348623157e+308 -#define M_MIN_D 2.2250738585072014e-308 -#define M_DEXPLEN 11 -#endif -#define M_DMAXEXP ((1 << (M_DEXPLEN - 1)) - 1) -#define M_DMINEXP (-M_DMAXEXP) -#define M_LN_MAX_D (M_LN2 * M_DMAXEXP) -#define M_LN_MIN_D (M_LN2 * (M_DMINEXP - 1)) - -#define HUGE M_MAX_D -#define MAXDOUBLE M_MAX_D - +#define M_LN_MAX_D (M_LN2 * DBL_MAX_EXP) +#define M_LN_MIN_D (M_LN2 * (DBL_MIN_EXP - 1)) From e5e96d5226c27e4f31d199bc8530885c78c2058d Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 6 Nov 2016 19:34:51 -0500 Subject: [PATCH 06/11] Convert 1 to 1.0, not 0.0, for machines with 64-bit long. This fixes flt_arith2flt() when sizeof(arith) != 4, where arith is long. When cemcom.ansi sees an expression like d + 1 (where d is some double), it calls flt_arith2flt() to convert 1 to floating-point. On machines where sizeof(arith) != 4, the code did n >>= 1 when n should not have been changed. If n was 1, then n == 0 became true. This caused the code to convert 1 or -1 to 0.0. My fix assumes sizeof(arith) >= 8, so I can use n >> 32. Machines with sizeof(arith) of 5 to 7 would need to do (uarith)n >> 32, where uarith must be an unsigned integer type of same size as arith. In startrek.c, the Enterprise can now dock with a starbase. The compiler no longer translates s1 - 1 to s1 - 0.0 and s1 + 1 to s1 + 0.0, so the game now looks for starbases next to the Enterprise. --- modules/src/flt_arith/flt_ar2flt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/src/flt_arith/flt_ar2flt.c b/modules/src/flt_arith/flt_ar2flt.c index f1d159a67..6dac35883 100644 --- a/modules/src/flt_arith/flt_ar2flt.c +++ b/modules/src/flt_arith/flt_ar2flt.c @@ -25,10 +25,9 @@ flt_arith2flt(n, e, uns) e->m1 = 0; e->m2 = n; } else { - e->m2 = n & 0xffffffffL; - n >>= 1; - n &= ~((arith) 1 << (8*sizeof(arith)-1)); - e->m1 = (n >> 31); + /* assuming sizeof(arith) >= 8 */ + e->m1 = n >> 32; + e->m2 = n; } if (n == 0) { e->flt_exp = 0; From 82c2d184822c739f4761bee2e26c5974b9e16d1e Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 6 Nov 2016 20:21:48 -0500 Subject: [PATCH 07/11] Edit startrek.c so I can compile it with gcc and OpenBSD libc. Rename our getline() to get_line() to prevent a conflict with POSIX getline() declared in stdio.h. Remove dangerous call to gets(). OpenBSD does not have gets(), C99 deprecated it and C11 removed it. Also change spelling "sheild" to "shield". --- examples/startrek.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/startrek.c b/examples/startrek.c index f4f35a8bd..572c53597 100644 --- a/examples/startrek.c +++ b/examples/startrek.c @@ -107,7 +107,7 @@ void phaser_control(void); void photon_torpedoes(void); void torpedo_hit(void); void damage_control(void); -void sheild_control(void); +void shield_control(void); void library_computer(void); void galactic_record(void); void status_report(void); @@ -137,7 +137,7 @@ void sub2(void); void showfile(char *filename); int openfile(char * sFilename, char * sMode); void closefile(void); -int getline(char *s); +int get_line(char *s); void randomize(void); int get_rand(int iSpread); double rnd(void); @@ -203,7 +203,7 @@ void reads(char* buffer) { fflush(stdout); - gets(buffer); + fgets(buffer, sizeof(string), stdin); } /* Main Program */ @@ -292,7 +292,7 @@ new_game(void) else if (! strncmp(sTemp, "tor", 3)) photon_torpedoes(); else if (! strncmp(sTemp, "she", 3)) - sheild_control(); + shield_control(); else if (! strncmp(sTemp, "dam", 3)) damage_control(); else if (! strncmp(sTemp, "com", 3)) @@ -307,7 +307,7 @@ new_game(void) printf(" lrs - Long Range Sensors\n"); printf(" pha - Phasers\n"); printf(" tor - Photon Torpedoes\n"); - printf(" she - Sheild Control\n"); + printf(" she - Shield Control\n"); printf(" dam - Damage Control\n"); printf(" com - Library Computer\n"); printf(" xxx - Resign Command\n"); @@ -1206,14 +1206,14 @@ damage_control(void) } void -sheild_control(void) +shield_control(void) { int i; string sTemp; if (d[7] < 0.0) { - printf("Sheild Control inoperable\n"); + printf("Shield Control inoperable\n"); return; } @@ -1229,15 +1229,15 @@ sheild_control(void) if (i < 0 || s == i) { - printf("\n\n"); + printf("\n\n"); return; } if (i >= e + s) { - printf("Sheild Control Reports:\n"); + printf("Shield Control Reports:\n"); printf(" 'This is not the Federation Treasury.'\n"); - printf("\n\n"); + printf("\n\n"); return; } @@ -1776,7 +1776,7 @@ get_device_name(void) { static char * device_name[] = { "", "Warp Engines","Short Range Sensors","Long Range Sensors", - "Phaser Control","Photon Tubes","Damage Control","Sheild Control", + "Phaser Control","Photon Tubes","Damage Control","Shield Control", "Library-Computer"}; if (r1 < 0 || r1 > 8) @@ -1888,7 +1888,7 @@ showfile(char *filename) if (openfile(filename, "r") != 0) return; - while (getline(lBuffer) != 0) + while (get_line(lBuffer) != 0) { printf(lBuffer); @@ -1926,7 +1926,7 @@ closefile(void) } int -getline(char *s) +get_line(char *s) { fflush(stdout); if (fgets(s, MAXCOL, stream) == NULL) From 57cb99ade1ada6dd5cf77162b335f8f750d075ff Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 9 Nov 2016 21:52:04 +0100 Subject: [PATCH 08/11] Remove sys_time in favour of directly calling time(). --- lang/cem/cemcom.ansi/init.c | 5 +++-- lang/cem/cpp.ansi/init.c | 5 +++-- modules/src/system/system.3 | 4 +--- modules/src/system/system.h | 1 - modules/src/system/time.c | 15 --------------- 5 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 modules/src/system/time.c diff --git a/lang/cem/cemcom.ansi/init.c b/lang/cem/cemcom.ansi/init.c index bb1fd5559..3b3403aa4 100644 --- a/lang/cem/cemcom.ansi/init.c +++ b/lang/cem/cemcom.ansi/init.c @@ -7,6 +7,7 @@ #include #include +#include #include "parameters.h" #ifndef NOPP @@ -44,7 +45,7 @@ init_pp() "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - long clock, sys_time(); + time_t clock; static char dbuf[30]; static char tbuf[30]; struct tm *tp; @@ -70,7 +71,7 @@ init_pp() /* Initialize __LINE__, __FILE__, __DATE__, __TIME__, and __STDC__ macro definitions. */ - clock = sys_time(); + clock = time(NULL); tp = localtime(&clock); /* __DATE__ */ diff --git a/lang/cem/cpp.ansi/init.c b/lang/cem/cpp.ansi/init.c index a9cba4dba..3953609b5 100644 --- a/lang/cem/cpp.ansi/init.c +++ b/lang/cem/cpp.ansi/init.c @@ -7,6 +7,7 @@ #include #include +#include #include "system.h" #include "alloc.h" #include "time.h" @@ -42,7 +43,7 @@ init_pp() "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - long clock, sys_time(); + time_t clock; static char dbuf[30]; static char tbuf[30]; struct tm *tp; @@ -68,7 +69,7 @@ init_pp() /* Initialize __LINE__, __FILE__, __DATE__, __TIME__, and __STDC__ macro definitions. */ - clock = sys_time(); + clock = time(NULL); tp = localtime(&clock); /* __DATE__ */ diff --git a/modules/src/system/system.3 b/modules/src/system/system.3 index 58557489c..c58c168bb 100644 --- a/modules/src/system/system.3 +++ b/modules/src/system/system.3 @@ -4,7 +4,7 @@ sys_open, sys_close, sys_read, sys_write, sys_reset, sys_access, sys_modtime, sys_remove, sys_rename, sys_filesize, sys_chmode, sys_lock, sys_unlock, -sys_break, sys_stop, sys_time \- system call interface +sys_break, sys_stop \- system call interface .SH SYNOPSIS .nf .B #include @@ -67,8 +67,6 @@ sys_break, sys_stop, sys_time \- system call interface .B void sys_stop(how) .B int how; .PP -.B long sys_time(); -.PP .B long sys_modtime(path) .B char *path; .fi diff --git a/modules/src/system/system.h b/modules/src/system/system.h index 8f8bce45c..8a5825173 100644 --- a/modules/src/system/system.h +++ b/modules/src/system/system.h @@ -50,7 +50,6 @@ _PROTOTYPE(int sys_unlock, (char *)); #endif _PROTOTYPE(char *sys_break, (int)); _PROTOTYPE(void sys_stop, (int)); -_PROTOTYPE(long sys_time, (void)); _PROTOTYPE(long sys_modtime, (char *)); /* standard file decsriptors */ diff --git a/modules/src/system/time.c b/modules/src/system/time.c deleted file mode 100644 index e06a9fa00..000000000 --- a/modules/src/system/time.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* $Id$ */ - -#include "system.h" - -long time(); - -long -sys_time() -{ - return time((long *) 0); -} From fd9185100523b01b9561be6cbd072a6f6e617ac8 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 10 Nov 2016 22:04:18 +0100 Subject: [PATCH 09/11] Add enough return types to the K&R C that the ACK builds (on Linux) using clang now. --- lang/basic/src/eval.c | 3 +++ lang/basic/src/symbols.c | 1 + lang/basic/src/util.c | 1 + lang/cem/cemcom.ansi/LLlex.c | 3 +++ lang/cem/cemcom.ansi/arith.c | 3 +++ lang/cem/cemcom.ansi/ch3.c | 4 ++++ lang/cem/cemcom.ansi/ch3bin.c | 4 ++++ lang/cem/cemcom.ansi/code.c | 5 +++++ lang/cem/cemcom.ansi/domacro.c | 6 ++++++ lang/cem/cemcom.ansi/error.c | 4 ++-- lang/cem/cemcom.ansi/eval.c | 6 ++++++ lang/cem/cemcom.ansi/expr.c | 1 + lang/cem/cemcom.ansi/idf.c | 6 ++++++ lang/cem/cemcom.ansi/ival.g | 8 ++++++++ lang/cem/cemcom.ansi/main.c | 3 +++ lang/cem/cemcom.ansi/proto.c | 4 ++++ lang/cem/cemcom.ansi/replace.c | 7 +++++++ lang/cem/cemcom.ansi/stab.c | 2 +- lang/cem/cemcom.ansi/stack.c | 1 + lang/cem/cemcom.ansi/switch.c | 2 ++ lang/cem/cemcom.ansi/util.c | 1 + lang/cem/cpp.ansi/LLlex.c | 3 +++ lang/cem/cpp.ansi/domacro.c | 6 ++++++ lang/cem/cpp.ansi/main.c | 3 +++ lang/cem/cpp.ansi/preprocess.c | 1 + lang/cem/cpp.ansi/replace.c | 7 +++++++ lang/m2/comp/LLlex.c | 1 + lang/m2/comp/casestat.C | 5 +++++ lang/m2/comp/chk_expr.c | 1 + lang/m2/comp/code.c | 8 ++++++++ lang/m2/comp/cstoper.c | 6 ++++++ lang/m2/comp/desig.c | 1 + lang/m2/comp/enter.c | 2 ++ lang/m2/comp/error.c | 3 +++ lang/m2/comp/node.c | 1 + lang/m2/comp/stab.c | 2 +- lang/m2/comp/type.c | 3 +++ lang/m2/comp/walk.c | 9 ++++++--- lang/pc/comp/LLlex.c | 3 ++- lang/pc/comp/body.c | 6 ++++++ lang/pc/comp/casestat.C | 2 ++ lang/pc/comp/code.c | 9 +++++++++ lang/pc/comp/cstoper.c | 2 ++ lang/pc/comp/def.c | 1 + lang/pc/comp/desig.c | 4 ++++ lang/pc/comp/error.c | 3 +++ lang/pc/comp/label.c | 4 ++++ lang/pc/comp/node.c | 1 + lang/pc/comp/progs.c | 4 ++++ lang/pc/comp/readwrite.c | 13 +++++++++++++ lang/pc/comp/stab.c | 3 ++- lang/pc/comp/type.c | 4 ++++ mach/i386/as/mach5.c | 2 ++ mach/i386/ncg/mach.c | 2 ++ mach/i80/ncg/mach.c | 2 ++ mach/i86/ncg/mach.c | 2 ++ mach/m68020/as/mach5.c | 15 +++++++++++++++ mach/m68020/ncg/mach.c | 2 ++ mach/powerpc/ncg/mach.c | 2 ++ mach/proto/as/comm4.c | 5 +++++ mach/proto/as/comm5.c | 3 +++ mach/proto/as/comm6.c | 9 +++++++++ mach/proto/ncg/compute.c | 1 + mach/proto/ncg/equiv.c | 3 +++ mach/proto/ncg/fillem.c | 15 +++++++++++++++ mach/proto/ncg/gencode.c | 1 + mach/proto/ncg/label.c | 1 + mach/proto/ncg/regvar.c | 1 + mach/proto/ncg/salloc.c | 4 ++++ mach/proto/ncg/state.c | 3 +++ mach/proto/ncg/subr.c | 2 ++ mach/proto/top/top.c | 5 +++++ mach/vc4/ncg/mach.c | 2 +- util/LLgen/src/check.c | 8 ++++---- util/LLgen/src/compute.c | 24 ++++++++++++------------ util/LLgen/src/gencode.c | 24 ++++++++++++------------ util/LLgen/src/main.c | 4 +++- util/LLgen/src/reach.c | 4 ++-- util/LLgen/src/savegram.c | 8 ++++---- util/LLgen/src/tokens.c | 8 ++++---- util/LLgen/src/tokens.g | 7 ++++--- util/ack/files.c | 1 + util/ack/grows.c | 1 + util/ack/grows.h | 2 +- util/ack/main.c | 3 +++ util/ack/mktables.c | 3 +++ util/ack/rmach.c | 2 ++ util/ack/scan.c | 3 +++ util/ack/trans.c | 8 ++++++++ util/ack/util.c | 3 +++ util/amisc/anm.c | 3 +++ util/arch/archiver.c | 7 +++++++ util/ego/bo/bo.c | 4 +++- util/ego/ca/ca.c | 4 ++-- util/ego/cf/cf_loop.c | 2 +- util/ego/cj/cj.c | 5 +++-- util/ego/cs/cs.c | 2 +- util/ego/cs/cs_avail.c | 2 +- util/ego/cs/cs_debug.c | 2 +- util/ego/cs/cs_kill.c | 2 +- util/ego/cs/cs_stack.c | 1 + util/ego/ic/ic_lib.c | 2 +- util/ego/il/il1_aux.c | 1 + util/ego/il/il1_aux.h | 2 +- util/ego/il/il1_cal.c | 2 +- util/ego/il/il1_formal.c | 1 + util/ego/il/il1_formal.h | 2 +- util/ego/il/il3_change.c | 3 ++- util/ego/il/il3_change.h | 2 +- util/ego/il/il_aux.c | 1 + util/ego/lv/lv.c | 1 + util/ego/ra/ra.c | 1 + util/ego/ra/ra_items.c | 2 +- util/ego/ra/ra_xform.c | 2 ++ util/ego/share/locals.c | 8 ++++---- util/ego/share/locals.h | 4 ++-- util/ego/share/put.c | 1 + util/ego/share/put.h | 2 +- util/ego/sp/sp.c | 1 + util/ego/sr/sr.c | 1 + util/ego/sr/sr_cand.c | 2 +- util/ego/sr/sr_iv.c | 2 +- util/ego/sr/sr_reduce.c | 6 +++--- util/ego/sr/sr_xform.c | 1 + util/ego/sr/sr_xform.h | 2 +- util/ego/ud/ud.c | 1 + util/ego/ud/ud_const.c | 2 +- util/ego/ud/ud_copy.c | 4 ++-- util/ego/ud/ud_defs.c | 2 +- util/led/extract.c | 4 ++++ util/led/main.c | 11 +++++++---- util/led/memory.c | 1 + util/led/output.c | 4 ++-- util/led/save.c | 3 +++ util/ncgg/coerc.c | 4 ++++ util/ncgg/output.c | 1 + util/ncgg/set.c | 2 +- util/ncgg/subr.c | 2 ++ util/opt/cleanup.c | 1 + util/opt/flow.c | 3 +++ util/opt/getline.c | 1 + util/opt/reg.c | 2 ++ util/opt/tes.c | 1 + 143 files changed, 432 insertions(+), 94 deletions(-) diff --git a/lang/basic/src/eval.c b/lang/basic/src/eval.c index ed5b6f499..f1f762b05 100644 --- a/lang/basic/src/eval.c +++ b/lang/basic/src/eval.c @@ -31,6 +31,7 @@ int ltype,rtype; +void conversion(oldtype,newtype) int oldtype,newtype; { @@ -71,6 +72,7 @@ int oldtype,newtype; +void extraconvert(oldtype,newtype,topstack) int oldtype,newtype,topstack; { @@ -509,6 +511,7 @@ endarrayload() +void loadarray(type) int type; { diff --git a/lang/basic/src/symbols.c b/lang/basic/src/symbols.c index 30c3b5e8b..96d148ae3 100644 --- a/lang/basic/src/symbols.c +++ b/lang/basic/src/symbols.c @@ -68,6 +68,7 @@ char *str; +void dcltype(s) Symbol *s; { diff --git a/lang/basic/src/util.c b/lang/basic/src/util.c index 8255b39a1..ff98cf82b 100644 --- a/lang/basic/src/util.c +++ b/lang/basic/src/util.c @@ -16,6 +16,7 @@ int errorcnt; +void warning(str) char *str; { diff --git a/lang/cem/cemcom.ansi/LLlex.c b/lang/cem/cemcom.ansi/LLlex.c index 07a79ad8e..d0632536d 100644 --- a/lang/cem/cemcom.ansi/LLlex.c +++ b/lang/cem/cemcom.ansi/LLlex.c @@ -52,6 +52,8 @@ extern int lint_skip_comment; static struct token LexStack[MAX_LL_DEPTH]; static LexSP = 0; +void skipcomment(); + /* In PushLex() the actions are taken in order to initialise or re-initialise the lexical scanner. E.g. at the invocation of a sub-parser that uses LLlex(), the @@ -442,6 +444,7 @@ garbage: } #ifndef NOPP +void skipcomment() { /* The last character read has been the '*' of '/_*'. The diff --git a/lang/cem/cemcom.ansi/arith.c b/lang/cem/cemcom.ansi/arith.c index d5f3af3e7..317107a43 100644 --- a/lang/cem/cemcom.ansi/arith.c +++ b/lang/cem/cemcom.ansi/arith.c @@ -30,6 +30,7 @@ extern char options[]; extern arith flt_flt2arith(); extern label code_string(); +void arithbalance(e1p, oper, e2p) /* 3.1.2.5 */ register struct expr **e1p, **e2p; int oper; @@ -523,6 +524,7 @@ opnd2logical(expp, oper) } } +void opnd2test(expp, oper) register struct expr **expp; { @@ -548,6 +550,7 @@ opnd2test(expp, oper) ch3bin(expp, NOTEQUAL, intexpr((arith)0, INT)); } +void any2opnd(expp, oper) register struct expr **expp; { diff --git a/lang/cem/cemcom.ansi/ch3.c b/lang/cem/cemcom.ansi/ch3.c index bebe77efa..eef806776 100644 --- a/lang/cem/cemcom.ansi/ch3.c +++ b/lang/cem/cemcom.ansi/ch3.c @@ -23,11 +23,14 @@ extern char options[]; extern char *symbol2str(); extern struct type *qualifier_type(); +void ch3cast(); + /* Most expression-handling routines have a pointer to a (struct type *) as first parameter. The object under the pointer gets updated in the process. */ +void ch3sel(expp, oper, idf) struct expr **expp; struct idf *idf; @@ -169,6 +172,7 @@ ch3incr(expp, oper) ch3asgn(expp, oper, intexpr((arith)1, INT)); } +void ch3cast(expp, oper, tp) register struct expr **expp; register struct type *tp; diff --git a/lang/cem/cemcom.ansi/ch3bin.c b/lang/cem/cemcom.ansi/ch3bin.c index 8145b933d..ba75c112c 100644 --- a/lang/cem/cemcom.ansi/ch3bin.c +++ b/lang/cem/cemcom.ansi/ch3bin.c @@ -19,6 +19,8 @@ extern char options[]; extern char *symbol2str(); +void pntminuspnt(); + /* This chapter asks for the repeated application of code to handle an operation that may be executed at compile time or at run time, depending on the constancy of the operands. @@ -32,6 +34,7 @@ extern char *symbol2str(); #define commutative_binop(expp, oper, expr) mk_binop(expp, oper, expr, 1) #define non_commutative_relop(expp, oper, expr) mk_binop(expp, oper, expr, 1) +void ch3bin(expp, oper, expr) register struct expr **expp; struct expr *expr; @@ -292,6 +295,7 @@ ch3bin(expp, oper, expr) } } +void pntminuspnt(expp, oper, expr) register struct expr **expp, *expr; { diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom.ansi/code.c index 1beeb12c4..abfd2b2b2 100644 --- a/lang/cem/cemcom.ansi/code.c +++ b/lang/cem/cemcom.ansi/code.c @@ -64,6 +64,8 @@ extern char options[]; extern char *symbol2str(); extern char *source; +void loc_init(); + #ifndef LINT init_code(dst_file) char *dst_file; @@ -415,6 +417,7 @@ do_return_expr(expr) return_expr_occurred = 1; } +void code_declaration(idf, expr, lvl, sc) register struct idf *idf; /* idf to be declared */ struct expr *expr; /* initialisation; NULL if absent */ @@ -527,6 +530,7 @@ code_declaration(idf, expr, lvl, sc) } } +void loc_init(expr, id) struct expr *expr; struct idf *id; @@ -721,6 +725,7 @@ code_break() it generates a branch instruction to the continue label of the innermost statement in which continue has a meaning. */ +void code_continue() { register struct stmt_block *stmt_block = stmt_stack; diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 4173a11b2..d0fe7a96d 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -34,6 +34,9 @@ char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */ int nestlevel = -1; +void macro_def(); +void do_define(); + struct idf * GetIdentifier(skiponerr) int skiponerr; /* skip the rest of the line on error */ @@ -145,6 +148,7 @@ domacro() int lint_skip_comment; #endif +void skip_block(to_endif) int to_endif; { @@ -347,6 +351,7 @@ do_include() } } +void do_define() { /* do_define() interprets a #define control line. @@ -574,6 +579,7 @@ getparams(buf, parbuf) /*NOTREACHED*/ } +void macro_def(id, text, nformals, length, flags) register struct idf *id; char *text; diff --git a/lang/cem/cemcom.ansi/error.c b/lang/cem/cemcom.ansi/error.c index 10b237db4..6f2283b74 100644 --- a/lang/cem/cemcom.ansi/error.c +++ b/lang/cem/cemcom.ansi/error.c @@ -57,7 +57,7 @@ extern char loptions[]; expression, whereas other errors use the information in the token. */ -static _error(); +static void _error(); #if __STDC__ /*VARARGS*/ @@ -521,7 +521,7 @@ fatal(va_alist) /* fmt, args */ } #endif -static +static void _error(class, fn, ln, fmt, ap) int class; char *fn; diff --git a/lang/cem/cemcom.ansi/eval.c b/lang/cem/cemcom.ansi/eval.c index 16f19c0ad..f678682c2 100644 --- a/lang/cem/cemcom.ansi/eval.c +++ b/lang/cem/cemcom.ansi/eval.c @@ -37,6 +37,9 @@ arith NewLocal(); /* util.c */ #define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER) extern int err_occurred; /* error.c */ +void store_val(); +void load_val(); + /* EVAL() is the main expression-tree evaluator, which turns any legal expression tree into EM code. parameters.h: @@ -63,6 +66,7 @@ extern int err_occurred; /* error.c */ labels, in case they are specified (i.e. are non-zero) */ +void EVAL(expr, val, code, true_label, false_label) register struct expr *expr; int val, code; @@ -836,6 +840,7 @@ ptr_add(size) - into a local static variable - absolute addressing */ +void store_val(vl, tp) register struct value *vl; register struct type *tp; @@ -907,6 +912,7 @@ store_val(vl, tp) - static variable - local variable */ +void load_val(expr, rlval) register struct expr *expr; /* expression containing the value */ int rlval; /* generate either LVAL or RVAL */ diff --git a/lang/cem/cemcom.ansi/expr.c b/lang/cem/cemcom.ansi/expr.c index 6d8c1e23d..3a7e3c494 100644 --- a/lang/cem/cemcom.ansi/expr.c +++ b/lang/cem/cemcom.ansi/expr.c @@ -369,6 +369,7 @@ new_oper(tp, e1, oper, e2) return expr; } +void chk_cst_expr(expp) struct expr **expp; { diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index eb43e34bb..4edc88456 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -37,6 +37,8 @@ extern char *symbol2str(); #include +void global_redecl(); + struct idf * gen_idf() { @@ -248,6 +250,7 @@ declare_idf(ds, dc, lvl) } } +int actual_declaration(sc, tp) int sc; struct type *tp; @@ -269,6 +272,7 @@ actual_declaration(sc, tp) return 1; } +void global_redecl(idf, new_sc, tp) register struct idf *idf; struct type *tp; @@ -393,6 +397,7 @@ declare_params(dc) } } +void idf_initialized(idf) register struct idf *idf; { @@ -429,6 +434,7 @@ declare_enum(tp, idf, l) idf->id_def->df_address = l; } +void check_formals(idf, dc) struct idf *idf; struct declarator *dc; diff --git a/lang/cem/cemcom.ansi/ival.g b/lang/cem/cemcom.ansi/ival.g index b085ebc73..757bb721b 100644 --- a/lang/cem/cemcom.ansi/ival.g +++ b/lang/cem/cemcom.ansi/ival.g @@ -46,6 +46,11 @@ static int pack_level; struct type **gen_tphead(), **gen_tpmiddle(); struct sdef *gen_align_to_next(); struct e_stack *p_stack; + +void pad(); +void gen_simple_exp(); +void gen_tpcheck(); + } /* initial_value recursively guides the initialisation expression. @@ -122,6 +127,7 @@ initial_value_list(register struct type **tpp; struct expr **expp;) ; { +void gen_tpcheck(tpp) struct type **tpp; { @@ -147,6 +153,7 @@ gen_tpcheck(tpp) } } +void gen_simple_exp(tpp, expp) struct type **tpp; struct expr **expp; @@ -465,6 +472,7 @@ check_and_pad(expp, tpp) /* pad() fills an element of type tp with zeroes. If the element is an aggregate, pad() is called recursively. */ +void pad(tpx) struct type *tpx; { diff --git a/lang/cem/cemcom.ansi/main.c b/lang/cem/cemcom.ansi/main.c index 556e23495..1bb72ae85 100644 --- a/lang/cem/cemcom.ansi/main.c +++ b/lang/cem/cemcom.ansi/main.c @@ -46,6 +46,8 @@ struct sp_id special_ids[] = { {0, 0} }; +void dependency(); + #ifndef NOCROSS arith short_size = SZ_SHORT, @@ -181,6 +183,7 @@ char *s; } } +void dependency(s, source) char *s, *source; { diff --git a/lang/cem/cemcom.ansi/proto.c b/lang/cem/cemcom.ansi/proto.c index 1f7f6bf6d..b237f3433 100644 --- a/lang/cem/cemcom.ansi/proto.c +++ b/lang/cem/cemcom.ansi/proto.c @@ -26,6 +26,7 @@ extern char options[]; +void check_for_void(pl) register struct proto *pl; { @@ -261,6 +262,7 @@ declare_protos(dc) } +void update_proto(tp, otp) register struct type *tp, *otp; { @@ -312,6 +314,7 @@ update_proto(tp, otp) /* struct/union and enum tags can be declared inside prototypes * remove them from the symbol-table */ +void remove_proto_tag(tp) struct type *tp; { @@ -380,6 +383,7 @@ remove_proto_idfs(pl) } } +void call_proto(expp) register struct expr **expp; { diff --git a/lang/cem/cemcom.ansi/replace.c b/lang/cem/cemcom.ansi/replace.c index cde3aaf43..50978be3c 100644 --- a/lang/cem/cemcom.ansi/replace.c +++ b/lang/cem/cemcom.ansi/replace.c @@ -26,6 +26,10 @@ extern int InputLevel; struct repl *ReplaceList; /* list of currently active macros */ extern char *strcat(), *strcpy(); +void macro2buffer(); +void getactuals(); +void expand_defined(); + int replace(idf) register struct idf *idf; @@ -172,6 +176,7 @@ expand_macro(repl, idf) return 1; } +void expand_defined(repl) register struct repl *repl; { @@ -211,6 +216,7 @@ newarg(args) args->a_rawptr = args->a_rawbuf = Malloc(args->a_rawsize = ARGBUF); } +void getactuals(repl, idf) struct repl *repl; register struct idf *idf; @@ -529,6 +535,7 @@ macro_func(idef) } } +void macro2buffer(repl, idf, args) register struct repl *repl; register struct idf *idf; diff --git a/lang/cem/cemcom.ansi/stab.c b/lang/cem/cemcom.ansi/stab.c index 8c00838e3..f80b360b4 100644 --- a/lang/cem/cemcom.ansi/stab.c +++ b/lang/cem/cemcom.ansi/stab.c @@ -72,7 +72,7 @@ adds_db_str(s) while (*s) addc_db_str(*s++); } -static +static void stb_type(tp) register struct type *tp; { diff --git a/lang/cem/cemcom.ansi/stack.c b/lang/cem/cemcom.ansi/stack.c index 49dfbfab4..c8616b86e 100644 --- a/lang/cem/cemcom.ansi/stack.c +++ b/lang/cem/cemcom.ansi/stack.c @@ -57,6 +57,7 @@ stack_level() { #endif /* LINT */ } +void stack_idf(idf, stl) struct idf *idf; register struct stack_level *stl; diff --git a/lang/cem/cemcom.ansi/switch.c b/lang/cem/cemcom.ansi/switch.c index 856e1b115..3cce2c622 100644 --- a/lang/cem/cemcom.ansi/switch.c +++ b/lang/cem/cemcom.ansi/switch.c @@ -159,6 +159,7 @@ code_endswitch() unstack_stmt(); } +void code_case(expr) struct expr *expr; { @@ -227,6 +228,7 @@ code_case(expr) } } +void code_default() { register struct switch_hdr *sh = switch_stack; diff --git a/lang/cem/cemcom.ansi/util.c b/lang/cem/cemcom.ansi/util.c index 7326f04ec..273fa8d78 100644 --- a/lang/cem/cemcom.ansi/util.c +++ b/lang/cem/cemcom.ansi/util.c @@ -163,6 +163,7 @@ LocalFinish() #endif } +void RegisterAccount(offset, size, regtype, sc) arith offset, size; { diff --git a/lang/cem/cpp.ansi/LLlex.c b/lang/cem/cpp.ansi/LLlex.c index 3cd162898..dbf8d9ea1 100644 --- a/lang/cem/cpp.ansi/LLlex.c +++ b/lang/cem/cpp.ansi/LLlex.c @@ -35,6 +35,8 @@ extern arith char_constant(); #define FLG_ESEEN 0x01 /* possibly a floating point number */ #define FLG_DOTSEEN 0x02 /* certainly a floating point number */ +void skipcomment(); + int LLlex() { @@ -325,6 +327,7 @@ garbage: /*NOTREACHED*/ } +void skipcomment() { /* The last character read has been the '*' of '/_*'. The diff --git a/lang/cem/cpp.ansi/domacro.c b/lang/cem/cpp.ansi/domacro.c index a5cc9407d..306ed32cc 100644 --- a/lang/cem/cpp.ansi/domacro.c +++ b/lang/cem/cpp.ansi/domacro.c @@ -32,6 +32,9 @@ int svnestlevel[30] = {-1}; int nestcount; extern int do_preprocess; +void macro_def(); +void do_define(); + char * GetIdentifier(skiponerr) int skiponerr; /* skip the rest of the line on error */ @@ -148,6 +151,7 @@ domacro() } } +void skip_block(to_endif) int to_endif; { @@ -327,6 +331,7 @@ do_include() } } +void do_define() { /* do_define() interprets a #define control line. @@ -566,6 +571,7 @@ getparams(buf, parbuf) /*NOTREACHED*/ } +void macro_def(id, text, nformals, length, flags) register struct idf *id; char *text; diff --git a/lang/cem/cpp.ansi/main.c b/lang/cem/cpp.ansi/main.c index db444ae80..225562be0 100644 --- a/lang/cem/cpp.ansi/main.c +++ b/lang/cem/cpp.ansi/main.c @@ -32,6 +32,8 @@ char *prog_name; extern char **inctable; extern int inc_max, inc_total; +void dependency(); + main(argc, argv) char *argv[]; { @@ -140,6 +142,7 @@ add_dependency(s) } } +void dependency(s, source) char *s, *source; { diff --git a/lang/cem/cpp.ansi/preprocess.c b/lang/cem/cpp.ansi/preprocess.c index 7c3840d80..3d26b18e0 100644 --- a/lang/cem/cpp.ansi/preprocess.c +++ b/lang/cem/cpp.ansi/preprocess.c @@ -102,6 +102,7 @@ do_pragma() char Xbuf[256]; +void preprocess(fn) char *fn; { diff --git a/lang/cem/cpp.ansi/replace.c b/lang/cem/cpp.ansi/replace.c index 255902f68..cd7d60696 100644 --- a/lang/cem/cpp.ansi/replace.c +++ b/lang/cem/cpp.ansi/replace.c @@ -26,6 +26,10 @@ extern char *strcat(); extern int InputLevel; struct repl *ReplaceList; /* list of currently active macros */ +void expand_defined(); +void getactuals(); +void macro2buffer(); + int replace(idf) register struct idf *idf; @@ -165,6 +169,7 @@ expand_macro(repl, idf) return 1; } +void expand_defined(repl) register struct repl *repl; { @@ -208,6 +213,7 @@ newarg(args) args->a_rawptr = args->a_rawbuf = Malloc((unsigned)(args->a_rawsize = ARGBUF)); } +void getactuals(repl, idf) struct repl *repl; register struct idf *idf; @@ -522,6 +528,7 @@ macro_func(idef) } } +void macro2buffer(repl, idf, args) register struct repl *repl; register struct idf *idf; diff --git a/lang/m2/comp/LLlex.c b/lang/m2/comp/LLlex.c index 1eacae76f..083947161 100644 --- a/lang/m2/comp/LLlex.c +++ b/lang/m2/comp/LLlex.c @@ -180,6 +180,7 @@ getch() return ch; } +void CheckForLineDirective() { register int ch = getch(); diff --git a/lang/m2/comp/casestat.C b/lang/m2/comp/casestat.C index d227e3117..a4c2285d2 100644 --- a/lang/m2/comp/casestat.C +++ b/lang/m2/comp/casestat.C @@ -54,6 +54,9 @@ struct case_entry { arith ce_low, ce_up; /* lower and upper bound of range */ }; +void AddCases(); +void AddOneCase(); + /* STATICALLOCDEF "case_entry" 20 */ /* The constant DENSITY determines when CSA and when CSB instructions @@ -237,6 +240,7 @@ FreeSh(sh) free_switch_hdr(sh); } +void AddCases(sh, node, lbl) struct switch_hdr *sh; register t_node *node; @@ -264,6 +268,7 @@ AddCases(sh, node, lbl) AddOneCase(sh, node, node, lbl); } +void AddOneCase(sh, lnode, rnode, lbl) register struct switch_hdr *sh; t_node *lnode, *rnode; diff --git a/lang/m2/comp/chk_expr.c b/lang/m2/comp/chk_expr.c index 7dbe5abc6..e87725688 100644 --- a/lang/m2/comp/chk_expr.c +++ b/lang/m2/comp/chk_expr.c @@ -53,6 +53,7 @@ df_error(nd, mess, edf) else node_error(nd, mess); } +void MkCoercion(pnd, tp) t_node **pnd; register t_type *tp; diff --git a/lang/m2/comp/code.c b/lang/m2/comp/code.c index f74231cb0..a6d283af6 100644 --- a/lang/m2/comp/code.c +++ b/lang/m2/comp/code.c @@ -37,6 +37,10 @@ extern char options[]; extern t_desig null_desig; int fp_used; +void RangeCheck(); +void CodeParameters(); +void CodeCall(); + CodeConst(cst, size) arith cst; int size; @@ -55,6 +59,7 @@ CodeConst(cst, size) } } +void CodeString(nd) register t_node *nd; { @@ -288,6 +293,7 @@ CodeCoercion(t1, t2) } } +void CodeCall(nd) register t_node *nd; { @@ -355,6 +361,7 @@ CodeCall(nd) DoLineno(nd); } +void CodeParameters(param, arg) t_param *param; register t_node *arg; @@ -672,6 +679,7 @@ needs_rangecheck(tpl, tpr) return 0; } +void RangeCheck(tpl, tpr) register t_type *tpl, *tpr; { diff --git a/lang/m2/comp/cstoper.c b/lang/m2/comp/cstoper.c index c55d4389f..b7b13f9a4 100644 --- a/lang/m2/comp/cstoper.c +++ b/lang/m2/comp/cstoper.c @@ -45,6 +45,8 @@ arith min_int[] = { 0L, -128L, -32768L, 0L, -2147483647L-1 }; extern char options[]; +void CutSize(); + overflow(expp) t_node *expp; { @@ -160,6 +162,7 @@ divide(pdiv, prem) #endif } +void cstibin(expp) t_node **expp; { @@ -351,6 +354,7 @@ cstfbin(expp) CutSize(exp); } +void cstubin(expp) t_node **expp; { @@ -457,6 +461,7 @@ cstubin(expp) CutSize(exp); } +void cstset(expp) t_node **expp; { @@ -648,6 +653,7 @@ cstcall(expp, call) } } +void CutSize(expr) register t_node *expr; { diff --git a/lang/m2/comp/desig.c b/lang/m2/comp/desig.c index f2ea83a81..2a6ae34be 100644 --- a/lang/m2/comp/desig.c +++ b/lang/m2/comp/desig.c @@ -533,6 +533,7 @@ CodeFieldDesig(df, ds) } } +void CodeVarDesig(df, ds) register t_def *df; register t_desig *ds; diff --git a/lang/m2/comp/enter.c b/lang/m2/comp/enter.c index 12f3e4e9d..ecd004fde 100644 --- a/lang/m2/comp/enter.c +++ b/lang/m2/comp/enter.c @@ -247,6 +247,7 @@ EnterParamList(ppr, Idlist, type, VARp, off) STATIC t_def *DoImport(); +void ImportEffects(idef, scope, flag) register t_def *idef; t_scope *scope; @@ -481,6 +482,7 @@ CheckForImports(df) } } +void EnterFromImportList(idlist, FromDef, FromId) register t_node *idlist; register t_def *FromDef; diff --git a/lang/m2/comp/error.c b/lang/m2/comp/error.c index 410f7d15f..26b5512b4 100644 --- a/lang/m2/comp/error.c +++ b/lang/m2/comp/error.c @@ -61,6 +61,8 @@ extern char *symbol2str(); node, whereas other errors use the information in the token. */ +void _error(); + #if __STDC__ #ifdef DEBUG /*VARARGS*/ @@ -318,6 +320,7 @@ crash(va_alist) } #endif +void _error(class, node, fmt, ap, warn_class) int class; t_node *node; diff --git a/lang/m2/comp/node.c b/lang/m2/comp/node.c index 910769e0d..43db6a239 100644 --- a/lang/m2/comp/node.c +++ b/lang/m2/comp/node.c @@ -81,6 +81,7 @@ dot2leaf(class) return nd; } +void FreeNode(nd) register t_node *nd; { diff --git a/lang/m2/comp/stab.c b/lang/m2/comp/stab.c index 5aae2a1e5..4f4e2e3ac 100644 --- a/lang/m2/comp/stab.c +++ b/lang/m2/comp/stab.c @@ -71,7 +71,7 @@ adds_db_str(s) while (*s) addc_db_str(*s++); } -static +static void stb_type(tp, assign_num) register t_type *tp; { diff --git a/lang/m2/comp/type.c b/lang/m2/comp/type.c index 247e5e280..b70f2b4b1 100644 --- a/lang/m2/comp/type.c +++ b/lang/m2/comp/type.c @@ -74,6 +74,8 @@ t_type *std_type, *error_type; +void ArraySizes(); + t_type * construct_type(fund, tp) int fund; @@ -576,6 +578,7 @@ ArrayElSize(tp) } } +void ArraySizes(tp) register t_type *tp; { diff --git a/lang/m2/comp/walk.c b/lang/m2/comp/walk.c index de9a63552..93cc3308b 100644 --- a/lang/m2/comp/walk.c +++ b/lang/m2/comp/walk.c @@ -64,7 +64,7 @@ static int WalkDef(); static int stabdef(); #endif static int MkCalls(); -static int UseWarnings(); +static void UseWarnings(); #define NO_EXIT_LABEL ((label) 0) #define RETURN_LABEL ((label) 1) @@ -72,6 +72,8 @@ static int UseWarnings(); #define REACH_FLAG 1 #define EXIT_FLAG 2 +void DoAssign(); + int LblWalkNode(lbl, nd, exit, reach) label lbl, exit; @@ -995,6 +997,7 @@ node_warning(nd, W_OLDFASHIONED, "compatibility required in FOR statement"); return 1; } +void DoAssign(nd) register t_node *nd; { @@ -1057,7 +1060,7 @@ RegisterMessage(df) } } -static +static void df_warning(nd, df, warning) t_node *nd; t_def *df; @@ -1080,7 +1083,7 @@ df_warning(nd, df, warning) } } -static +static void UseWarnings(df) register t_def *df; { diff --git a/lang/pc/comp/LLlex.c b/lang/pc/comp/LLlex.c index 6074870f7..7bd857a2b 100644 --- a/lang/pc/comp/LLlex.c +++ b/lang/pc/comp/LLlex.c @@ -120,7 +120,7 @@ CommentOptions() } -STATIC +STATIC void SkipComment() { /* Skip ISO-Pascal comments (* ... *) or { ... }. @@ -216,6 +216,7 @@ register int delim; static char *s_error = "illegal line directive"; +void CheckForLineDirective() { register int ch; diff --git a/lang/pc/comp/body.c b/lang/pc/comp/body.c index f2f7a1a04..091ab6927 100644 --- a/lang/pc/comp/body.c +++ b/lang/pc/comp/body.c @@ -47,6 +47,7 @@ MarkDef(nd, flags, on) } } +void AssertStat(expp, line) register struct node *expp; unsigned short line; @@ -69,6 +70,7 @@ AssertStat(expp, line) } } +void AssignStat(left, right) register struct node *left, *right; { @@ -131,6 +133,7 @@ AssignStat(left, right) FreeNode(right); } +void ProcStat(nd) register struct node *nd; { @@ -142,6 +145,7 @@ ProcStat(nd) } } +void ChkForStat(nd) register struct node *nd; { @@ -202,6 +206,7 @@ ChkForStat(nd) return; } +void EndForStat(nd) register struct node *nd; { @@ -283,6 +288,7 @@ CodeEndFor(nd, stepsize, l1, l2, tmp2) C_asp(int_size); } +void WithStat(nd) struct node *nd; { diff --git a/lang/pc/comp/casestat.C b/lang/pc/comp/casestat.C index 61eba13f7..554a6216d 100644 --- a/lang/pc/comp/casestat.C +++ b/lang/pc/comp/casestat.C @@ -40,6 +40,7 @@ struct case_entry { */ #define compact(nr, low, up) (nr != 0 && (up - low) / nr <= DENSITY) +void CaseExpr(nd) struct node *nd; { @@ -62,6 +63,7 @@ CaseExpr(nd) } } +void CaseEnd(nd, exit_label) struct node *nd; label exit_label; diff --git a/lang/pc/comp/code.c b/lang/pc/comp/code.c index 17f0f7c32..1c916c3dc 100644 --- a/lang/pc/comp/code.c +++ b/lang/pc/comp/code.c @@ -24,6 +24,11 @@ int fp_used; +void Long2Int(); +void Int2Long(); +void genrck(); +void CodeCall(); + CodeFil() { if ( !options['L'] ) @@ -791,6 +796,7 @@ CodePString(nd, tp) C_loi(tp->tp_size); } +void CodeCall(nd) register struct node *nd; { @@ -1095,6 +1101,7 @@ CodeStd(nd) } } +void Long2Int() { /* convert a long to integer */ @@ -1106,6 +1113,7 @@ Long2Int() C_cii(); } +void Int2Long() { /* convert integer to long */ @@ -1160,6 +1168,7 @@ RangeCheck(tpl, tpr) } } +void genrck(tp) register struct type *tp; { diff --git a/lang/pc/comp/cstoper.c b/lang/pc/comp/cstoper.c index be9dbc387..c4196e522 100644 --- a/lang/pc/comp/cstoper.c +++ b/lang/pc/comp/cstoper.c @@ -66,6 +66,7 @@ cstunary(expp) expp->nd_right = NULLNODE; } +void cstbin(expp) register struct node *expp; { @@ -195,6 +196,7 @@ cstbin(expp) expp->nd_left = expp->nd_right = NULLNODE; } +void cstset(expp) register struct node *expp; { diff --git a/lang/pc/comp/def.c b/lang/pc/comp/def.c index dfc33f459..745bb48e0 100644 --- a/lang/pc/comp/def.c +++ b/lang/pc/comp/def.c @@ -116,6 +116,7 @@ define(id, scope, kind) return MkDef(id, scope, kind); } +void DoDirective(directive, nd, tp, scl, function) struct idf *directive; struct node *nd; diff --git a/lang/pc/comp/desig.c b/lang/pc/comp/desig.c index 68c5512a9..566bb36a4 100644 --- a/lang/pc/comp/desig.c +++ b/lang/pc/comp/desig.c @@ -26,6 +26,7 @@ struct desig InitDesig = {DSG_INIT, 0, 0, NULLDEF, 0}; struct withdesig *WithDesigs; +void CodeValue(); STATIC int properly(ds, size, al) @@ -71,6 +72,7 @@ CodeCopy(lhs, rhs, sz, psize) C_sti(sz); } +void CodeMove(rhs, left, rtp) register struct desig *rhs; register struct node *left; @@ -150,6 +152,7 @@ CodeMove(rhs, left, rtp) } } +void CodeValue(ds, tp) register struct desig *ds; register struct type *tp; @@ -366,6 +369,7 @@ CodeFieldDesig(df, ds) ds->dsg_packed = df->fld_flags & F_PACKED; } +void CodeVarDesig(df, ds) register struct def *df; register struct desig *ds; diff --git a/lang/pc/comp/error.c b/lang/pc/comp/error.c index 8a381c6fe..dd75c79e6 100644 --- a/lang/pc/comp/error.c +++ b/lang/pc/comp/error.c @@ -39,6 +39,8 @@ int err_occurred; extern char *symbol2str(); +void _error(); + /* There are three general error-message functions: lexerror() lexical and pre-processor error messages error() syntactic and pre-processor messagese @@ -304,6 +306,7 @@ crash(va_alist) } #endif +void _error(class, node, fmt, ap) int class; struct node *node; diff --git a/lang/pc/comp/label.c b/lang/pc/comp/label.c index 73745ba21..b303b7dc5 100644 --- a/lang/pc/comp/label.c +++ b/lang/pc/comp/label.c @@ -12,6 +12,8 @@ #include "scope.h" #include "type.h" +void CodeLabel(); + DeclLabel(nd) struct node *nd; @@ -103,6 +105,7 @@ TstLabel(nd, Slevel) CodeLabel(df, 1); } +void DefLabel(nd, Slevel) register struct node *nd; { @@ -139,6 +142,7 @@ DefLabel(nd, Slevel) } } +void CodeLabel(df, local) register struct def *df; { diff --git a/lang/pc/comp/node.c b/lang/pc/comp/node.c index 889e855f8..1d8a491f0 100644 --- a/lang/pc/comp/node.c +++ b/lang/pc/comp/node.c @@ -42,6 +42,7 @@ MkLeaf(class, token) return nd; } +void FreeNode(nd) register struct node *nd; { diff --git a/lang/pc/comp/progs.c b/lang/pc/comp/progs.c index 173767526..6ed227eb9 100644 --- a/lang/pc/comp/progs.c +++ b/lang/pc/comp/progs.c @@ -15,6 +15,8 @@ static int inpflag = 0; /* input mentioned in heading ? */ static int outpflag = 0; /* output mentioned in heading ? */ static label extfl_label; /* label of array of file pointers */ +void make_extfl_args(); + set_inp() { inpflag = 1; @@ -25,6 +27,7 @@ set_outp() outpflag = 1; } +void make_extfl() { if( err_occurred ) return; @@ -54,6 +57,7 @@ make_extfl() make_extfl_args( GlobalScope->sc_def ); } +void make_extfl_args(df) register struct def *df; { diff --git a/lang/pc/comp/readwrite.c b/lang/pc/comp/readwrite.c index 7b62aaede..35ed8860d 100644 --- a/lang/pc/comp/readwrite.c +++ b/lang/pc/comp/readwrite.c @@ -19,6 +19,12 @@ extern char *sprint(); +void CodeRead(); +void CodeReadln(); +void CodeWrite(); +void CodeWriteln(); + +void ChkRead(arg) register struct node *arg; { @@ -86,6 +92,7 @@ ChkRead(arg) } } +void ChkReadln(arg) register struct node *arg; { @@ -142,6 +149,7 @@ ChkReadln(arg) CodeReadln(file); } +void ChkWrite(arg) register struct node *arg; { @@ -183,6 +191,7 @@ ChkWrite(arg) } } +void ChkWriteln(arg) register struct node *arg; { @@ -318,6 +327,7 @@ ChkStdInOut(name, st_out) return nd; } +void CodeRead(file, arg) register struct node *file, *arg; { @@ -376,6 +386,7 @@ CodeRead(file, arg) } } +void CodeReadln(file) struct node *file; { @@ -386,6 +397,7 @@ CodeReadln(file) C_asp(pointer_size); } +void CodeWrite(file, arg) register struct node *file, *arg; { @@ -472,6 +484,7 @@ CodeWrite(file, arg) } } +void CodeWriteln(file) register struct node *file; { diff --git a/lang/pc/comp/stab.c b/lang/pc/comp/stab.c index d5e4ee3fb..0b8c52f23 100644 --- a/lang/pc/comp/stab.c +++ b/lang/pc/comp/stab.c @@ -71,7 +71,7 @@ adds_db_str(s) while (*s) addc_db_str(*s++); } -static +static void stb_type(tp, assign_num) register struct type *tp; { @@ -247,6 +247,7 @@ stb_addtp(s, tp) (arith) 0); } +void stb_string(df, kind) register struct def *df; long kind; diff --git a/lang/pc/comp/type.c b/lang/pc/comp/type.c index b5662c658..faca8fee5 100644 --- a/lang/pc/comp/type.c +++ b/lang/pc/comp/type.c @@ -51,6 +51,8 @@ struct type *void_type, *error_type; +void ArraySizes(); + CheckTypeSizes() { /* first, do some checking @@ -442,6 +444,7 @@ ArrayElSize(tp, packed) return algn; } +void ArraySizes(tp) register struct type *tp; { @@ -489,6 +492,7 @@ ArraySizes(tp) C_rom_cst(tp->arr_elsize); } +void FreeForward(for_type) register struct forwtype *for_type; { diff --git a/mach/i386/as/mach5.c b/mach/i386/as/mach5.c index 9853c6c0c..8d638c922 100644 --- a/mach/i386/as/mach5.c +++ b/mach/i386/as/mach5.c @@ -38,6 +38,7 @@ ea_1_16(param) } } +void ea_1(param) { if (! address_long) { ea_1_16(param); @@ -134,6 +135,7 @@ regsize(sz) } } +void indexed() { if (address_long) { mod_2 = 0; diff --git a/mach/i386/ncg/mach.c b/mach/i386/ncg/mach.c index e3b74053a..7514d6775 100644 --- a/mach/i386/ncg/mach.c +++ b/mach/i386/ncg/mach.c @@ -61,6 +61,7 @@ string holstr(n) word n; { full lbytes; #endif +void prolog(nlocals) full nlocals; { fputs("push ebp\nmov ebp,esp\n", codefile); @@ -179,6 +180,7 @@ mach_option(s) } #endif /* MACH_OPTIONS */ +void mes(type) word type ; { int argt, a1, a2 ; diff --git a/mach/i80/ncg/mach.c b/mach/i80/ncg/mach.c index 7cf0b92a5..9f952f0d9 100644 --- a/mach/i80/ncg/mach.c +++ b/mach/i80/ncg/mach.c @@ -54,6 +54,7 @@ con_float() { } +void prolog(nlocals) full nlocals; { fprintf(codefile,"\tpush\tb\n\tlxi\th,0\n\tdad\tsp\n\tmov\tb,h\n\tmov\tc,l\n"); @@ -67,6 +68,7 @@ prolog(nlocals) full nlocals; { } } +void mes(type) word type ; { int argt ; diff --git a/mach/i86/ncg/mach.c b/mach/i86/ncg/mach.c index e222522ad..a305d6d9a 100644 --- a/mach/i86/ncg/mach.c +++ b/mach/i86/ncg/mach.c @@ -61,6 +61,7 @@ string holstr(n) word n; { full lbytes; #endif +void prolog(nlocals) full nlocals; { fputs("\tpush\tbp\n\tmov\tbp,sp\n", codefile); @@ -157,6 +158,7 @@ regreturn() } #endif /* REGVARS */ +void mes(type) word type ; { int argt ; diff --git a/mach/m68020/as/mach5.c b/mach/m68020/as/mach5.c index 12ccf087a..e623bd01f 100644 --- a/mach/m68020/as/mach5.c +++ b/mach/m68020/as/mach5.c @@ -21,6 +21,8 @@ * then emitted in one go, by emit_instr(). */ +void move_special(); + emit_instr() { register instr_t *ip; @@ -70,6 +72,7 @@ long words; T_EMIT2((short)(words), 0, 0, 0); } +void ea_1(sz, bits) { /* Because displacements come in three sizes (null displacement, @@ -242,6 +245,7 @@ badoperand() serror("bad operand(s)"); } +void shift_op(opc, sz) { if (mrg_1 < 010 && mrg_2 < 010) { @@ -263,6 +267,7 @@ shift_op(opc, sz) ea_2(SIZE_W, MEM|ALT); } +void bitop(opc) { register bits; @@ -291,6 +296,7 @@ bitfield(opc, extension) ea_2(SIZE_L, (mrg_2 < 010) ? 0 : (CTR | ALT)); } +void add(opc, sz) { if ((mrg_2 & 070) == 010) @@ -326,6 +332,7 @@ add(opc, sz) badoperand(); } +void and(opc, sz) { if (mrg_1 == 074 && mrg_2 >= 076) { /* ccr or sr */ @@ -370,6 +377,7 @@ from_dreg(opc, sz, bits) return(1); } +void cmp(sz) { register opc; @@ -416,6 +424,7 @@ link_instr(sz, areg) ea_2(sz, 0); } +void move(sz) { register opc; @@ -448,6 +457,7 @@ move(sz) ea_2(sz, ALT); } +void move_special(sz) { if (mrg_2 >= 076) { @@ -514,6 +524,7 @@ reverse(regs, max) return regs; } +void movep(sz) { checksize(sz, 2|4); @@ -530,6 +541,7 @@ movep(sz) badoperand(); } +void branch(opc, exp) expr_t exp; { @@ -566,6 +578,7 @@ expr_t exp; T_EMIT4(exp.val, exp.typ, RELPC|RELO4, relonami); } +void cpbcc(opc, exp) expr_t exp; { @@ -593,6 +606,7 @@ expr_t exp; T_EMIT4(exp.val, exp.typ, RELPC|RELO4, relonami); } +void ea7071(sz) { mrg_2 = 071; @@ -671,6 +685,7 @@ ea7071(sz) mrg_2 = 070; } +void fbranch(opc, exp) expr_t exp; { diff --git a/mach/m68020/ncg/mach.c b/mach/m68020/ncg/mach.c index 6759772f7..915b4f6e2 100644 --- a/mach/m68020/ncg/mach.c +++ b/mach/m68020/ncg/mach.c @@ -187,6 +187,7 @@ regsave(s,off,size) fprintf(codefile, "!Local %ld into %s\n",off,s); } +void prolog(n) full n; { nlocals = n; @@ -207,6 +208,7 @@ mach_option(s) } #endif /* MACH_OPTIONS */ +void mes(type) word type ; { int argt, a1, a2 ; diff --git a/mach/powerpc/ncg/mach.c b/mach/powerpc/ncg/mach.c index 39c6362e6..e4ab3c078 100644 --- a/mach/powerpc/ncg/mach.c +++ b/mach/powerpc/ncg/mach.c @@ -56,6 +56,7 @@ con_mult(word sz) #define FL_MSB_AT_LOW_ADDRESS 1 #include +void prolog(full nlocals) { int ss = nlocals + 8; @@ -68,6 +69,7 @@ prolog(full nlocals) framesize = nlocals; } +void mes(word type) { int argt ; diff --git a/mach/proto/as/comm4.c b/mach/proto/as/comm4.c index 9adff1ebf..473cb12e2 100644 --- a/mach/proto/as/comm4.c +++ b/mach/proto/as/comm4.c @@ -18,6 +18,9 @@ extern YYSTYPE yylval; +void setupoutput(); +void commfinish(); + /* ========== Machine independent C routines ========== */ void stop() { @@ -458,6 +461,7 @@ char *s; #endif } +void setupoutput() { register sect_t *sp; @@ -493,6 +497,7 @@ setupoutput() outhead.oh_nchar = off; /* see newsymb() */ } +void commfinish() { #ifndef ASLD diff --git a/mach/proto/as/comm5.c b/mach/proto/as/comm5.c index 276cc2f0c..7dee7c1a9 100644 --- a/mach/proto/as/comm5.c +++ b/mach/proto/as/comm5.c @@ -11,6 +11,8 @@ extern YYSTYPE yylval; +void putval(); + yylex() { register c; @@ -68,6 +70,7 @@ yylex() return(c); } +void putval(c) { register valu_t v; diff --git a/mach/proto/as/comm6.c b/mach/proto/as/comm6.c index f5bd87f39..9cb943cba 100644 --- a/mach/proto/as/comm6.c +++ b/mach/proto/as/comm6.c @@ -12,6 +12,10 @@ #include "comm1.h" #include "y.tab.h" +void switchsect(); +void newsymb(); +void newident(); + newequate(ip, typ) register item_t *ip; register int typ; @@ -34,6 +38,7 @@ register int typ; newident(ip, typ); } +void newident(ip, typ) register item_t *ip; { @@ -74,6 +79,7 @@ register item_t *ip; ); } +void newlabel(ip) register item_t *ip; { @@ -183,6 +189,7 @@ valu_t val; } } +void switchsect(newtyp) int newtyp; { @@ -242,6 +249,7 @@ valu_t bytes; } #ifdef RELOCATION +void newrelo(s, n) { int iscomm; @@ -326,6 +334,7 @@ new_string(s) return r; } +void newsymb(name, type, desc, valu) register char *name; valu_t valu; diff --git a/mach/proto/ncg/compute.c b/mach/proto/ncg/compute.c index f407aa8ae..d32417e68 100644 --- a/mach/proto/ncg/compute.c +++ b/mach/proto/ncg/compute.c @@ -120,6 +120,7 @@ string tostring(n) register word n; { return(mystrcpy(buf)); } +void compute(node, presult) register node_p node; register result_t *presult; { result_t leaf1,leaf2; register token_p tp; diff --git a/mach/proto/ncg/equiv.c b/mach/proto/ncg/equiv.c index a78123180..ace068882 100644 --- a/mach/proto/ncg/equiv.c +++ b/mach/proto/ncg/equiv.c @@ -29,6 +29,8 @@ int maxindex; int regclass[NREGS]; struct perm *perms; +void permute(); + struct perm * tuples(regls,nregneeded) rl_p *regls; { int class=0; @@ -64,6 +66,7 @@ tuples(regls,nregneeded) rl_p *regls; { return(perms); } +void permute(index) { register struct perm *pp; register rl_p rlp; diff --git a/mach/proto/ncg/fillem.c b/mach/proto/ncg/fillem.c index 516239b3d..447faeb41 100644 --- a/mach/proto/ncg/fillem.c +++ b/mach/proto/ncg/fillem.c @@ -83,6 +83,13 @@ extern short em_ptyp[]; extern double atof(); void prolog(full nlocals); +void mes(); +void bss(); +void savelab(); +void dumplab(); +void part_flush(); +void xdumplab(); +void switchseg(); /* Own version of atol that continues computing on overflow. We don't know that about the ANSI C one. @@ -136,6 +143,7 @@ in_start() { in_finish() { } +void fillemlines() { register int t,i; register struct emline *lp; @@ -226,6 +234,7 @@ fillemlines() { } } +void dopseudo() { register b,t; register full n; @@ -605,6 +614,7 @@ char *strarg(t) { return(mystrcpy(argstr)); } +void bss(n,t,b) full n; { register long s = 0; @@ -677,6 +687,7 @@ swtxt() { switchseg(SEGTXT); } +void switchseg(s) { if (s == curseg) @@ -686,6 +697,7 @@ switchseg(s) { fprintf(codefile,"%s\n",segname[s]); } +void savelab() { register char *p,*q; @@ -700,6 +712,7 @@ savelab() { ; } +void dumplab() { if (labstr[0] == 0) @@ -709,6 +722,7 @@ dumplab() { labstr[0] = 0; } +void xdumplab() { if (labstr[0] == 0) @@ -717,6 +731,7 @@ xdumplab() { newdlb(labstr); } +void part_flush() { /* diff --git a/mach/proto/ncg/gencode.c b/mach/proto/ncg/gencode.c index b9b89022c..415d59f51 100644 --- a/mach/proto/ncg/gencode.c +++ b/mach/proto/ncg/gencode.c @@ -108,6 +108,7 @@ gennl() { putc('\n',codefile); } +void prtoken(tp,leadingchar) token_p tp; { register c; register char *code; diff --git a/mach/proto/ncg/label.c b/mach/proto/ncg/label.c index 88e36ee2e..0c192589c 100644 --- a/mach/proto/ncg/label.c +++ b/mach/proto/ncg/label.c @@ -7,6 +7,7 @@ static label_p label_list = (label_p)0; extern char *myalloc(); +void add_label(num, height, flth) { register label_p lbl = (label_p)0; diff --git a/mach/proto/ncg/regvar.c b/mach/proto/ncg/regvar.c index dd791d60a..4c11da2b1 100644 --- a/mach/proto/ncg/regvar.c +++ b/mach/proto/ncg/regvar.c @@ -42,6 +42,7 @@ linkreg(of,sz,tp,sc) long of; { return(rvlp); } +void tryreg(rvlp,typ) register struct regvar *rvlp; { int score; register i; diff --git a/mach/proto/ncg/salloc.c b/mach/proto/ncg/salloc.c index 1826f1793..e110d75ad 100644 --- a/mach/proto/ncg/salloc.c +++ b/mach/proto/ncg/salloc.c @@ -32,6 +32,8 @@ static char rcsid[] = "$Id$"; char *stab[MAXSTAB]; int nstab=0; +void chkstr(); + string myalloc(size) { register string p; @@ -72,6 +74,7 @@ compar(p1,p2) char **p1,**p2; { return(1); } +void garbage_collect() { register i; struct emline *emlp; @@ -116,6 +119,7 @@ garbage_collect() { nstab = fillp-stab; } +void chkstr(str,used) string str; char used[]; { register low,middle,high; diff --git a/mach/proto/ncg/state.c b/mach/proto/ncg/state.c index 23d074bc7..4656ba872 100644 --- a/mach/proto/ncg/state.c +++ b/mach/proto/ncg/state.c @@ -23,6 +23,8 @@ static char rcsid[] = "$Id$"; extern int nstab; /* salloc.c */ +void bmove(); + savestatus(sp) register state_p sp; { sp->st_sh = stackheight; @@ -57,6 +59,7 @@ restorestatus(sp) register state_p sp; { popstr(sp->st_ns); } +void bmove(from,to,nbytes) register short *from,*to; register nbytes; { if (nbytes<=0) diff --git a/mach/proto/ncg/subr.c b/mach/proto/ncg/subr.c index 7d99ebcee..0f1b8edc4 100644 --- a/mach/proto/ncg/subr.c +++ b/mach/proto/ncg/subr.c @@ -49,6 +49,7 @@ match(tp,tep,optexp) register token_p tp; register set_p tep; { return(result.e_v.e_con); } +void instance(instno,token) register token_p token; { register inst_p inp; int i; @@ -145,6 +146,7 @@ instance(instno,token) register token_p token; { } } +void cinstance(instno,token,tp,regno) register token_p token,tp; { register inst_p inp; int i; diff --git a/mach/proto/top/top.c b/mach/proto/top/top.c index 5a9f842f8..178dd450e 100644 --- a/mach/proto/top/top.c +++ b/mach/proto/top/top.c @@ -23,6 +23,9 @@ struct variable ANY; /* ANY symbol matching any instruction */ char *REST; /* Opcode of first instruction not matched by current pattern */ +void labeldef(); +void set_opcode(); + #include "gen.c" @@ -170,6 +173,7 @@ write_first(w) /* Try to recognize the opcode part of an instruction */ +void set_opcode(ip) register instr_p ip; { @@ -318,6 +322,7 @@ bool split_operands(ip) +void labeldef(ip) register instr_p ip; { diff --git a/mach/vc4/ncg/mach.c b/mach/vc4/ncg/mach.c index 124e8a965..8832f744f 100644 --- a/mach/vc4/ncg/mach.c +++ b/mach/vc4/ncg/mach.c @@ -54,7 +54,7 @@ void prolog(full nlocals) framesize = nlocals; } -mes(word type) +void mes(word type) { int argt ; diff --git a/util/LLgen/src/check.c b/util/LLgen/src/check.c index 21d8a9f93..6efe80c02 100644 --- a/util/LLgen/src/check.c +++ b/util/LLgen/src/check.c @@ -40,9 +40,9 @@ STATIC prline(); STATIC printset(); STATIC int check(); STATIC moreverbose(); -STATIC prrule(); +STATIC void prrule(p_gram p); STATIC cfcheck(); -STATIC resolve(); +STATIC void resolve(p_gram p); STATIC propagate(); STATIC spaces(); @@ -283,7 +283,7 @@ moreverbose(t) register p_set t; { } STATIC -prrule(p) register p_gram p; { +void prrule(p_gram p) { /* * Create a verbose printout of grammar rule p */ @@ -420,7 +420,7 @@ cfcheck(s1,s2,flag) p_set s1,s2; { } STATIC -resolve(p) register p_gram p; { +void resolve(p_gram p) { /* * resolve conflicts, as specified by the user */ diff --git a/util/LLgen/src/compute.c b/util/LLgen/src/compute.c index c17d99d73..c16c6725c 100644 --- a/util/LLgen/src/compute.c +++ b/util/LLgen/src/compute.c @@ -41,7 +41,7 @@ typedef struct lngth { /* Defined in this file : */ extern do_compute(); STATIC createsets(); -STATIC walk(); +STATIC void walk(); STATIC co_trans(); STATIC int nempty(); extern empty(); @@ -49,15 +49,15 @@ STATIC int nfirst(); STATIC first(); STATIC int nfollow(); STATIC follow(); -STATIC co_dirsymb(); +STATIC void co_dirsymb(); STATIC co_others(); STATIC do_lengthcomp(); -STATIC complength(); -STATIC add(); +STATIC void complength(); +STATIC void add(); STATIC int compare(); -STATIC setdefaults(); +STATIC void setdefaults(); STATIC do_contains(); -STATIC contains(); +STATIC void contains(); STATIC int nsafes(); STATIC int do_safes(); #ifdef NON_CORRECTING @@ -208,7 +208,7 @@ createsets() { } } -STATIC +STATIC void walk(u, p) p_set u; register p_gram p; { /* * Walk through the grammar rule p, allocating sets @@ -658,7 +658,7 @@ nc_follow(setp,p) p_set setp; register p_gram p; { #endif -STATIC +STATIC void co_dirsymb(setp,p) p_set setp; register p_gram p; { /* * Walk the rule p, doing the work for alternations @@ -777,7 +777,7 @@ do_lengthcomp() { free ((p_mem) length); } -STATIC +STATIC void complength(p,le) register p_gram p; p_length le; { /* * Walk grammar rule p, computing minimum lengths @@ -862,7 +862,7 @@ complength(p,le) register p_gram p; p_length le; { } } -STATIC +STATIC void add(a, c, v) register p_length a; { if (a->cnt == INFINITY || c == INFINITY) { @@ -879,7 +879,7 @@ compare(a, b) register p_length a, b; { return a->val - b->val; } -STATIC +STATIC void setdefaults(p) register p_gram p; { for (;;) { switch(g_gettype(p)) { @@ -949,7 +949,7 @@ do_contains(n) register p_nont n; { } } -STATIC +STATIC void contains(p,set) register p_gram p; register p_set set; { /* * Does the real computation of the contains-sets diff --git a/util/LLgen/src/gencode.c b/util/LLgen/src/gencode.c index 94dd312ca..484319511 100644 --- a/util/LLgen/src/gencode.c +++ b/util/LLgen/src/gencode.c @@ -57,24 +57,24 @@ STATIC genncrecovery(); #endif STATIC string genname(); STATIC generate(); -STATIC prset(); -STATIC macro(); +STATIC void prset(); +STATIC void macro(); STATIC controlline(); STATIC getparams(); STATIC getansiparams(); STATIC genprototypes(); STATIC gettok(); -STATIC rulecode(); +STATIC void rulecode(); STATIC int * dopush(); STATIC int * mk_tokenlist(); -STATIC getaction(); -STATIC alternation(); +STATIC void getaction(); +STATIC void alternation(); STATIC codeforterm(); STATIC genswhead(); STATIC gencases(); STATIC genpush(); STATIC genpop(); -STATIC genincrdecr(); +STATIC void genincrdecr(); STATIC add_cases(); STATIC int analyze_switch(); STATIC out_list(); @@ -414,7 +414,7 @@ generate(f) p_file f; { } } -STATIC +STATIC void prset(p) p_set p; { register int k; register unsigned i; @@ -435,7 +435,7 @@ prset(p) p_set p; { /* NOTREACHED */ } -STATIC +STATIC void macro(s,n) string s; p_nont n; { int i; @@ -625,7 +625,7 @@ gettok() { } } -STATIC +STATIC void rulecode(p,safety,mustscan,mustpop) register p_gram p; { /* * Code for a production rule. @@ -735,7 +735,7 @@ rulecode(p,safety,mustscan,mustpop) register p_gram p; { } } -STATIC +STATIC void alternation(pp, safety, mustscan, mustpop, lb) p_gram pp; { @@ -956,7 +956,7 @@ dopush(p,safety,toplevel,pp) register p_gram p; int **pp; { # define max(a,b) ((a) < (b) ? (b) : (a)) -STATIC +STATIC void getaction(flag) { /* Read an action from the action file. * flag = 1 if it is an action, @@ -1252,7 +1252,7 @@ genpush(d) { genincrdecr("incr", d); } -STATIC +STATIC void genincrdecr(s, d) string s; { if (d == NOPOP) return; if (d >= 0) { diff --git a/util/LLgen/src/main.c b/util/LLgen/src/main.c index 733c0d81a..ca4b05f22 100644 --- a/util/LLgen/src/main.c +++ b/util/LLgen/src/main.c @@ -36,7 +36,7 @@ extern error(); extern fatal(); extern comfatal(); extern copyfile(); -extern install(); +extern void install(); extern char *mktemp(); extern char *sbrk(); @@ -279,6 +279,7 @@ error(lineno,s,t,u) string s,t,u; { } /* VARARGS1 */ +void warning(lineno,s,t,u) string s,t,u; { /* * Just a warning @@ -327,6 +328,7 @@ copyfile(file) string file; { fclose(f); } +void install(target, source) string target, source; { /* * Copy the temporary file generated from source to target diff --git a/util/LLgen/src/reach.c b/util/LLgen/src/reach.c index a950539d2..a8ca81a47 100644 --- a/util/LLgen/src/reach.c +++ b/util/LLgen/src/reach.c @@ -29,7 +29,7 @@ static string rcsid8 = "$Id$"; /* In this file the following routines are defined: */ extern co_reach(); STATIC reachable(); -STATIC reachwalk(); +STATIC void reachwalk(); co_reach() { /* @@ -94,7 +94,7 @@ reachable(p) register p_nont p; { } } -STATIC +STATIC void reachwalk(p) register p_gram p; { /* * Walk through rule p, looking for nonterminals. diff --git a/util/LLgen/src/savegram.c b/util/LLgen/src/savegram.c index 625dc1bab..a32935ecc 100644 --- a/util/LLgen/src/savegram.c +++ b/util/LLgen/src/savegram.c @@ -41,8 +41,8 @@ extern p_set start_firsts; extern p_set setalloc(); extern p_gram search(); -STATIC save_rule(); -STATIC save_set(); +STATIC void save_rule(); +STATIC void save_set(); /* t_list will contain terms to be `flattened' */ static struct t_list { @@ -267,7 +267,7 @@ save_grammar(f) FILE *f; { fprintf(fgram, "#define LLNNONTERMINALS %d\n", nt_highest - assval + 1); } -STATIC +STATIC void save_rule(p, tail) register p_gram p; int tail; { /* Walk through rule p, saving it. The non-terminal tail is @@ -363,7 +363,7 @@ save_rule(p, tail) register p_gram p; int tail; { } } -STATIC +STATIC void save_set(p) p_set p; { register int k; register unsigned i; diff --git a/util/LLgen/src/tokens.c b/util/LLgen/src/tokens.c index 8fa2b3613..6526ec1a3 100644 --- a/util/LLgen/src/tokens.c +++ b/util/LLgen/src/tokens.c @@ -92,13 +92,13 @@ extern int scanner(); extern LLmessage(); extern int input(); extern unput(); -extern skipcomment(); +extern void skipcomment(); # ifdef LINE_DIRECTIVE STATIC linedirective(); # endif STATIC string cpy(); STATIC string vallookup(); -STATIC copyact(); +STATIC void copyact(); static int nparams; # line 75 "tokens.g" @@ -144,7 +144,7 @@ static t_token savedtok; /* to save lextoken in case of an insertion */ static int nostartline; /* = 0 if at the start of a line */ # endif -STATIC +STATIC void copyact(ch1,ch2,flag,level) char ch1,ch2; { /* * Copy an action to file f. Opening bracket is ch1, closing bracket @@ -419,7 +419,7 @@ unput(c) { backupc = c; } -skipcomment(flag) { +void skipcomment(flag) { /* * Skip comment. If flag != 0, the comment is inside a fragment * of C-code, so keep it. diff --git a/util/LLgen/src/tokens.g b/util/LLgen/src/tokens.g index fbdd83d2d..51b83fcb3 100644 --- a/util/LLgen/src/tokens.g +++ b/util/LLgen/src/tokens.g @@ -33,13 +33,13 @@ extern int scanner(); extern LLmessage(); extern int input(); extern unput(); -extern skipcomment(); +extern void skipcomment(); # ifdef LINE_DIRECTIVE STATIC linedirective(); # endif STATIC string cpy(); STATIC string vallookup(); -STATIC copyact(); +STATIC void copyact(); static int nparams; } @@ -114,7 +114,7 @@ static t_token savedtok; /* to save lextoken in case of an insertion */ static int nostartline; /* = 0 if at the start of a line */ # endif -STATIC +STATIC void copyact(ch1,ch2,flag,level) char ch1,ch2; { /* * Copy an action to file f. Opening bracket is ch1, closing bracket @@ -389,6 +389,7 @@ unput(c) { backupc = c; } +void skipcomment(flag) { /* * Skip comment. If flag != 0, the comment is inside a fragment diff --git a/util/ack/files.c b/util/ack/files.c index b47376b24..f2dbc8ed2 100644 --- a/util/ack/files.c +++ b/util/ack/files.c @@ -143,6 +143,7 @@ rmfile(file) path *file ; { } } +void rmtemps() { /* Called in case of disaster, always remove the current output file! */ diff --git a/util/ack/grows.c b/util/ack/grows.c index ca089d48c..81c3c002d 100644 --- a/util/ack/grows.c +++ b/util/ack/grows.c @@ -50,6 +50,7 @@ gr_cat(id,string) growstring *id ; char *string ; { } } +void gr_throw(id) register growstring *id ; { /* Throw the string away */ if ( id->gr_max==0 ) return ; diff --git a/util/ack/grows.h b/util/ack/grows.h index 558387488..9b9511049 100644 --- a/util/ack/grows.h +++ b/util/ack/grows.h @@ -20,7 +20,7 @@ typedef struct { /* Routines used */ -extern int gr_throw() ; /* To free the core */ +extern void gr_throw() ; /* To free the core */ extern int gr_add() ; /* To add one character */ extern int gr_cat() ; /* concatenate the contents and the string */ extern int gr_init() ; /* Initialize the bookkeeping */ diff --git a/util/ack/main.c b/util/ack/main.c index 82c18888e..99e27dceb 100644 --- a/util/ack/main.c +++ b/util/ack/main.c @@ -24,6 +24,8 @@ static int arg_count; extern char *getenv(); +void vieuwargs(); + main(argc,argv) char **argv ; { register list_elem *elem ; register char *frontend ; @@ -136,6 +138,7 @@ varinit() { /************************* flag processing ***********************/ +void vieuwargs(argc,argv) char **argv ; { register char *argp; register int nextarg ; diff --git a/util/ack/mktables.c b/util/ack/mktables.c index 1946d09ee..214b93606 100644 --- a/util/ack/mktables.c +++ b/util/ack/mktables.c @@ -22,6 +22,8 @@ FILE *dmach ; int offset ; +void readm(); + main(argc,argv) char **argv ; { register i ; @@ -70,6 +72,7 @@ FILE *do_open(file) char *file ; { return fopen(dname,"r"); } +void readm() { register int i ; register int token ; diff --git a/util/ack/rmach.c b/util/ack/rmach.c index 38b2a54b3..1e33e8713 100644 --- a/util/ack/rmach.c +++ b/util/ack/rmach.c @@ -55,6 +55,7 @@ int getinchar() ; static char *ty_name ; static char *bol ; +void open_in(); static char *inname ; @@ -263,6 +264,7 @@ static FILE *infile ; static char *inptr ; char *em_dir = EM_DIR; +void open_in(name) register char *name ; { register dmach *cmac ; diff --git a/util/ack/scan.c b/util/ack/scan.c index c4388b152..d020e6a5b 100644 --- a/util/ack/scan.c +++ b/util/ack/scan.c @@ -15,6 +15,8 @@ static char rcs_id[] = "$Id$" ; #endif +void try(); + enum f_path getpath(first) register trf **first ; { /* Try to find a transformation path */ @@ -61,6 +63,7 @@ start_scan() { last_ocount= 0 ; } +void try(f_scan,suffix) list_elem *f_scan; char *suffix; { register list_elem *scan ; register trf *trafo ; diff --git a/util/ack/trans.c b/util/ack/trans.c index 135b4c151..3cb2d7ea8 100644 --- a/util/ack/trans.c +++ b/util/ack/trans.c @@ -28,6 +28,10 @@ static int touch_tail= NO ; char *headvar(),*tailvar() ; +void condit(); +void doassign(); +void set_Rflag(); + int transform(phase) register trf *phase ; { int ok ; @@ -153,6 +157,7 @@ transini() { setpvar(keeps(TAIL),tailvar) ; } +void set_Rflag(argp) register char *argp ; { register char *eos ; register list_elem *prog ; @@ -413,6 +418,7 @@ growstring scanexpr(line) char *line ; { return result ; } +void condit(line,fsuff,lsuff,tailval) growstring *line ; list_head *fsuff, *lsuff; char *tailval ; @@ -504,6 +510,7 @@ int mapexpand(mapentry,cflag) return 1 ; } +void doassign(line,star,length) char *line, *star ; { growstring varval, name, temp ; register char *ptr ; @@ -598,6 +605,7 @@ char *c_rep(string,place,rep) char *string, *place, *rep ; { static list_head *curargs ; static list_head *comb_args ; +void addargs(string) char *string ; { register char *temp, *repc ; register list_elem *elem ; diff --git a/util/ack/util.c b/util/ack/util.c index a3d2d0511..419f087e3 100644 --- a/util/ack/util.c +++ b/util/ack/util.c @@ -32,6 +32,9 @@ extern int n_error; # define STDOUT stderr #endif +void fuerror(const char* fmt, ...); +void werror(const char* fmt, ...); + char *basename(string) char *string ; { static char retval[256] ; char *last_dot, *last_start ; diff --git a/util/amisc/anm.c b/util/amisc/anm.c index 161f6587f..f2469f772 100644 --- a/util/amisc/anm.c +++ b/util/amisc/anm.c @@ -35,6 +35,8 @@ long s_base[S_MAX]; /* for specially encoded bases */ char *filename; int narg; +void do_file(); + main(argc, argv) char **argv; { @@ -134,6 +136,7 @@ process(fd) } } +void do_file(fd) int fd; { diff --git a/util/arch/archiver.c b/util/arch/archiver.c index 38958ea5e..bae09a168 100644 --- a/util/arch/archiver.c +++ b/util/arch/archiver.c @@ -109,6 +109,10 @@ char *temp_arch = &temp_buf[0]; extern char *mktemp(); extern char *ctime(); +void do_object(); +void write_symdef(); +void add(); + usage() { error(TRUE, "usage: %s [qdprtxl][vlc] archive [file] ...\n", @@ -437,6 +441,7 @@ register char *argv[]; close(ar_fd); } +void add(name, fd, mess) char *name; int fd; @@ -630,6 +635,7 @@ char *s, *name; * then 4 bytes giving the size of the string table, followed by the string * table itself. */ +void write_symdef() { register struct ranlib *ran; @@ -683,6 +689,7 @@ is_outhead(headp) return !BADMAGIC(*headp) && headp->oh_nname != 0; } +void do_object(f, size) long size; { diff --git a/util/ego/bo/bo.c b/util/ego/bo/bo.c index c093fe8ab..9024e7b56 100644 --- a/util/ego/bo/bo.c +++ b/util/ego/bo/bo.c @@ -150,7 +150,7 @@ STATIC bo_optloop(p,b,x,bra,bcc) -STATIC bo_tryloop(p,loop) +STATIC void bo_tryloop(p,loop) proc_p p; lset loop; { @@ -207,6 +207,7 @@ STATIC mv_code(b1,b2) } } +void bo_switch(b) bblock_p b; { @@ -303,6 +304,7 @@ STATIC bo_cleanproc(p) } } +void bo_optimize(p) proc_p p; { diff --git a/util/ego/ca/ca.c b/util/ego/ca/ca.c index acfba4829..095736665 100644 --- a/util/ego/ca/ca.c +++ b/util/ego/ca/ca.c @@ -130,7 +130,7 @@ STATIC int makedmap(dbl) return cnt; } -STATIC getdnames(dumpd) +STATIC void getdnames(dumpd) FILE* dumpd; { /* Read the names of the datalabels from @@ -151,7 +151,7 @@ STATIC getdnames(dumpd) } } -STATIC getpnames(dumpp) +STATIC void getpnames(dumpp) FILE* dumpp; { /* Read the names of the procedures from diff --git a/util/ego/cf/cf_loop.c b/util/ego/cf/cf_loop.c index b3b2d5c70..61184eddc 100644 --- a/util/ego/cf/cf_loop.c +++ b/util/ego/cf/cf_loop.c @@ -298,7 +298,7 @@ STATIC mark_succ(b,lp) } -STATIC mark_blocks(lp) +STATIC void mark_blocks(lp) loop_p lp; { /* Mark the strong and firm blocks of a loop. diff --git a/util/ego/cj/cj.c b/util/ego/cj/cj.c index 2ae26f3da..1447af8a7 100644 --- a/util/ego/cj/cj.c +++ b/util/ego/cj/cj.c @@ -56,7 +56,7 @@ STATIC int Scj; /* number of optimizations found */ -STATIC showinstr(); +STATIC void showinstr(); @@ -289,6 +289,7 @@ STATIC bool try_pred(b) +void cj_optimize(p) proc_p p; { @@ -334,7 +335,7 @@ main(argc,argv) extern char em_mnem[]; /* The mnemonics of the EM instructions. */ -STATIC showinstr(lnp) line_p lnp; { +STATIC void showinstr(lnp) line_p lnp; { /* Makes the instruction in `lnp' human readable. Only lines that * can occur in expressions that are going to be eliminated are diff --git a/util/ego/cs/cs.c b/util/ego/cs/cs.c index 21e6b488f..df651c9c4 100644 --- a/util/ego/cs/cs.c +++ b/util/ego/cs/cs.c @@ -34,7 +34,7 @@ STATIC cs_clear() start_valnum(); } -STATIC cs_optimize(p) +STATIC void cs_optimize(p) proc_p p; { /* Optimize all basic blocks of one procedure. */ diff --git a/util/ego/cs/cs_avail.c b/util/ego/cs/cs_avail.c index d97a19b41..1f766a85c 100644 --- a/util/ego/cs/cs_avail.c +++ b/util/ego/cs/cs_avail.c @@ -75,7 +75,7 @@ STATIC bool same_avail(kind, avp1, avp2) /* NOTREACHED */ } -STATIC check_local(avp) +STATIC void check_local(avp) avail_p avp; { /* Check if the local in which the result of avp was stored, diff --git a/util/ego/cs/cs_debug.c b/util/ego/cs/cs_debug.c index bfa0dc66d..bf43d8c12 100644 --- a/util/ego/cs/cs_debug.c +++ b/util/ego/cs/cs_debug.c @@ -17,7 +17,7 @@ extern char em_mnem[]; /* The mnemonics of the EM instructions. */ -STATIC showinstr(lnp) +STATIC void showinstr(lnp) line_p lnp; { /* Makes the instruction in `lnp' human readable. Only lines that diff --git a/util/ego/cs/cs_kill.c b/util/ego/cs/cs_kill.c index 7c9e90064..520366f23 100644 --- a/util/ego/cs/cs_kill.c +++ b/util/ego/cs/cs_kill.c @@ -234,7 +234,7 @@ STATIC kill_local(enp, indir) } } -STATIC kill_sim() +STATIC void kill_sim() { /* A store is done into the ENIGNMASK. */ diff --git a/util/ego/cs/cs_stack.c b/util/ego/cs/cs_stack.c index 5b3743434..7927438a5 100644 --- a/util/ego/cs/cs_stack.c +++ b/util/ego/cs/cs_stack.c @@ -39,6 +39,7 @@ Push(tkp) #define WORD_MULTIPLE(n) ((n / ws) * ws + ( n % ws ? ws : 0 )) +void Pop(tkp, size) token_p tkp; offset size; diff --git a/util/ego/ic/ic_lib.c b/util/ego/ic/ic_lib.c index 638038afc..7721bf27e 100644 --- a/util/ego/ic/ic_lib.c +++ b/util/ego/ic/ic_lib.c @@ -33,7 +33,7 @@ STATIC skip_string(n) } } -STATIC skip_arguments() +STATIC void skip_arguments() { /* Skip the arguments of a MES pseudo. The argument * list is terminated by a sp_cend byte. diff --git a/util/ego/il/il1_aux.c b/util/ego/il/il1_aux.c index 76e8ae2f3..d8da36dea 100644 --- a/util/ego/il/il1_aux.c +++ b/util/ego/il/il1_aux.c @@ -89,6 +89,7 @@ remov_formals(p) +void rem_indir_acc(p) proc_p p; { diff --git a/util/ego/il/il1_aux.h b/util/ego/il/il1_aux.h index 8b9db59d7..af8fe1ecf 100644 --- a/util/ego/il/il1_aux.h +++ b/util/ego/il/il1_aux.h @@ -18,7 +18,7 @@ extern rem_actuals(); /* (actual_p atcs) extern remov_formals(); /* (proc_p p) * Remove the formals-list of p from core. */ -extern rem_indir_acc(); /* (proc_p p) +extern void rem_indir_acc(); /* (proc_p p) * Remove formal that may be accessed * indirectly from formal lists of p */ diff --git a/util/ego/il/il1_cal.c b/util/ego/il/il1_cal.c index 69d12002e..1d0a2dc95 100644 --- a/util/ego/il/il1_cal.c +++ b/util/ego/il/il1_cal.c @@ -60,7 +60,7 @@ STATIC bool chck_asp(p,l) -STATIC inc_count(caller,callee) +STATIC void inc_count(caller,callee) proc_p caller, callee; { /* Update the call-count information. diff --git a/util/ego/il/il1_formal.c b/util/ego/il/il1_formal.c index c906f2580..94e2e32f7 100644 --- a/util/ego/il/il1_formal.c +++ b/util/ego/il/il1_formal.c @@ -103,6 +103,7 @@ STATIC inc_use(f,b) +void formal(p,b,off,type,usage) proc_p p; bblock_p b; diff --git a/util/ego/il/il1_formal.h b/util/ego/il/il1_formal.h index 7df35c1bb..bd2aea74d 100644 --- a/util/ego/il/il1_formal.h +++ b/util/ego/il/il1_formal.h @@ -8,7 +8,7 @@ * I L 1 _ F O R M A L . C */ -extern formal(); /* (proc_p p; bblock_p b; offset off; +extern void formal(); /* (proc_p p; bblock_p b; offset off; * int type, usage) * Analyze a reference to a parameter of p. * The type denotes its size (single,double, diff --git a/util/ego/il/il3_change.c b/util/ego/il/il3_change.c index 6347167c3..4528e8502 100644 --- a/util/ego/il/il3_change.c +++ b/util/ego/il/il3_change.c @@ -201,7 +201,7 @@ line_p make_label(l,p) /* modify */ -STATIC act_info(off,acts,ab_off,act_out,off_out) +STATIC void act_info(off,acts,ab_off,act_out,off_out) offset off, ab_off, *off_out; actual_p acts, *act_out; { @@ -499,6 +499,7 @@ STATIC line_p first_nonpseudo(l) +void insert(text,l,firstline) line_p text,l,firstline; { diff --git a/util/ego/il/il3_change.h b/util/ego/il/il3_change.h index 9899c8664..95c14f11c 100644 --- a/util/ego/il/il3_change.h +++ b/util/ego/il/il3_change.h @@ -35,7 +35,7 @@ extern mod_actuals(); /* (call_p nc,c; line_p lab; * call nc the same way as the text of * call c would be modified. */ -extern insert(); /* (line_p text,l,firstline) +extern void insert(); /* (line_p text,l,firstline) * Insert the modified EM text. * Pseudos are put after the pseudos * of the caller. diff --git a/util/ego/il/il_aux.c b/util/ego/il/il_aux.c index 2bb5e4564..d35120eb4 100644 --- a/util/ego/il/il_aux.c +++ b/util/ego/il/il_aux.c @@ -149,6 +149,7 @@ STATIC short remlines(l) +void remunit(kind,p,l) short kind; proc_p p; diff --git a/util/ego/lv/lv.c b/util/ego/lv/lv.c index 9fe50befd..6a640a1cb 100644 --- a/util/ego/lv/lv.c +++ b/util/ego/lv/lv.c @@ -591,6 +591,7 @@ lv_flags(p) } +void lv_optimize(p) proc_p p; { diff --git a/util/ego/ra/ra.c b/util/ego/ra/ra.c index fdb345f0b..fd05cdef0 100644 --- a/util/ego/ra/ra.c +++ b/util/ego/ra/ra.c @@ -349,6 +349,7 @@ ra_initialize() } +void ra_optimize(p) proc_p p; { diff --git a/util/ego/ra/ra_items.c b/util/ego/ra/ra_items.c index 05e16756c..a7411befb 100644 --- a/util/ego/ra/ra_items.c +++ b/util/ego/ra/ra_items.c @@ -260,7 +260,7 @@ STATIC init_item(a,b) -STATIC add_item(item,t,items) +STATIC void add_item(item,t,items) item_p item; time_p t; item_p items[]; diff --git a/util/ego/ra/ra_xform.c b/util/ego/ra/ra_xform.c index 28c295f0d..fea3e0757 100644 --- a/util/ego/ra/ra_xform.c +++ b/util/ego/ra/ra_xform.c @@ -551,6 +551,8 @@ rem_locals(p,allocs) } p->p_localbytes = nrlocals; } + +void rem_formals(p,allocs) proc_p p; alloc_p allocs; diff --git a/util/ego/share/locals.c b/util/ego/share/locals.c index b8b92f253..7da423b7f 100644 --- a/util/ego/share/locals.c +++ b/util/ego/share/locals.c @@ -29,7 +29,7 @@ short nrglobals; short nrlocals; local_p *locals; /* dynamic array */ -STATIC localvar(off,size,locs,reg,score) +STATIC void localvar(off,size,locs,reg,score) offset off; short size; local_p *locs; @@ -90,7 +90,7 @@ STATIC check_message(l,locs) -STATIC check_local_use(l,locs) +STATIC void check_local_use(l,locs) line_p l; local_p *locs; { @@ -186,7 +186,7 @@ make_localtab(p) -find_local(off,nr_out,found_out) +void find_local(off,nr_out,found_out) offset off; short *nr_out; bool *found_out; @@ -211,7 +211,7 @@ find_local(off,nr_out,found_out) -var_nr(l,nr_out,found_out) +void var_nr(l,nr_out,found_out) line_p l; short *nr_out; bool *found_out; diff --git a/util/ego/share/locals.h b/util/ego/share/locals.h index f71512ee5..60792372f 100644 --- a/util/ego/share/locals.h +++ b/util/ego/share/locals.h @@ -17,11 +17,11 @@ extern make_localtab(); /* (proc_p p) * these variables ('locals') and count them * ('nrlocals'). Also collect register messages. */ -extern var_nr(); /* (line_p l; short *nr_out;bool *found_out) +extern void var_nr(); /* (line_p l; short *nr_out;bool *found_out) * Compute the 'variable number' of the * variable referenced by EM instruction l. */ -extern find_local(); /* (offset off; short *nr_out; bool *found_out) +extern void find_local(); /* (offset off; short *nr_out; bool *found_out) * Try to find the local variable at the given * offset. Return its local-number. */ diff --git a/util/ego/share/put.c b/util/ego/share/put.c index 732377933..9cbfe7339 100644 --- a/util/ego/share/put.c +++ b/util/ego/share/put.c @@ -377,6 +377,7 @@ STATIC outlset(s,p) +void putunit(kind,p,l,gf,lf) short kind; proc_p p; diff --git a/util/ego/share/put.h b/util/ego/share/put.h index 2df761328..c6287cdaf 100644 --- a/util/ego/share/put.h +++ b/util/ego/share/put.h @@ -28,7 +28,7 @@ extern putptable(); /* (proc_p head, FILE *pf, bool all) * the fields computed by CF will not be * written (used by the IC phase). */ -extern putunit(); /* (short kind; proc_p p; line_p l; +extern void putunit(); /* (short kind; proc_p p; line_p l; * FILE *gf, *lf) * If kind = LTEXT, then write * the control flow graph to file gf, diff --git a/util/ego/sp/sp.c b/util/ego/sp/sp.c index dcc0a99f9..b04895647 100644 --- a/util/ego/sp/sp.c +++ b/util/ego/sp/sp.c @@ -193,6 +193,7 @@ STATIC mark_unsave_blocks(p) } +void sp_optimize(p) proc_p p; { diff --git a/util/ego/sr/sr.c b/util/ego/sr/sr.c index fcc9b413e..5f2194ed1 100644 --- a/util/ego/sr/sr.c +++ b/util/ego/sr/sr.c @@ -218,6 +218,7 @@ STATIC sr_cleanproc(p) } +void sr_optimize(p) proc_p p; { diff --git a/util/ego/sr/sr_cand.c b/util/ego/sr/sr_cand.c index ea478c01a..45babca7e 100644 --- a/util/ego/sr/sr_cand.c +++ b/util/ego/sr/sr_cand.c @@ -131,7 +131,7 @@ STATIC bool not_dismissed(lnp) } -STATIC try_cand(lnp,b) +STATIC void try_cand(lnp,b) line_p lnp; bblock_p b; { diff --git a/util/ego/sr/sr_iv.c b/util/ego/sr/sr_iv.c index 88af2e0d1..43e4b89c1 100644 --- a/util/ego/sr/sr_iv.c +++ b/util/ego/sr/sr_iv.c @@ -116,7 +116,7 @@ STATIC int sign(lnp) } -STATIC try_patterns(lnp) +STATIC void try_patterns(lnp) line_p lnp; { /* lnp is a STL x; try to recognize diff --git a/util/ego/sr/sr_reduce.c b/util/ego/sr/sr_reduce.c index 5b8e78295..d5ae81bb0 100644 --- a/util/ego/sr/sr_reduce.c +++ b/util/ego/sr/sr_reduce.c @@ -544,7 +544,7 @@ STATIC reduce(code,vars) -STATIC try_multiply(lp,ivs,vars,b,mul) +STATIC void try_multiply(lp,ivs,vars,b,mul) loop_p lp; lset ivs,vars; bblock_p b; @@ -606,7 +606,7 @@ STATIC try_multiply(lp,ivs,vars,b,mul) -STATIC try_leftshift(lp,ivs,vars,b,shft) +STATIC void try_leftshift(lp,ivs,vars,b,shft) loop_p lp; lset ivs,vars; bblock_p b; @@ -657,7 +657,7 @@ STATIC try_leftshift(lp,ivs,vars,b,shft) } -STATIC try_array(lp,ivs,vars,b,arr) +STATIC void try_array(lp,ivs,vars,b,arr) loop_p lp; lset ivs,vars; bblock_p b; diff --git a/util/ego/sr/sr_xform.c b/util/ego/sr/sr_xform.c index ca1c521b7..7adc32121 100644 --- a/util/ego/sr/sr_xform.c +++ b/util/ego/sr/sr_xform.c @@ -138,6 +138,7 @@ STATIC adjust_jump(newtarg,oldtarg,c) } +void make_header(lp) loop_p lp; { diff --git a/util/ego/sr/sr_xform.h b/util/ego/sr/sr_xform.h index 9bf1f3bd7..a6065c90d 100644 --- a/util/ego/sr/sr_xform.h +++ b/util/ego/sr/sr_xform.h @@ -16,7 +16,7 @@ extern line_p move_pointer(); /* (offset tmp; int dir ) */ * onto/from the stack, depending on dir(ection). * We accept all kinds of pointer sizes. */ -extern make_header() ; /* (loop_p lp) */ +extern void make_header() ; /* (loop_p lp) */ /* Make sure that the loop has a header block, i.e. a block * has the loop entry block as its only successor and * that dominates the loop entry block. diff --git a/util/ego/ud/ud.c b/util/ego/ud/ud.c index 610fd7a5e..afcba53a5 100644 --- a/util/ego/ud/ud.c +++ b/util/ego/ud/ud.c @@ -531,6 +531,7 @@ STATIC ud_cleanup(p) } +void ud_optimize(p) proc_p p; { diff --git a/util/ego/ud/ud_const.c b/util/ego/ud/ud_const.c index 9e854bd38..d1a2a438f 100644 --- a/util/ego/ud/ud_const.c +++ b/util/ego/ud/ud_const.c @@ -131,7 +131,7 @@ bool affected(use,v,l) -STATIC search_backwards(use,v,found,def) +STATIC void search_backwards(use,v,found,def) line_p use, *def; short v; bool *found; diff --git a/util/ego/ud/ud_copy.c b/util/ego/ud/ud_copy.c index 3761dba2d..213f7252a 100644 --- a/util/ego/ud/ud_copy.c +++ b/util/ego/ud/ud_copy.c @@ -42,7 +42,7 @@ short nrcopies; /* number of copies in the current procedure #define COUNT 0 #define MAP 1 -STATIC traverse_defs(p,action) +STATIC void traverse_defs(p,action) proc_p p; int action; { @@ -121,7 +121,7 @@ STATIC bool is_changed(varl,start,stop) -STATIC gen_kill_copies(p) +STATIC void gen_kill_copies(p) proc_p p; { /* Compute C_GEN and C_KILL for every basic block diff --git a/util/ego/ud/ud_defs.c b/util/ego/ud/ud_defs.c index f6272acf8..875d01425 100644 --- a/util/ego/ud/ud_defs.c +++ b/util/ego/ud/ud_defs.c @@ -249,7 +249,7 @@ STATIC impl_globl_defs(p,gen_p) -STATIC impl_gen_defs(l,gen_p) +STATIC void impl_gen_defs(l,gen_p) line_p l; cset *gen_p; { diff --git a/util/led/extract.c b/util/led/extract.c index 3b0983c9d..5878d527d 100644 --- a/util/led/extract.c +++ b/util/led/extract.c @@ -23,6 +23,9 @@ static redefine(); static transfer(); extern ind_t savechar(); + +void namerelocate(); + /* * Get section sizes and symboltable information from present module. */ @@ -149,6 +152,7 @@ process(head) * Otherwise we just add the accumulated size of all normal parts in preceding * sections with the same size. */ +void namerelocate(name) register struct outname *name; { diff --git a/util/led/main.c b/util/led/main.c index 426438ec6..2ec6ca2f8 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -35,9 +35,9 @@ static setbase(); static struct outname *makename(); static pass1(); static evaluate(); -static norm_commons(); +static void norm_commons(); static complete_sections(); -static change_names(); +static void change_names(); static bool tstbit(); static second_pass(); static pass2(); @@ -45,6 +45,8 @@ static pass2(); static do_statistics(); #endif +void addbase(); + main(argc, argv) int argc; char **argv; @@ -395,7 +397,7 @@ long sect_comm[MAXSECT]; * just like "normal" names. We also count the total size of common names * within each section to be able to compute the final size in the machine. */ -static +static void norm_commons() { register struct outname *name; @@ -492,7 +494,7 @@ complete_sections() * For each name we add the base of its section to its value, unless * the output has to be able to be linked again, as indicated by RFLAG. */ -static +static void change_names() { register int cnt; @@ -565,6 +567,7 @@ tstbit(indx, string) /* * Add the base of the section of a name to its value. */ +void addbase(name) struct outname *name; { diff --git a/util/led/memory.c b/util/led/memory.c index b99447172..6349c826a 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -519,6 +519,7 @@ core_free(piece, p) * Reset index into piece of memory for modules and * take care that the allocated pieces will not be moved. */ +void freeze_core() { register int i; diff --git a/util/led/output.c b/util/led/output.c index cb7abceb2..0ee622e3a 100644 --- a/util/led/output.c +++ b/util/led/output.c @@ -10,7 +10,7 @@ static char rcsid[] = "$Id$"; #include "const.h" #include "memory.h" -static generate_section_names(); +static void generate_section_names(); extern struct outhead outhead; extern bool incore; @@ -51,7 +51,7 @@ beginoutput() * Generate names for all sections and put them after the global names. * Section names are used for relocation. */ -static +static void generate_section_names() { register struct outname *name; diff --git a/util/led/save.c b/util/led/save.c index a311d0413..3804413d9 100644 --- a/util/led/save.c +++ b/util/led/save.c @@ -22,6 +22,7 @@ static char rcsid[] = "$Id$"; extern bool incore; extern char *core_alloc(); +void savemagic() { register char *p; @@ -35,6 +36,7 @@ savemagic() } } +void savehdr(hdr) struct ar_hdr *hdr; { @@ -91,6 +93,7 @@ savechar(piece, off) * allocation, but the string of which name->on_foff is the offset may be * destroyed, so we save that first. */ +void savelocal(name) struct outname *name; { diff --git a/util/ncgg/coerc.c b/util/ncgg/coerc.c index 893f81be3..d6334d5a3 100644 --- a/util/ncgg/coerc.c +++ b/util/ncgg/coerc.c @@ -24,6 +24,7 @@ int nmoves; move_t l_moves[MAXMOVES]; short posmoves[MAXREGS+MAXTOKENS][SETSIZE]; +void n_move(s1,e1,s2,e2,vi) struct varinfo *vi; { register move_p mp; register i,j; @@ -81,6 +82,7 @@ int ntests; test_t l_tests[MAXTESTS]; short postests[SETSIZE]; +void n_test(s,e,vi) struct varinfo *vi; { register test_p tp; register i; @@ -162,6 +164,7 @@ n_stack(s,e,p,vi) struct varinfo *vi; { sp[i] |= l_sets[s].set_val[i]; } +void checkstacking(sp) register short *sp; { register i; register short *chkset; @@ -186,6 +189,7 @@ set_t unstackset; /*VARARGS5*/ +void n_coerc(ti,be,al,ge,rp,in) struct varinfo *al,*ge,*rp; iocc_t in; { register c3_p c3p; register i; diff --git a/util/ncgg/output.c b/util/ncgg/output.c index 50458e369..77e3eb41f 100644 --- a/util/ncgg/output.c +++ b/util/ncgg/output.c @@ -662,6 +662,7 @@ finishio() { outars(); } +void codecoco(cocono) { if (cocono== -1) diff --git a/util/ncgg/set.c b/util/ncgg/set.c index cb31c3594..d2d9b0d8f 100644 --- a/util/ncgg/set.c +++ b/util/ncgg/set.c @@ -85,7 +85,7 @@ set_t ident_to_set(name) char *name; { return(result); } -static +static void checksize(s) register set_p s; { diff --git a/util/ncgg/subr.c b/util/ncgg/subr.c index 90bf44eb2..08c7c650f 100644 --- a/util/ncgg/subr.c +++ b/util/ncgg/subr.c @@ -175,6 +175,7 @@ n_prop(name,size) char *name; int size; { l_props[propno].pr_size = size; } +void prophall(n) { register i; short hallset[SETSIZE]; @@ -279,6 +280,7 @@ setallreg(vi) struct varinfo *vi; { } } +void freevi(vip) register struct varinfo *vip; { register i; diff --git a/util/opt/cleanup.c b/util/opt/cleanup.c index 2c1f912eb..f09feeb7b 100644 --- a/util/opt/cleanup.c +++ b/util/opt/cleanup.c @@ -20,6 +20,7 @@ static char rcsid[] = "$Id$"; */ +void cleanup() { FILE *infile; register c; diff --git a/util/opt/flow.c b/util/opt/flow.c index 77f6042c2..73ae715af 100644 --- a/util/opt/flow.c +++ b/util/opt/flow.c @@ -21,6 +21,8 @@ static char rcsid[] = "$Id$"; * Author: Hans van Staveren */ +void reach(); + flow() { findreach(); /* determine reachable labels */ @@ -51,6 +53,7 @@ findreach() { } } +void reach(lnp) register line_p lnp; { register num_p np; diff --git a/util/opt/getline.c b/util/opt/getline.c index c3ed1bb78..9ecdf08fd 100644 --- a/util/opt/getline.c +++ b/util/opt/getline.c @@ -188,6 +188,7 @@ int table2() { return(table3(n)); } +void getlines() { register line_p lnp; register instr; diff --git a/util/opt/reg.c b/util/opt/reg.c index 00fc2e3b2..6066c9f19 100644 --- a/util/opt/reg.c +++ b/util/opt/reg.c @@ -21,6 +21,7 @@ static char rcsid[] = "$Id$"; * Author: Hans van Staveren */ +void regvar(ap) register arg_p ap; { register reg_p rp; register i; @@ -96,6 +97,7 @@ outtes() { } } +void incregusage(off) offset off; { register reg_p rp; diff --git a/util/opt/tes.c b/util/opt/tes.c index ab6ce3bbd..b3d4efda1 100644 --- a/util/opt/tes.c +++ b/util/opt/tes.c @@ -68,6 +68,7 @@ tes_pseudos() } } +void tes_instr(lnp, x, y) line_p lnp, x, y; { From e7eb563ee9b42866fda99062c06bf08c3930c94b Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 11 Nov 2016 20:16:43 +0100 Subject: [PATCH 10/11] Disable gethostid() in the build system Lua; it's unused and doesn't work on Haiku. --- first/lua-5.1/lposix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/first/lua-5.1/lposix.c b/first/lua-5.1/lposix.c index ebe6b9c03..4bdf9328f 100644 --- a/first/lua-5.1/lposix.c +++ b/first/lua-5.1/lposix.c @@ -702,6 +702,7 @@ static int Pgetpid(lua_State *L) /** getpid([options]) */ } +#if 0 static int Phostid(lua_State *L) /** hostid() */ { char b[32]; @@ -709,6 +710,7 @@ static int Phostid(lua_State *L) /** hostid() */ lua_pushstring(L, b); return 1; } +#endif static int Pttyname(lua_State *L) /** ttyname([fd]) */ @@ -1060,7 +1062,7 @@ static const luaL_reg R[] = {"getpasswd", Pgetpasswd}, {"getpid", Pgetpid}, {"glob", Pglob}, - {"hostid", Phostid}, + //{"hostid", Phostid}, {"kill", Pkill}, {"link", Plink}, {"mkdir", Pmkdir}, From d82df74a7a33cfab66a86b13efcad751d331d26d Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 11 Nov 2016 20:17:10 +0100 Subject: [PATCH 11/11] Rename addr_t to address_t to avoid clashes with the system addr_t. --- mach/proto/ncg/data.h | 4 ++-- mach/proto/ncg/gencode.c | 4 ++-- mach/proto/ncg/result.h | 2 +- util/LLgen/build.lua | 6 ++++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mach/proto/ncg/data.h b/mach/proto/ncg/data.h index c1d0e183e..ddd232b98 100644 --- a/mach/proto/ncg/data.h +++ b/mach/proto/ncg/data.h @@ -12,13 +12,13 @@ typedef struct cost { typedef struct { string ea_str; word ea_off; -} addr_t; +} address_t; typedef struct { int t_token; /* kind of token, -1 for register */ union { word aw; /* integer type */ - addr_t aa; /* address type */ + address_t aa; /* address type */ int ar; /* register type */ } t_att[TOKENSIZE]; } token_t,*token_p; diff --git a/mach/proto/ncg/gencode.c b/mach/proto/ncg/gencode.c index 415d59f51..68676868e 100644 --- a/mach/proto/ncg/gencode.c +++ b/mach/proto/ncg/gencode.c @@ -72,7 +72,7 @@ genstr(stringno) { fputs(codestrings[stringno],codefile); } -string ad2str(ad) addr_t ad; { +string ad2str(ad) address_t ad; { static char buf[100]; if (ad.ea_str==0) @@ -87,7 +87,7 @@ string ad2str(ad) addr_t ad; { return(mystrcpy(buf)); } -praddr(ad) addr_t ad; { +praddr(ad) address_t ad; { if (ad.ea_str==0 || *(ad.ea_str) == '\0') fprintf(codefile,WRD_FMT,ad.ea_off); diff --git a/mach/proto/ncg/result.h b/mach/proto/ncg/result.h index 7ceb2f114..fdb9e16e1 100644 --- a/mach/proto/ncg/result.h +++ b/mach/proto/ncg/result.h @@ -9,7 +9,7 @@ struct result { union { word e_con; int e_reg; - addr_t e_addr; + address_t e_addr; } e_v; /* value */ }; diff --git a/util/LLgen/build.lua b/util/LLgen/build.lua index 44abc871c..9cde5630c 100644 --- a/util/LLgen/build.lua +++ b/util/LLgen/build.lua @@ -1,3 +1,8 @@ +clibrary { + name = "headers", + hdrs = { "./src/*.h" } +} + cprogram { name = "llgen", @@ -6,6 +11,7 @@ cprogram { -- do this. srcs = { "./src/*.c" }, + deps = { "+headers" }, vars = { ["+cflags"] = { "-DLIBDIR=\\\""..posix.getcwd().."/"..cwd().."/lib\\\"",