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 <object.h>.

In util/ack, rename F_OK to F_TRANSFORM because it conflicts with F_OK
for access() in <unistd.h>.
This commit is contained in:
George Koehler 2019-03-22 15:15:40 -04:00
parent 84f65f7ce3
commit bec236c108
23 changed files with 49 additions and 19 deletions

View file

@ -10,6 +10,8 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
struct exec { struct exec {
short a_magic; short a_magic;
@ -28,6 +30,7 @@ struct nlist
short n_value; short n_value;
}; };
#include <object.h>
#include <out.h> #include <out.h>
#ifndef NORCSID #ifndef NORCSID
@ -164,14 +167,14 @@ main(argc, argv)
} }
/* Action at last */ /* Action at last */
wr_int2(e->a_magic); cv_int2(e->a_magic);
wr_int2(e->a_text); cv_int2(e->a_text);
wr_int2(e->a_data); cv_int2(e->a_data);
wr_int2(e->a_bss); cv_int2(e->a_bss);
wr_int2(e->a_syms); cv_int2(e->a_syms);
wr_int2(e->a_entry); cv_int2(e->a_entry);
wr_int2(e->a_unused); cv_int2(e->a_unused);
wr_int2(e->a_flag); cv_int2(e->a_flag);
emits(&outsect[TEXTSG]) ; emits(&outsect[TEXTSG]) ;
emits(&outsect[ROMSG]) ; emits(&outsect[ROMSG]) ;
emits(&outsect[DATASG]) ; emits(&outsect[DATASG]) ;
@ -180,14 +183,14 @@ main(argc, argv)
return 0; return 0;
} }
wr_int2(n) cv_int2(n)
{ {
putc(n, output); putc(n, output);
putc((n>>8), output); putc((n>>8), output);
} }
/* /*
wr_long(l) cv_long(l)
long l; long l;
{ {
putc((int)(l >> 16), output); putc((int)(l >> 16), output);
@ -231,7 +234,6 @@ emit_symtab()
struct nlist PDP_name; /* symbol table entry in PDP V7 format */ struct nlist PDP_name; /* symbol table entry in PDP V7 format */
register unsigned short i; register unsigned short i;
extern char *malloc();
char *chars; char *chars;
long l; long l;
long off = OFF_CHAR(outhead); long off = OFF_CHAR(outhead);
@ -289,8 +291,8 @@ emit_symtab()
PDP_name.n_name[j] = 0; PDP_name.n_name[j] = 0;
} }
fwrite((char *) &PDP_name, sizeof(char), 8, output); fwrite((char *) &PDP_name, sizeof(char), 8, output);
wr_int2(PDP_name.n_type); cv_int2(PDP_name.n_type);
wr_int2(PDP_name.n_value); cv_int2(PDP_name.n_value);
} }
} }

View file

@ -9,6 +9,7 @@
struct ar_hdr; struct ar_hdr;
struct outhead; struct outhead;
struct outname;
struct outrelo; struct outrelo;
struct outsect; struct outsect;
struct ranlib; struct ranlib;

View file

@ -18,6 +18,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <out.h> #include <out.h>
#include <object.h> #include <object.h>

View file

@ -6,6 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "ack.h" #include "ack.h"
#include "list.h" #include "list.h"
#include "trans.h" #include "trans.h"

View file

