From 36f16b0cb83a5740ae665e72a5a8ede655763214 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Wed, 23 Oct 2019 16:06:36 -0400 Subject: [PATCH] Cut down some clang warnings Edit C code to reduce warnings from clang. Most warnings are for implicit declarations of functions, but some warnings want me to add parentheses or curly braces, or to cast arguments for printf(). Make a few other changes, like declaring float_cst() in h/con_float to be static, and using C99 bool in ego/ra/makeitems.c and ego/share/makecldef.c. Such changes don't silence warnings; I make such changes while I silence warnings in the same file. In float_cst(), rename parameter `str` to `float_str`, so it doesn't share a name with the global variable `str`. Remove `const` from `newmodule(const char *)` in mach/proto/as to silence a warning. I wrongly added the `const` in d347207. For warnings about implicit declarations of functions, the fix is to declare the function before calling it. For example, my OpenBSD system needs to declare wait(). In util/int, add "whatever.h" to declare more functions. Remove old declarations from "mem.h", to prefer the newer declarations of the same functions in "data.h" and "stack.h". --- h/con_float | 7 +++-- mach/m68020/ncg/table | 2 +- mach/proto/as/comm1.h | 2 +- mach/proto/as/comm4.c | 10 ++++--- modules/src/flt_arith/flt_arith.h | 2 +- modules/src/flt_arith/flt_str2fl.c | 2 +- modules/src/system/write.c | 1 + util/ack/ack.h | 4 +++ util/ack/main.c | 2 +- util/ack/mktables.c | 16 ++++++----- util/ack/run.c | 1 + util/ack/scan.c | 4 +-- util/ack/trans.c | 6 +++-- util/ack/trans.h | 1 - util/cgg/main.c | 2 +- util/ego/em_ego/em_ego.c | 10 ++++--- util/ego/ra/makeitems.c | 36 +++++++++++-------------- util/ego/share/get.c | 2 +- util/ego/share/makecldef.c | 36 +++++++++++-------------- util/int/M.warn_h | 5 ++++ util/int/disassemble.c | 1 + util/int/do_misc.c | 5 +--- util/int/do_proc.c | 2 +- util/int/init.c | 2 ++ util/int/io.c | 1 + util/int/logging.h | 4 +++ util/int/m_ioctl.c | 5 ++-- util/int/m_sigtrp.c | 1 + util/int/main.c | 7 +---- util/int/mem.h | 10 +------ util/int/moncalls.c | 23 +++++++++------- util/int/monstruct.c | 13 +++------ util/int/monstruct.h | 9 +++++++ util/int/rsb.c | 1 + util/int/tally.c | 1 + util/int/trap.c | 1 + util/int/warn.c | 2 +- util/int/whatever.h | 43 ++++++++++++++++++++++++++++++ util/ncgg/cvtkeywords | 2 +- util/ncgg/extern.h | 19 +++++++++++-- util/ncgg/iocc.c | 3 ++- util/ncgg/main.c | 8 +----- util/opt/mktab.y | 2 +- 43 files changed, 189 insertions(+), 127 deletions(-) create mode 100644 util/int/whatever.h diff --git a/h/con_float b/h/con_float index a0ce783cc..8f8eeb8ad 100644 --- a/h/con_float +++ b/h/con_float @@ -97,8 +97,7 @@ int sz; #include #include -int float_cst(str, sz, buf) char *str, *buf; -int sz; +static int float_cst(const char *float_str, int sz, char *buf) { int overflow = 0; flt_arith e; @@ -107,7 +106,7 @@ int sz; { return 1; } - flt_str2flt(str, &e); + flt_str2flt(float_str, &e); #ifdef IEEEFLOAT if (sz == 4) { @@ -115,7 +114,7 @@ int sz; #ifdef PDPFLOAT e.flt_exp += 129; #else - e.flt_exp += 127; + e.flt_exp += 127; #endif if (e.flt_mantissa.flt_h_32 == 0) e.flt_exp = 0; diff --git a/mach/m68020/ncg/table b/mach/m68020/ncg/table index a0f649b3e..03a2ed3c6 100644 --- a/mach/m68020/ncg/table +++ b/mach/m68020/ncg/table @@ -25,7 +25,7 @@ Something very wrong here! #define SYNTAX_68020 1 #endif -/* #define FANCY_MODES 1 +/* #define FANCY_MODES 1 */ /* On the M68020, there are some real fancy addressing modes. Their use makes the code a bit shorter, but also much slower. The FANCY_MODES #define enables the use of these addressing diff --git a/mach/proto/as/comm1.h b/mach/proto/as/comm1.h index 29acbca6e..87df5279a 100644 --- a/mach/proto/as/comm1.h +++ b/mach/proto/as/comm1.h @@ -106,7 +106,7 @@ extern int curr_token; int yyparse(void); /* comm4.c */ void stop(void); -void newmodule(const char *); +void newmodule(char *); /* comm5.c */ int yylex(void); void putval(int); diff --git a/mach/proto/as/comm4.c b/mach/proto/as/comm4.c index 08c053ed0..4abf13dbb 100644 --- a/mach/proto/as/comm4.c +++ b/mach/proto/as/comm4.c @@ -35,6 +35,10 @@ void stop(void) { exit(nerrors != 0); } +static void stop_on_signal(int sig) { + stop(); +} + int main(int argc, char **argv) { @@ -54,9 +58,9 @@ main(int argc, char **argv) } progname = *argv++; argc--; - for (p = sigs; i = *p++; ) + for (p = sigs; (i = *p++) != 0; ) if (signal(i, SIG_IGN) != SIG_IGN) - signal(i, stop); + signal(i, stop_on_signal); for (i = 0; i < argc; i++) { p = argv[i]; if (*p++ != '-') @@ -433,7 +437,7 @@ pass_23(int n) } void -newmodule(const char *s) +newmodule(char *s) { static char nmbuf[STRINGMAX]; diff --git a/modules/src/flt_arith/flt_arith.h b/modules/src/flt_arith/flt_arith.h index b1c0a9893..beb5cc6fe 100644 --- a/modules/src/flt_arith/flt_arith.h +++ b/modules/src/flt_arith/flt_arith.h @@ -78,7 +78,7 @@ int flt_cmp(flt_arith *e1, flt_arith *e2); * digits. They may not both be missing. The decimal point, the e and the * exponent may be missing. */ -void flt_str2flt(char *s, flt_arith *e); +void flt_str2flt(const char *s, flt_arith *e); /** Converts the number indicated by `e` into a string, in a scientific * notation acceptable for EM. The result is stored in `buf`. At most * `bufsize` characters are stored. The maximum length needed is diff --git a/modules/src/flt_arith/flt_str2fl.c b/modules/src/flt_arith/flt_str2fl.c index 03c510ae3..e0c793dd8 100644 --- a/modules/src/flt_arith/flt_str2fl.c +++ b/modules/src/flt_arith/flt_str2fl.c @@ -216,7 +216,7 @@ static void add_exponent(register flt_arith *e, int exp) flt_status = status; } -void flt_str2flt(char *s, flt_arith *e) +void flt_str2flt(const char *s, flt_arith *e) { register int c; int dotseen = 0; diff --git a/modules/src/system/write.c b/modules/src/system/write.c index 7423a59a8..7f87ecc28 100644 --- a/modules/src/system/write.c +++ b/modules/src/system/write.c @@ -4,6 +4,7 @@ */ /* $Id$ */ +#include #include "system.h" int diff --git a/util/ack/ack.h b/util/ack/ack.h index 144fd5343..76a738745 100644 --- a/util/ack/ack.h +++ b/util/ack/ack.h @@ -64,6 +64,9 @@ typedef struct /* Own routines */ +/* files.h */ +extern void rmtemps(void); + /* rmach.c */ extern void setlist(char*); @@ -80,6 +83,7 @@ extern void fatal(const char*, ...); extern void vprint(const char*, ...); extern void fuerror(const char*, ...); extern void werror(const char*, ...); +extern void error(const char*, ...); extern void quit(int); extern char* keeps(const char*); #define throws(str) free(str) diff --git a/util/ack/main.c b/util/ack/main.c index 47fb44f0e..3e1bf8e2a 100644 --- a/util/ack/main.c +++ b/util/ack/main.c @@ -169,7 +169,7 @@ static void varinit(void) register char* envstr; extern char* em_dir; - if (envstr = getenv("ACKDIR")) + if ((envstr = getenv("ACKDIR")) != NULL) { em_dir = keeps(envstr); } diff --git a/util/ack/mktables.c b/util/ack/mktables.c index 214b93606..879cb05d6 100644 --- a/util/ack/mktables.c +++ b/util/ack/mktables.c @@ -22,10 +22,12 @@ FILE *dmach ; int offset ; -void readm(); +void start(const char *) ; +void stop(int) ; +void readm(void) ; -main(argc,argv) char **argv ; { - register i ; +int main(int argc, char **argv) { + int i ; start(argv[1]) ; for ( i=2 ; i #include #include #include diff --git a/util/ack/scan.c b/util/ack/scan.c index e846578de..0e6cfb6c2 100644 --- a/util/ack/scan.c +++ b/util/ack/scan.c @@ -113,12 +113,12 @@ static void try(list_elem *f_scan, const char *suffix) { */ register trf *sneak ; sneak= trafo ; - while( sneak=sneak->t_next ) { + while( (sneak=sneak->t_next) ) { sneak->t_scan=YES ; } scan_found() ; sneak= trafo ; - while( sneak=sneak->t_next ) { + while( (sneak=sneak->t_next) ) { sneak->t_scan=NO ; } return ; diff --git a/util/ack/trans.c b/util/ack/trans.c index 1152dfbd7..451b74c31 100644 --- a/util/ack/trans.c +++ b/util/ack/trans.c @@ -317,7 +317,8 @@ static growstring scanvars(const char* line) { case A_VAR: gr_add(&name, 0); - if (tr = getvar(gr_start(name))) + tr = getvar(gr_start(name)); + if (tr != NULL) { while (*tr) { @@ -333,7 +334,8 @@ static growstring scanvars(const char* line) break; case C_VAR: gr_add(&name, 0); - if (tr = getvar(gr_start(name))) + tr = getvar(gr_start(name)); + if (tr != NULL) { while (*tr) { diff --git a/util/ack/trans.h b/util/ack/trans.h index f16f64d7c..01d203ac5 100644 --- a/util/ack/trans.h +++ b/util/ack/trans.h @@ -50,7 +50,6 @@ int setfiles(trf *); void disc_files(trf *); void disc_inputs(trf *); void rmfile(path *); -void rmtemps(void); void add_input(path *, trf *); /* run.c */ diff --git a/util/cgg/main.c b/util/cgg/main.c index 75a066e5e..12d3b4fd4 100644 --- a/util/cgg/main.c +++ b/util/cgg/main.c @@ -785,7 +785,7 @@ static void verbose(void) fprintf(stderr, "Sets %d(%d)\n", nmachsets, MAXSETS); fprintf(stderr, "Tokeninstances %d(%d)\n", narinstance, MAXINSTANCE); fprintf(stderr, "Strings %d(%d)\n", ncodestrings, MAXSTRINGS); - fprintf(stderr, "Enodes %d(%d)\n", lastnode - nodes, MAXNODES); + fprintf(stderr, "Enodes %d(%d)\n", (int)(lastnode - nodes), MAXNODES); fprintf(stderr, "Patbytes %d(%d)\n", npatbytes, MAXPATTERN); } diff --git a/util/ego/em_ego/em_ego.c b/util/ego/em_ego/em_ego.c index eb177116a..14caea2bf 100644 --- a/util/ego/em_ego/em_ego.c +++ b/util/ego/em_ego/em_ego.c @@ -4,6 +4,7 @@ optimizer itself one day ... */ +#include #include #include #include @@ -121,14 +122,15 @@ cleanup() } /*VARARGS1*/ -static void - fatal(s, s2) char* s; -char* s2; +static void fatal(const char *s, ...) { /* A fatal error occurred; exit gracefully */ + va_list ap; + va_start(ap, s); + fprint(STDERR, "%s: ", prog_name); - fprint(STDERR, s, s2); + doprnt(STDERR, s, ap); fprint(STDERR, "\n"); cleanup(); sys_stop(S_EXIT); diff --git a/util/ego/ra/makeitems.c b/util/ego/ra/makeitems.c index 83f6703bd..f8bc64989 100644 --- a/util/ego/ra/makeitems.c +++ b/util/ego/ra/makeitems.c @@ -3,7 +3,8 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ - + +#include #include #include #include @@ -20,16 +21,20 @@ */ -#define TRUE 1 -#define FALSE 0 +void error(const char *s) +{ + fprintf(stderr,"%s\n",s); + exit(-1); +} -convert(mnemfile,itemfile) - FILE *mnemfile, *itemfile; + +void convert(FILE *mnemfile, FILE *itemfile) { char mnem1[20], mnem2[20],def[20],itemtype[20]; - int newcl,opc,index; + int opc,index; + bool newcl; - newcl = TRUE; + newcl = true; printf("struct item_descr itemtab[] = {\n"); for (;;) { fscanf(mnemfile,"%19s%19s%d",def,mnem1,&opc); @@ -47,28 +52,17 @@ convert(mnemfile,itemfile) * it has no type. */ printf("{NO_ITEM,0}, /* %s */\n", mnem1); - newcl = FALSE; + newcl = false; } else { printf("{%s,%d}, /* %s */\n",itemtype,index, mnem1); - newcl = TRUE; + newcl = true; } } printf("};\n"); } - -error(s) - char *s; -{ - fprintf(stderr,"%s\n",s); - exit(-1); -} - - -main(argc,argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { FILE *f1,*f2; diff --git a/util/ego/share/get.c b/util/ego/share/get.c index d804d63c6..6cc695471 100644 --- a/util/ego/share/get.c +++ b/util/ego/share/get.c @@ -136,7 +136,7 @@ STATIC lset getlset(void *(*p)(short)) int id; s = Lempty_set(); - while (id = getshort()) { + while ((id = getshort()) != 0) { Ladd( (*p) (id), &s); } return s; diff --git a/util/ego/share/makecldef.c b/util/ego/share/makecldef.c index 2913e26f5..ac831ed3b 100644 --- a/util/ego/share/makecldef.c +++ b/util/ego/share/makecldef.c @@ -3,7 +3,8 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ - + +#include #include #include #include @@ -23,16 +24,20 @@ */ -#define TRUE 1 -#define FALSE 0 +void error(const char *s) +{ + fprintf(stderr,"%s\n",s); + exit(-1); +} -convert(mnemfile,classfile) - FILE *mnemfile, *classfile; + +void convert(FILE *mnemfile, FILE *classfile) { char mnem1[10], mnem2[10],def[10]; - int src,res,newcl,opc; + int src,res,opc; + bool newcl; - newcl = TRUE; + newcl = true; printf("struct class classtab[] = {\n"); printf("\tNOCLASS,\tNOCLASS,\n"); /* EM mnemonics start at 1, arrays in C at 0 */ @@ -52,29 +57,18 @@ convert(mnemfile,classfile) * it has no class. */ printf("\tNOCLASS,\tNOCLASS,\n"); - newcl = FALSE; + newcl = false; } else { printf("\tCLASS%d,\t\tCLASS%d,\n",src,res); /* print a line like "CLASS8, CLASS1," */ - newcl = TRUE; + newcl = true; } } printf("};\n"); } - -error(s) - char *s; -{ - fprintf(stderr,"%s\n",s); - exit(-1); -} - - -main(argc,argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { FILE *f1,*f2; diff --git a/util/int/M.warn_h b/util/int/M.warn_h index 10f7be304..ae890a1f5 100755 --- a/util/int/M.warn_h +++ b/util/int/M.warn_h @@ -9,5 +9,10 @@ sed ' s/.*"/#define / ' +echo +echo 'void init_wmsg(void);' +echo 'void do_warn(int, int, const char *);' +echo 'void set_wmask(int);' +echo echo '#define warning(n) do_warn((n), __LINE__, __FILE__)' diff --git a/util/int/disassemble.c b/util/int/disassemble.c index f89cd6026..8605eb2a1 100644 --- a/util/int/disassemble.c +++ b/util/int/disassemble.c @@ -9,6 +9,7 @@ #include "memdirect.h" #include "proctab.h" #include "alloc.h" +#include "whatever.h" PRIVATE ptr TC; PRIVATE void do_pr_instr(unsigned int); diff --git a/util/int/do_misc.c b/util/int/do_misc.c index 6c12f9723..1f7c06102 100644 --- a/util/int/do_misc.c +++ b/util/int/do_misc.c @@ -22,6 +22,7 @@ #include "rsb.h" #include "io.h" #include "linfil.h" +#include "whatever.h" extern int running; /* from main.c */ @@ -32,13 +33,9 @@ ptr FIL; PRIVATE void index_jump(size), range_check(size), search_jump(size); PRIVATE void gto(ptr); -void putLIN(long); -void putFIL(ptr); #define asp(l) newSP(SP + arg_f(l)) -extern void moncall(void); - /** ASP f: Adjust the stack pointer by f */ void DoASP(register long l) { diff --git a/util/int/do_proc.c b/util/int/do_proc.c index 8c5e05892..80b07a08b 100644 --- a/util/int/do_proc.c +++ b/util/int/do_proc.c @@ -19,12 +19,12 @@ #include "fra.h" #include "rsb.h" #include "linfil.h" +#include "whatever.h" extern int running; /* from main.c */ /* Forward declarations */ PRIVATE void lfr(size), ret(size); -void call(long, int); /** CAI -: Call procedure (procedure identifier on stack) */ void DoCAI(void) /* proc identifier on top of stack */ diff --git a/util/int/init.c b/util/int/init.c index 44e25ceb7..04b9421e7 100644 --- a/util/int/init.c +++ b/util/int/init.c @@ -21,10 +21,12 @@ #include "alloc.h" #include "warn.h" #include "mem.h" +#include "m_sigtrp.h" #include "io.h" #include "shadow.h" #include "trap.h" #include "read.h" +#include "whatever.h" /**************************************************************** diff --git a/util/int/io.c b/util/int/io.c index a903307aa..684f167aa 100644 --- a/util/int/io.c +++ b/util/int/io.c @@ -16,6 +16,7 @@ #include "warn.h" #include "log.h" #include "linfil.h" +#include "whatever.h" extern int running; /* from main.c */ extern char *prog_name; /* from main.c */ diff --git a/util/int/logging.h b/util/int/logging.h index ff95bcf62..59f612aa8 100644 --- a/util/int/logging.h +++ b/util/int/logging.h @@ -2,3 +2,7 @@ #define LOGGING 1 /* Includes logging when defined */ +#ifdef LOGGING +/* warn.c */ +void warningcont(int); +#endif /* LOGGING */ diff --git a/util/int/m_ioctl.c b/util/int/m_ioctl.c index 23fa9ddee..0e7261e13 100644 --- a/util/int/m_ioctl.c +++ b/util/int/m_ioctl.c @@ -9,6 +9,7 @@ #include "global.h" #include "mem.h" #include "warn.h" +#include "whatever.h" #ifdef WANT_SGTTY #include @@ -42,9 +43,7 @@ * (0 for success, -1 for failure) * ***********************************************************************/ -int do_ioctl(fd, req, addr) - int fd, req; - ptr addr; +int do_ioctl(int fd, int req, ptr addr) { register long e; #ifdef WANT_SGTTY diff --git a/util/int/m_sigtrp.c b/util/int/m_sigtrp.c index a4dbf600f..f48f9b0ab 100644 --- a/util/int/m_sigtrp.c +++ b/util/int/m_sigtrp.c @@ -12,6 +12,7 @@ #include "trap.h" #include "m_sigtrp.h" #include "io.h" +#include "whatever.h" /*************************** SIGTRP ************************************* * The monitor call "sigtrp()" is handled by "do_sigtrp()". The first * diff --git a/util/int/main.c b/util/int/main.c index 5587a3112..0d571a9ec 100644 --- a/util/int/main.c +++ b/util/int/main.c @@ -23,6 +23,7 @@ #include "opcode.h" #include "m_sigtrp.h" #include "rsb.h" +#include "whatever.h" char mess_file[64] = "int.mess"; /* name of message file */ @@ -39,12 +40,6 @@ extern long inr; /* from log.c */ PRIVATE char *dflt_av[] = {"e.out", 0}; /* default arguments */ -/* External definitions - too lazy to create a header file for each. */ -extern void init(int , char **); -extern void disassemble(void); -extern void tally(void); -extern void out_tally(void); - /** Check dynamically that the interpreter can run on the target machine. */ static void check_requirements(char *name) { diff --git a/util/int/mem.h b/util/int/mem.h index 2f1d7cfd6..b57be0f20 100644 --- a/util/int/mem.h +++ b/util/int/mem.h @@ -4,6 +4,7 @@ /* $Id$ */ +#include "data.h" #include "stack.h" /******** Memory address & location defines ********/ @@ -65,12 +66,3 @@ #define st_inc(n) newSP(SP - (n)) /* stack grows */ #define st_dec(n) newSP(SP + (n)) /* stack shrinks */ - - -/******** Function return types ********/ - -extern ptr st_ldip(), dt_ldip(); -extern ptr st_lddp(), dt_lddp(), dppop(); -extern long st_lds(), st_ldsw(), dt_lds(), dt_ldsw(), spop(), swpop(), wpop(); -extern unsigned long st_ldu(), st_lduw(), dt_ldu(), dt_lduw(), upop(), uwpop(); - diff --git a/util/int/moncalls.c b/util/int/moncalls.c index 20b46532b..78b507fe7 100644 --- a/util/int/moncalls.c +++ b/util/int/moncalls.c @@ -5,16 +5,24 @@ /* $Id$ */ #include "sysidf.h" +#include "io.h" #include "log.h" #include "alloc.h" #include "shadow.h" +#include "m_sigtrp.h" +#include "monstruct.h" +#include "whatever.h" #include #include #include +#include #include +#include +#include #include #include +#include extern int running; /* from main.c */ extern int fd_limit; /* from io.c */ @@ -1091,7 +1099,7 @@ PRIVATE int vec(n1, n2, addr, vecvec) /* copy the elements */ for ( cp1 = buf[n1], n_ent = 0, p = addr; - ldp = mem_lddp(p); + (ldp = mem_lddp(p)) != 0; p += psize, n_ent++ ) { if (!savestr(n2, ldp)) { @@ -1099,7 +1107,7 @@ PRIVATE int vec(n1, n2, addr, vecvec) } (*vecvec)[n_ent] = cp1; cp2 = buf[n2]; - while (*cp1++ = *cp2++) { + while ((*cp1++ = *cp2++) != '\0') { /* nothing */ } } @@ -1107,9 +1115,7 @@ PRIVATE int vec(n1, n2, addr, vecvec) return 1; } -int memfault(addr, length) - ptr addr; - size length; +int memfault(ptr addr, size length) { /* centralizes (almost) all memory access tests in MON */ if (!is_in_mem(addr, length)) { @@ -1119,17 +1125,14 @@ int memfault(addr, length) return 0; } -efault(wrn) - int wrn; /* warning number */ +void efault(int wrn /* warning number */) { warning(wrn); errno = 14; /* EFAULT */ } -einval(wrn) - int wrn; /* warning number */ +void einval(int wrn /* warning number */) { warning(wrn); errno = 22; /* EINVAL */ } - diff --git a/util/int/monstruct.c b/util/int/monstruct.c index 71a99d9a3..27e769d87 100644 --- a/util/int/monstruct.c +++ b/util/int/monstruct.c @@ -9,6 +9,7 @@ #include "global.h" #include "mem.h" #include "monstruct.h" +#include "whatever.h" #include #include @@ -42,9 +43,7 @@ PRIVATE mem_stfld(addr, offset, length, val) mem_stn(addr + offset, val, length); } -int stat2mem(addr, statb) - ptr addr; - struct stat *statb; +int stat2mem(ptr addr, struct stat *statb) { if (memfault(addr, V7st_sz)) return 0; @@ -62,9 +61,7 @@ int stat2mem(addr, statb) return 1; } -int timeb2mem(addr, timebb) - ptr addr; - struct timeb *timebb; +int timeb2mem(ptr addr, struct timeb *timebb) { if (memfault(addr, V7tb_sz)) return 0; @@ -75,9 +72,7 @@ int timeb2mem(addr, timebb) return 1; } -int tms2mem(addr, tmsb) - ptr addr; - struct tms *tmsb; +int tms2mem(ptr addr, struct tms *tmsb) { if (memfault(addr, V7tms_sz)) return 0; diff --git a/util/int/monstruct.h b/util/int/monstruct.h index 0fe89dd38..729f6d007 100644 --- a/util/int/monstruct.h +++ b/util/int/monstruct.h @@ -12,6 +12,8 @@ /* $Id$ */ +#include "global.h" /* ptr */ + /* struct stat */ #define V7st_dev 0L, 2L /* short */ #define V7st_ino 2L, 2L /* unsigned short */ @@ -67,3 +69,10 @@ #define V7t_lnextc 5L, 1L /* char */ #define V7t_sz_ltch 6L +struct stat; +struct timeb; +struct tms; + +int stat2mem(ptr, struct stat *); +int timeb2mem(ptr, struct timeb *); +int tms2mem(ptr, struct tms *); diff --git a/util/int/rsb.c b/util/int/rsb.c index 4e7f7a6db..417263148 100644 --- a/util/int/rsb.c +++ b/util/int/rsb.c @@ -14,6 +14,7 @@ #include "segment.h" #include "text.h" #include "warn.h" +#include "whatever.h" /* offsets to be added to a local base */ int rsb_rsbcode; diff --git a/util/int/tally.c b/util/int/tally.c index bad5fbbe3..f59562478 100644 --- a/util/int/tally.c +++ b/util/int/tally.c @@ -9,6 +9,7 @@ #include "global.h" #include "linfil.h" #include "alloc.h" +#include "whatever.h" struct line_tally { /* one for each line */ diff --git a/util/int/trap.c b/util/int/trap.c index dcbc42b99..829aa849d 100644 --- a/util/int/trap.c +++ b/util/int/trap.c @@ -18,6 +18,7 @@ #include "linfil.h" #include "rsb.h" #include "fra.h" +#include "whatever.h" extern jmp_buf trapbuf; /* from main.c */ diff --git a/util/int/warn.c b/util/int/warn.c index 973a0a8b2..656b1945d 100644 --- a/util/int/warn.c +++ b/util/int/warn.c @@ -94,7 +94,7 @@ PRIVATE long count_wrn(int nr) PRIVATE int latest_warning_printed; /* set if ... */ /*ARGSUSED*/ -void do_warn(int nr, int L, char *F) +void do_warn(int nr, int L, const char *F) { latest_warning_printed = 0; if (nr < WMSG) { diff --git a/util/int/whatever.h b/util/int/whatever.h new file mode 100644 index 000000000..9aa4b1831 --- /dev/null +++ b/util/int/whatever.h @@ -0,0 +1,43 @@ +/* Copyright (c) 2019 ACK Project. + * See the copyright notice in the ACK home directory, + * in the file "Copyright". + * + * Created on: 2019-10-23 + * + */ +#ifndef WHATEVER_H_ +#define WHATEVER_H_ + +#include "global.h" /* ptr, size */ + +/* + * This header is for _whatever_ isn't in another header. + */ + +/* disassemble.c */ +void disassemble(void); + +/* do_misc.c */ +void putLIN(long); +void putFIL(ptr); + +/* do_proc.c */ +void call(long, int); + +/* init.c */ +void init(int , char **); + +/* m_ioctl.c */ +int do_ioctl(int, int, ptr); + +/* moncalls.c */ +void moncall(void); +int memfault(ptr, size); +void efault(int); +void einval(int); + +/* tally.c */ +void tally(void); +void out_tally(void); + +#endif /* WHATEVER_H_ */ diff --git a/util/ncgg/cvtkeywords b/util/ncgg/cvtkeywords index 54682d600..46472ecbc 100755 --- a/util/ncgg/cvtkeywords +++ b/util/ncgg/cvtkeywords @@ -11,7 +11,7 @@ g/^#/d .r tokendefs a -enterkeyw() { +void enterkeyw(void) { register symbol *sy_p; . diff --git a/util/ncgg/extern.h b/util/ncgg/extern.h index bcff46002..7c999f088 100644 --- a/util/ncgg/extern.h +++ b/util/ncgg/extern.h @@ -38,8 +38,23 @@ extern int maxtokensize; extern int nprocargs, maxprocargs; extern int use_tes; -extern void error(const char* s, ...); +/* genenerated files */ +extern void enterkeyw(void); +extern int yyparse(void); + +/* emlookup.c */ +extern void initemhash(void); + +/* error.c */ extern void fatal(const char* s, ...); +extern void error(const char* s, ...); extern int tabovf(char *string); -extern int strlookup(char *str); + +/* output.c */ extern void errorexit(void); +extern void initio(void); +extern void finishio(void); +extern void statistics(void); + +/* strlookup.c */ +extern int strlookup(char *str); diff --git a/util/ncgg/iocc.c b/util/ncgg/iocc.c index 96ad56f6f..cbce9149d 100644 --- a/util/ncgg/iocc.c +++ b/util/ncgg/iocc.c @@ -174,11 +174,12 @@ iocc_t descr_iocc(char *ident) default: assert(0); case TYPINT: - if (tp->tk_att[i].ta_type != -1) + if (tp->tk_att[i].ta_type != -1) { if (tp->tk_att[i].ta_type == -2) arexp[i] = iextoaddr(arexp[i]); else typerr++; + } break; case TYPBOOL: typerr++; diff --git a/util/ncgg/main.c b/util/ncgg/main.c index b1a7cac0b..46ddeb051 100644 --- a/util/ncgg/main.c +++ b/util/ncgg/main.c @@ -12,16 +12,10 @@ static char rcsid[] = "$Id$"; #include "hall.h" #include "expr.h" #include "extern.h" +#include "lookup.h" char *filename; -extern void enterkeyw(void); -extern void initio(void); -extern void initemhash(void); -extern void finishio(void); -extern void statistics(void); -extern int yyparse(void); - int main(int argc, char **argv) { extern int nerrors; diff --git a/util/opt/mktab.y b/util/opt/mktab.y index d2e39d5f2..54588f06a 100644 --- a/util/opt/mktab.y +++ b/util/opt/mktab.y @@ -349,7 +349,7 @@ void printnodes(void) printf("};\n\nshort lastind = %d;\n\nexpr_t enodes[] = {\n",prevind); for (p=nodes;pex_operator,p->ex_lnode,p->ex_rnode); + (int)(p-nodes),p->ex_operator,p->ex_lnode,p->ex_rnode); printf("};\n\niarg_t iargs[%d];\n", (maxpatlen>0 ? maxpatlen : 1)); if (patid[0]) printf("static char rcsid[] = %s;\n",patid);