From bec236c108d007e2c7df1cd63cad637518846d1d Mon Sep 17 00:00:00 2001 From: George Koehler Date: Fri, 22 Mar 2019 15:15:40 -0400 Subject: [PATCH] Include more headers to declare functions. This causes clang to give fewer warnings of implicit declarations of functions. In mach/pdp/cv/cv.c, rename wr_int2() to cv_int2() because it conflicts with wr_int2() in . In util/ack, rename F_OK to F_TRANSFORM because it conflicts with F_OK for access() in . --- mach/pdp/cv/cv.c | 28 +++++++++++++++------------- modules/src/object/object.h | 1 + plat/osx/cvmach/cvmach.c | 1 + util/ack/files.c | 1 + util/ack/main.c | 6 ++++-- util/ack/run.c | 2 ++ util/ack/scan.c | 4 ++-- util/ack/trans.h | 2 +- util/amisc/aelflod.c | 1 + util/amisc/anm.c | 3 +++ util/amisc/ashow.c | 1 + util/amisc/asize.c | 1 + util/amisc/astrip.c | 3 +++ util/arch/archiver.c | 4 +++- util/int/io.c | 2 ++ util/led/archive.c | 1 + util/led/error.c | 1 + util/led/finish.c | 1 + util/led/output.c | 1 + util/led/write.c | 1 + util/ncgg/output.c | 1 + util/opt/cleanup.c | 1 + util/topgen/main.c | 1 + 23 files changed, 49 insertions(+), 19 deletions(-) diff --git a/mach/pdp/cv/cv.c b/mach/pdp/cv/cv.c index 1cf76e930..6dbea9b0d 100644 --- a/mach/pdp/cv/cv.c +++ b/mach/pdp/cv/cv.c @@ -10,6 +10,8 @@ */ #include +#include +#include struct exec { short a_magic; @@ -28,6 +30,7 @@ struct nlist short n_value; }; +#include #include #ifndef NORCSID @@ -164,14 +167,14 @@ main(argc, argv) } /* Action at last */ - wr_int2(e->a_magic); - wr_int2(e->a_text); - wr_int2(e->a_data); - wr_int2(e->a_bss); - wr_int2(e->a_syms); - wr_int2(e->a_entry); - wr_int2(e->a_unused); - wr_int2(e->a_flag); + cv_int2(e->a_magic); + cv_int2(e->a_text); + cv_int2(e->a_data); + cv_int2(e->a_bss); + cv_int2(e->a_syms); + cv_int2(e->a_entry); + cv_int2(e->a_unused); + cv_int2(e->a_flag); emits(&outsect[TEXTSG]) ; emits(&outsect[ROMSG]) ; emits(&outsect[DATASG]) ; @@ -180,14 +183,14 @@ main(argc, argv) return 0; } -wr_int2(n) +cv_int2(n) { putc(n, output); putc((n>>8), output); } /* -wr_long(l) +cv_long(l) long l; { putc((int)(l >> 16), output); @@ -231,7 +234,6 @@ emit_symtab() struct nlist PDP_name; /* symbol table entry in PDP V7 format */ register unsigned short i; - extern char *malloc(); char *chars; long l; long off = OFF_CHAR(outhead); @@ -289,8 +291,8 @@ emit_symtab() PDP_name.n_name[j] = 0; } fwrite((char *) &PDP_name, sizeof(char), 8, output); - wr_int2(PDP_name.n_type); - wr_int2(PDP_name.n_value); + cv_int2(PDP_name.n_type); + cv_int2(PDP_name.n_value); } } diff --git a/modules/src/object/object.h b/modules/src/object/object.h index cf6ac476a..dcbffb88e 100644 --- a/modules/src/object/object.h +++ b/modules/src/object/object.h @@ -9,6 +9,7 @@ struct ar_hdr; struct outhead; +struct outname; struct outrelo; struct outsect; struct ranlib; diff --git a/plat/osx/cvmach/cvmach.c b/plat/osx/cvmach/cvmach.c index 5f8315ddd..32ee18677 100644 --- a/plat/osx/cvmach/cvmach.c +++ b/plat/osx/cvmach/cvmach.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include diff --git a/util/ack/files.c b/util/ack/files.c index 413395438..2c52ad83f 100644 --- a/util/ack/files.c +++ b/util/ack/files.c @@ -6,6 +6,7 @@ #include #include +#include #include "ack.h" #include "list.h" #include "trans.h" diff --git a/util/ack/main.c b/util/ack/main.c index a57454d60..47fb44f0e 100644 --- a/util/ack/main.c +++ b/util/ack/main.c @@ -4,9 +4,11 @@ * */ +#include #include #include #include +#include #include "ack.h" #include "list.h" #include "trans.h" @@ -386,7 +388,7 @@ static int process(char* arg) if (linker) add_input(&orig, linker); return 1; - case F_OK: + case F_TRANSFORM: break; } if (!phase) @@ -555,7 +557,7 @@ static void setneeds(const char* suffix, int tail) p_suffix = suffix; switch (getpath(&phase)) { - case F_OK: + case F_TRANSFORM: for (; phase; phase = phase->t_next) { if (phase->t_needed) diff --git a/util/ack/run.c b/util/ack/run.c index 32cb59fe5..8c59aa76a 100644 --- a/util/ack/run.c +++ b/util/ack/run.c @@ -4,9 +4,11 @@ * */ +#include #include #include #include +#include #include "ack.h" #include "list.h" #include "trans.h" diff --git a/util/ack/scan.c b/util/ack/scan.c index 3aaab8492..e846578de 100644 --- a/util/ack/scan.c +++ b/util/ack/scan.c @@ -237,7 +237,7 @@ static enum f_path scan_end(trf **first) { /* Finalization */ *first= curr ; } if ( curr->t_next ) { - return F_OK ; + return F_TRANSFORM ; } prev=curr ; } @@ -249,7 +249,7 @@ static enum f_path scan_end(trf **first) { /* Finalization */ if ( prev ) { prev->t_keep=YES ; } - return F_OK ; + return F_TRANSFORM ; } static void find_cpp(void) { diff --git a/util/ack/trans.h b/util/ack/trans.h index 54086a563..f16f64d7c 100644 --- a/util/ack/trans.h +++ b/util/ack/trans.h @@ -57,7 +57,7 @@ void add_input(path *, trf *); int runphase(trf *); /* scan.c */ -enum f_path { F_OK, F_NOMATCH, F_NOPATH } ; +enum f_path { F_TRANSFORM, F_NOMATCH, F_NOPATH } ; enum f_path getpath(trf **); /* trans.c */ diff --git a/util/amisc/aelflod.c b/util/amisc/aelflod.c index de4bcedd8..4ad77adbc 100644 --- a/util/amisc/aelflod.c +++ b/util/amisc/aelflod.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "out.h" #define ASSERT(x) switch (2) { case 0: case (x): ; } diff --git a/util/amisc/anm.c b/util/amisc/anm.c index f2469f772..076c1424a 100644 --- a/util/amisc/anm.c +++ b/util/amisc/anm.c @@ -10,11 +10,14 @@ ** anm [-gopruns] [name ...] */ +#include #include #include #include #include +#include +#include "object.h" #include "out.h" #include "arch.h" #include "ranlib.h" diff --git a/util/amisc/ashow.c b/util/amisc/ashow.c index 107e5f8ed..a1dbacf2f 100644 --- a/util/amisc/ashow.c +++ b/util/amisc/ashow.c @@ -7,6 +7,7 @@ static char rcsid[] = "$Id$"; #include #include #include +#include #include #define OK 0 /* Return value of gethead if Orl Korekt. */ diff --git a/util/amisc/asize.c b/util/amisc/asize.c index 998be441d..9b7bd7868 100644 --- a/util/amisc/asize.c +++ b/util/amisc/asize.c @@ -6,6 +6,7 @@ #include #include +#include "object.h" #include "out.h" /* diff --git a/util/amisc/astrip.c b/util/amisc/astrip.c index e82cb27f1..51342be4e 100644 --- a/util/amisc/astrip.c +++ b/util/amisc/astrip.c @@ -4,9 +4,12 @@ */ /* $Id$ */ +#include #include #include #include +#include +#include "object.h" #include "out.h" /* diff --git a/util/arch/archiver.c b/util/arch/archiver.c index 2be5fd3ad..4db6cdc73 100644 --- a/util/arch/archiver.c +++ b/util/arch/archiver.c @@ -25,6 +25,7 @@ static char RcsId[] = "$Id$"; #endif */ +#include #include #include #include @@ -32,6 +33,7 @@ static char RcsId[] = "$Id$"; #include #include #include +#include #include #include #ifdef AAL @@ -460,7 +462,7 @@ char *mess; return; } else if (u_fl && status.st_mtime <= member.ar_date) { - wr_arhdr(fd, member); + wr_arhdr(fd, &member); copy_member(member, ar_fd, fd, 0); return; } diff --git a/util/int/io.c b/util/int/io.c index 926c58b89..a903307aa 100644 --- a/util/int/io.c +++ b/util/int/io.c @@ -4,8 +4,10 @@ /* $Id$ */ +#include #include #include +#include #include "logging.h" #include "global.h" diff --git a/util/led/archive.c b/util/led/archive.c index 1b48dc087..770cd9348 100644 --- a/util/led/archive.c +++ b/util/led/archive.c @@ -11,6 +11,7 @@ static char rcsid[] = "$Id$"; #include #include #include "arch.h" +#include "object.h" #include "out.h" #include "ranlib.h" #include "const.h" diff --git a/util/led/error.c b/util/led/error.c index 61dc7983e..aeb8a31b3 100644 --- a/util/led/error.c +++ b/util/led/error.c @@ -11,6 +11,7 @@ static char rcsid[] = "$Id$"; #include #include #include +#include #include #include "const.h" diff --git a/util/led/finish.c b/util/led/finish.c index 9735ae440..e4d4dcbbe 100644 --- a/util/led/finish.c +++ b/util/led/finish.c @@ -10,6 +10,7 @@ static char rcsid[] = "$Id$"; #include #include #include +#include #include #include "const.h" #include "defs.h" diff --git a/util/led/output.c b/util/led/output.c index b303b24b2..44233840b 100644 --- a/util/led/output.c +++ b/util/led/output.c @@ -10,6 +10,7 @@ static char rcsid[] = "$Id$"; #include #include #include +#include #include #include "const.h" #include "memory.h" diff --git a/util/led/write.c b/util/led/write.c index cf161b61f..a0554b8e2 100644 --- a/util/led/write.c +++ b/util/led/write.c @@ -12,6 +12,7 @@ static char rcsid[] = "$Id$"; #include #include #include +#include #include "out.h" #include "const.h" #include "memory.h" diff --git a/util/ncgg/output.c b/util/ncgg/output.c index 7d85b9179..40733bab0 100644 --- a/util/ncgg/output.c +++ b/util/ncgg/output.c @@ -23,6 +23,7 @@ static char rcsid[]= "$Id$"; #include #include #include +#include #include "varinfo.h" #include "param.h" #include "reg.h" diff --git a/util/opt/cleanup.c b/util/opt/cleanup.c index 95564da0c..504e712f4 100644 --- a/util/opt/cleanup.c +++ b/util/opt/cleanup.c @@ -4,6 +4,7 @@ static char rcsid[] = "$Id$"; #include #include +#include #include "param.h" #include "types.h" #include diff --git a/util/topgen/main.c b/util/topgen/main.c index 35e0585d7..1a8dfed56 100644 --- a/util/topgen/main.c +++ b/util/topgen/main.c @@ -11,6 +11,7 @@ #include #include +#include #include "Lpars.h" extern int lineno, newline;