@ -4,9 +4,11 @@
* *
*/ */
#include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "ack.h" #include "ack.h"
#include "list.h" #include "list.h"
#include "trans.h" #include "trans.h"
@ -386,7 +388,7 @@ static int process(char* arg)
if (linker) if (linker)
add_input(&orig, linker); add_input(&orig, linker);
return 1; return 1;
case F_OK: case F_TRANSFORM:
break; break;
} }
if (!phase) if (!phase)
@ -555,7 +557,7 @@ static void setneeds(const char* suffix, int tail)
p_suffix = suffix; p_suffix = suffix;
switch (getpath(&phase)) switch (getpath(&phase))
{ {
case F_OK: case F_TRANSFORM:
for (; phase; phase = phase->t_next) for (; phase; phase = phase->t_next)
{ {
if (phase->t_needed) if (phase->t_needed)

View file

@ -4,9 +4,11 @@
* *
*/ */
#include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "ack.h" #include "ack.h"
#include "list.h" #include "list.h"
#include "trans.h" #include "trans.h"

View file

@ -237,7 +237,7 @@ static enum f_path scan_end(trf **first) { /* Finalization */
*first= curr ; *first= curr ;
} }
if ( curr->t_next ) { if ( curr->t_next ) {
return F_OK ; return F_TRANSFORM ;
} }
prev=curr ; prev=curr ;
} }
@ -249,7 +249,7 @@ static enum f_path scan_end(trf **first) { /* Finalization */
if ( prev ) { if ( prev ) {
prev->t_keep=YES ; prev->t_keep=YES ;
} }
return F_OK ; return F_TRANSFORM ;
} }
static void find_cpp(void) { static void find_cpp(void) {

View file

@ -57,7 +57,7 @@ void add_input(path *, trf *);
int runphase(trf *); int runphase(trf *);
/* scan.c */ /* 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 **); enum f_path getpath(trf **);
/* trans.c */ /* trans.c */

View file

@ -24,6 +24,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include <unistd.h>
#include "out.h" #include "out.h"
#define ASSERT(x) switch (2) { case 0: case (x): ; } #define ASSERT(x) switch (2) { case 0: case (x): ; }

View file

@ -10,11 +10,14 @@
** anm [-gopruns] [name ...] ** anm [-gopruns] [name ...]
*/ */
#include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h>
#include "object.h"
#include "out.h" #include "out.h"
#include "arch.h" #include "arch.h"
#include "ranlib.h" #include "ranlib.h"

View file

@ -7,6 +7,7 @@ static char rcsid[] = "$Id$";
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <object.h>
#include <out.h> #include <out.h>
#define OK 0 /* Return value of gethead if Orl Korekt. */ #define OK 0 /* Return value of gethead if Orl Korekt. */

View file

@ -6,6 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "object.h"
#include "out.h" #include "out.h"
/* /*

View file

@ -4,9 +4,12 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
#include <unistd.h>
#include "object.h"
#include "out.h" #include "out.h"
/* /*

View file

@ -25,6 +25,7 @@ static char RcsId[] = "$Id$";
#endif #endif
*/ */
#include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -32,6 +33,7 @@ static char RcsId[] = "$Id$";
#include <sys/stat.h> #include <sys/stat.h>
#include <signal.h> #include <signal.h>
#include <arch.h> #include <arch.h>
#include <object.h>
#include <ranlib.h> #include <ranlib.h>
#include <unistd.h> #include <unistd.h>
#ifdef AAL #ifdef AAL
@ -460,7 +462,7 @@ char *mess;
return; return;
} }
else if (u_fl && status.st_mtime <= member.ar_date) { 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); copy_member(member, ar_fd, fd, 0);
return; return;
} }

View file

@ -4,8 +4,10 @@
/* $Id$ */ /* $Id$ */
#include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h>
#include "logging.h" #include "logging.h"
#include "global.h" #include "global.h"

View file

@ -11,6 +11,7 @@ static char rcsid[] = "$Id$";
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "arch.h" #include "arch.h"
#include "object.h"
#include "out.h" #include "out.h"
#include "ranlib.h" #include "ranlib.h"
#include "const.h" #include "const.h"

View file

@ -11,6 +11,7 @@ static char rcsid[] = "$Id$";
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h>
#include <out.h> #include <out.h>
#include "const.h" #include "const.h"

View file

@ -10,6 +10,7 @@ static char rcsid[] = "$Id$";
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <object.h>
#include <out.h> #include <out.h>
#include "const.h" #include "const.h"
#include "defs.h" #include "defs.h"

View file

@ -10,6 +10,7 @@ static char rcsid[] = "$Id$";
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <object.h>
#include <out.h> #include <out.h>
#include "const.h" #include "const.h"
#include "memory.h" #include "memory.h"

View file

@ -12,6 +12,7 @@ static char rcsid[] = "$Id$";
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <object.h>
#include "out.h" #include "out.h"
#include "const.h" #include "const.h"
#include "memory.h" #include "memory.h"

View file

@ -23,6 +23,7 @@ static char rcsid[]= "$Id$";
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h>
#include "varinfo.h" #include "varinfo.h"
#include "param.h" #include "param.h"
#include "reg.h" #include "reg.h"

View file

@ -4,6 +4,7 @@ static char rcsid[] = "$Id$";
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include <em_pseu.h> #include <em_pseu.h>

View file

@ -11,6 +11,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include "Lpars.h" #include "Lpars.h"
extern int lineno, newline; extern int lineno, newline;