Rationalised use of #includes to be more standards-compliant.

This commit is contained in:
dtrg 2006-07-18 17:10:29 +00:00
parent 8ea67498ed
commit 4c0a0e6119
48 changed files with 80 additions and 66 deletions

View file

@ -7,6 +7,7 @@
* V1.0, 08-Mar-89 AJM * V1.0, 08-Mar-89 AJM
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "out.h" #include "out.h"
#include "arm.h" #include "arm.h"

View file

@ -9,6 +9,7 @@
* It uses ~em/modules/lib/libobject.a. * It uses ~em/modules/lib/libobject.a.
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
struct xexec { struct xexec {
@ -351,7 +352,6 @@ emit_symtab()
char *chars, *xname; char *chars, *xname;
struct outname *names; struct outname *names;
register char *xptr; register char *xptr;
extern char *malloc();
long off = OFF_CHAR(outhead); long off = OFF_CHAR(outhead);
register char *p; register char *p;
register struct outname *np; register struct outname *np;

View file

@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <out.h> #include <out.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h>
struct outhead outhead; struct outhead outhead;
struct outsect outsect[S_MAX]; struct outsect outsect[S_MAX];
@ -163,7 +164,6 @@ main(argc, argv)
*/ */
emits(section) struct outsect *section ; { emits(section) struct outsect *section ; {
char *p; char *p;
char *calloc(), *malloc();
long sz = section->os_flen; long sz = section->os_flen;
rd_outsect(section - outsect); rd_outsect(section - outsect);

View file

@ -78,11 +78,15 @@ separate linker only possible if relocation info produced
/* ========== Machine independent type declarations ========== */ /* ========== Machine independent type declarations ========== */
#ifdef _include #ifdef _include
_include <stdlib.h>
_include <stdio.h> _include <stdio.h>
_include <string.h>
_include <ctype.h> _include <ctype.h>
_include <signal.h> _include <signal.h>
#else #else
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <signal.h> #include <signal.h>
#endif #endif

View file

@ -116,14 +116,6 @@ extern valu_t load();
extern FILE *ffcreat(); extern FILE *ffcreat();
extern FILE *fftemp(); extern FILE *fftemp();
/* some library functions used */
extern char *mktemp();
extern char *malloc();
extern char *realloc();
extern char *calloc();
extern char *getenv();
extern char *strncpy();
/* ========== Machine dependent C declarations ========== */ /* ========== Machine dependent C declarations ========== */
#include "mach1.c" #include "mach1.c"

View file

@ -20,7 +20,7 @@ extern YYSTYPE yylval;
/* ========== Machine independent C routines ========== */ /* ========== Machine independent C routines ========== */
stop() { void stop() {
#if DEBUG < 2 #if DEBUG < 2
unlink(temppath); unlink(temppath);
#ifdef LISTING #ifdef LISTING

View file

@ -2,6 +2,9 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "assert.h" #include "assert.h"
#include "param.h" #include "param.h"
#include "tables.h" #include "tables.h"

View file

@ -2,6 +2,8 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <stdlib.h>
#include <string.h>
#include "param.h" #include "param.h"
#include "tables.h" #include "tables.h"
#include "types.h" #include "types.h"

View file

@ -2,6 +2,7 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <stdlib.h>
#include "assert.h" #include "assert.h"
#include "param.h" #include "param.h"
#include "tables.h" #include "tables.h"
@ -29,7 +30,6 @@ static char rcsid[] = "$Id$";
char *stab[MAXSTAB]; char *stab[MAXSTAB];
int nstab=0; int nstab=0;
string malloc();
string myalloc(size) { string myalloc(size) {
register string p; register string p;

View file

@ -2,6 +2,7 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <stdlib.h>
#include "assert.h" #include "assert.h"
#include <stdio.h> #include <stdio.h>
#include "param.h" #include "param.h"

View file

@ -2,6 +2,9 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "assert.h" #include "assert.h"
#include "param.h" #include "param.h"
#include "tables.h" #include "tables.h"

View file

@ -2,6 +2,8 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <stdlib.h>
#include <string.h>
#include "param.h" #include "param.h"
#include "tables.h" #include "tables.h"
#include "types.h" #include "types.h"
@ -15,7 +17,6 @@ static char rcsid[] = "$Id$";
*/ */
extern string myalloc(); extern string myalloc();
extern char *strcpy();
glosym_p glolist= (glosym_p) 0; glosym_p glolist= (glosym_p) 0;

View file

@ -2,6 +2,7 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include <stdlib.h>
#include "assert.h" #include "assert.h"
#include "param.h" #include "param.h"
#include "tables.h" #include "tables.h"
@ -29,7 +30,6 @@ static char rcsid[] = "$Id$";
char *stab[MAXSTAB]; char *stab[MAXSTAB];
int nstab=0; int nstab=0;
string malloc();
string myalloc(size) { string myalloc(size) {
register string p; register string p;

View file

@ -2,8 +2,9 @@
static char rcsid[] = "$Id$"; static char rcsid[] = "$Id$";
#endif #endif
#include "assert.h" #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "assert.h"
#include "param.h" #include "param.h"
#include "tables.h" #include "tables.h"
#include "types.h" #include "types.h"

View file

@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <out.h> #include <out.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h>
long lseek(); long lseek();
@ -270,7 +271,6 @@ writef(addr,sz,cnt)
*/ */
emits(section) struct outsect *section ; { emits(section) struct outsect *section ; {
char *p; char *p;
char *calloc(), *malloc();
long sz = section->os_flen; long sz = section->os_flen;
rd_outsect(section - outsect); rd_outsect(section - outsect);
@ -484,7 +484,6 @@ emit_symtab()
register struct outname *A; register struct outname *A;
struct sym *MACHnames; struct sym *MACHnames;
register struct sym *M; register struct sym *M;
extern char *malloc(), *calloc();
char *chars; char *chars;
long offX = OFF_CHAR(outhead) - 4; long offX = OFF_CHAR(outhead) - 4;

View file

@ -7,6 +7,7 @@
indicated by the parameters, and then give a core dump indicated by the parameters, and then give a core dump
*/ */
#include <string.h>
#include <system.h> #include <system.h>
static static

View file

@ -8,6 +8,9 @@
/* I/O part of em_code module. /* I/O part of em_code module.
Also contains C_open, C_close Also contains C_open, C_close
*/ */
#include <stdlib.h>
#include <stdio.h>
#include <alloc.h> #include <alloc.h>
#include <em_arith.h> #include <em_arith.h>
#include "insert.h" #include "insert.h"

View file

@ -4,6 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <string.h>
#include <system.h> #include <system.h>
#include "print.h" #include "print.h"

View file

@ -86,12 +86,12 @@ EM_doinstr(p)
if (! checkarg(&(p->em_arg), cst_ptyp)) return; if (! checkarg(&(p->em_arg), cst_ptyp)) return;
} }
else { else {
#include "C_mnem_narg" #include "C_mnem_narg.h"
return; return;
} }
break; break;
} }
#include "C_mnem" #include "C_mnem.h"
} }
PRIVATE void PRIVATE void

View file

@ -17,6 +17,8 @@
some routines from the system module. and the em_code module some routines from the system module. and the em_code module
*/ */
#include <stdlib.h>
#include <stdio.h>
#include <assert.h> #include <assert.h>
#include <alloc.h> #include <alloc.h>
#include <system.h> #include <system.h>
@ -35,8 +37,6 @@
#define ungetbyte(uch) ((uch) >= 0 && (*--_ich = (uch))) #define ungetbyte(uch) ((uch) >= 0 && (*--_ich = (uch)))
#define init_input() (_fill(), _ich--) #define init_input() (_fill(), _ich--)
#define EOF -1
static File *fd; static File *fd;
static char *_ich; static char *_ich;

View file

@ -9,6 +9,7 @@
*/ */
#include <ctype.h> #include <ctype.h>
#include <string.h>
/* #define XXX_YYY /* only for early debugging */ /* #define XXX_YYY /* only for early debugging */

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_access(path, mode) sys_access(path, mode)

View file

@ -4,15 +4,13 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
#include <unistd.h>
char *sbrk();
char * char *
sys_break(incr) sys_break(incr)
int incr; int incr;
{ {
char *sbrk();
register char *brk = sbrk(incr); register char *brk = sbrk(incr);
if (brk == (char *) 0 || brk == (char *)-1) if (brk == (char *) 0 || brk == (char *)-1)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_chmode(path, mode) sys_chmode(path, mode)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
void void
sys_close(fp) sys_close(fp)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
extern File *_get_entry(); extern File *_get_entry();

View file

@ -6,7 +6,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <system.h> #include "system.h"
long long
sys_filesize(path) sys_filesize(path)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_lock(path) sys_lock(path)

View file

@ -6,8 +6,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "system.h"
#include <system.h>
long long
sys_modtime(path) sys_modtime(path)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
extern File *_get_entry(); extern File *_get_entry();

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_read(fp, bufptr, bufsiz, pnbytes) sys_read(fp, bufptr, bufsiz, pnbytes)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_remove(path) sys_remove(path)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_rename(path1, path2) sys_rename(path1, path2)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
long lseek(); long lseek();

View file

@ -5,7 +5,7 @@
/* $Id$ */ /* $Id$ */
#include <stdlib.h> #include <stdlib.h>
#include <system.h> #include "system.h"
void void
sys_stop(how) sys_stop(how)

View file

@ -4,7 +4,7 @@
*/ */
/* RCS: $Id$ */ /* RCS: $Id$ */
#include <system.h> #include "system.h"
File _sys_ftab[SYS_NOPEN] = { File _sys_ftab[SYS_NOPEN] = {
{ 0, OP_READ}, { 0, OP_READ},

View file

@ -62,6 +62,4 @@ _PROTOTYPE(long sys_modtime, (char *));
/* return value for sys_break */ /* return value for sys_break */
#define ILL_BREAK ((char *)0) #define ILL_BREAK ((char *)0)
/* system's idea of block */
#define BUFSIZ 1024
#endif /* __SYSTEM_INCLUDED__ */ #endif /* __SYSTEM_INCLUDED__ */

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
long time(); long time();

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_unlock(path) sys_unlock(path)

View file

@ -4,7 +4,7 @@
*/ */
/* $Id$ */ /* $Id$ */
#include <system.h> #include "system.h"
int int
sys_write(fp, bufptr, nbytes) sys_write(fp, bufptr, nbytes)

View file

@ -25,6 +25,9 @@ static char RcsId[] = "$Id$";
#endif #endif
*/ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <signal.h> #include <signal.h>
@ -38,7 +41,6 @@ struct ranlib *tab;
unsigned int tnum = 0; unsigned int tnum = 0;
char *tstrtab; char *tstrtab;
unsigned int tssiz = 0; unsigned int tssiz = 0;
char *malloc(), *realloc(), *strcpy(), *strncpy();
long time(); long time();
unsigned int tabsz, strtabsz; unsigned int tabsz, strtabsz;
#else #else

View file

@ -1,3 +1,4 @@
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "states.h" #include "states.h"

View file

@ -1,3 +1,6 @@
#include <stdlib.h>
#include <string.h>
#if __STDC__ #if __STDC__
#include <stdarg.h> #include <stdarg.h>
extern out(char *, ...); extern out(char *, ...);

View file

@ -38,6 +38,8 @@
*/ */
{ {
#include <stdlib.h>
#include <string.h>
#include "decl.h" #include "decl.h"
extern int lineno, yyleng; extern int lineno, yyleng;

View file

@ -11,7 +11,9 @@ static char rcsid[]="$Id$";
* Author: Hans van Staveren * Author: Hans van Staveren
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <assert.h> #include <assert.h>
#include <em_spec.h> #include <em_spec.h>
#include <em_flag.h> #include <em_flag.h>
@ -37,8 +39,8 @@ static char rcsid[]="$Id$";
inst_t yy_instance; inst_t yy_instance;
} }
%type <yy_list1> list1,structlistel %type <yy_list1> list1 structlistel
%type <yy_list2> structlist,structdecl %type <yy_list2> structlist structdecl
%type <yy_expr> expr optexpr %type <yy_expr> expr optexpr
%type <yy_cost> optcost cost optcommacost %type <yy_cost> optcost cost optcommacost
%type <yy_int> optboolexpr optnocoerc mnem emargno tokargno optprop %type <yy_int> optboolexpr optnocoerc mnem emargno tokargno optprop
@ -48,8 +50,8 @@ static char rcsid[]="$Id$";
%type <yy_instance> tokeninstance %type <yy_instance> tokeninstance
%type <yy_string> optformat %type <yy_string> optformat
%token <yy_string> IDENT TYPENAME %token <yy_string> IDENT TYPENAME
%token <yy_ident> RIDENT,PIDENT,TIDENT,EIDENT %token <yy_ident> RIDENT PIDENT TIDENT EIDENT
%token <yy_string> LSTRING,STRING %token <yy_string> LSTRING STRING
%token <yy_int> NUMBER %token <yy_int> NUMBER
%token <yy_intp> CIDENT %token <yy_intp> CIDENT
%token REGISTERHEAD TOKENHEAD EXPRESSIONHEAD CODEHEAD MOVEHEAD TESTHEAD STACKHEAD %token REGISTERHEAD TOKENHEAD EXPRESSIONHEAD CODEHEAD MOVEHEAD TESTHEAD STACKHEAD
@ -63,12 +65,12 @@ static char rcsid[]="$Id$";
%left OR2 %left OR2
%left AND2 %left AND2
%left CMPEQ,CMPNE %left CMPEQ CMPNE
%left CMPLT,CMPLE,CMPGT,CMPGE %left CMPLT CMPLE CMPGT CMPGE
%left RSHIFT,LSHIFT %left RSHIFT LSHIFT
%left '+','-' %left '+' '-'
%left '*','/','%' %left '*' '/' '%'
%nonassoc NOT,COMP,UMINUS %nonassoc NOT COMP UMINUS
%nonassoc '$' %nonassoc '$'
%% %%
machinespec machinespec

View file

@ -1,20 +1,14 @@
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include <em_spec.h> #include <em_spec.h>
#include <em_flag.h> #include <em_flag.h>
#include <em_reg.h> #include <em_reg.h>
#include "booth.h" #include "booth.h"
extern char *strncpy(), *strcpy();
extern char *malloc();
#ifndef __STDC__
extern char *sprintf();
#else
/* sprintf should be declared in stdio.h, as returning an int */
#endif
char * myalloc(n) { char * myalloc(n) {
register char *p; register char *p;

View file

@ -9,7 +9,9 @@
Many mods by Ceriel Jacobs Many mods by Ceriel Jacobs
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#ifndef NORCSID #ifndef NORCSID
static char *RcsId = "$Id$"; static char *RcsId = "$Id$";
@ -28,8 +30,6 @@ char *ProgCall; /* callname of this program */
int TabSize = 128; /* default size of generated table */ int TabSize = 128; /* default size of generated table */
char *InitialValue; /* initial value of all table entries */ char *InitialValue; /* initial value of all table entries */
extern char *malloc(), *strcpy();
main(argc, argv) main(argc, argv)
char *argv[]; char *argv[];
{ {

View file

@ -5,6 +5,8 @@
*/ */
/* PREPROCESSOR: MACRO-TEXT REPLACEMENT ROUTINES */ /* PREPROCESSOR: MACRO-TEXT REPLACEMENT ROUTINES */
#include <stdlib.h>
#include <string.h>
#include "debug.h" /* UF */ #include "debug.h" /* UF */
#include "pathlength.h" /* UF */ #include "pathlength.h" /* UF */
#include "textsize.h" /* UF */ #include "textsize.h" /* UF */