Rationalised use of #includes to be more standards-compliant.
authordtrg <none@none>
Tue, 18 Jul 2006 17:10:29 +0000 (17:10 +0000)
committerdtrg <none@none>
Tue, 18 Jul 2006 17:10:29 +0000 (17:10 +0000)
48 files changed:
mach/arm/cv/cv.c
mach/i386/cv/cv.c
mach/minixST/cv/cv.c
mach/proto/as/comm0.h
mach/proto/as/comm1.h
mach/proto/as/comm4.c
mach/proto/cg/compute.c
mach/proto/cg/glosym.c
mach/proto/cg/salloc.c
mach/proto/cg/subr.c
mach/proto/ncg/compute.c
mach/proto/ncg/glosym.c
mach/proto/ncg/salloc.c
mach/proto/ncg/subr.c
mach/vax4/cv/cv.c
modules/src/assert/BadAssert.c
modules/src/em_code/em.c
modules/src/print/format.c
modules/src/read_em/mkcalls.c
modules/src/read_em/read_em.c
modules/src/read_em/reade.c
modules/src/system/access.c
modules/src/system/break.c
modules/src/system/chmode.c
modules/src/system/close.c
modules/src/system/create.c
modules/src/system/filesize.c
modules/src/system/lock.c
modules/src/system/modtime.c
modules/src/system/open.c
modules/src/system/read.c
modules/src/system/remove.c
modules/src/system/rename.c
modules/src/system/seek.c
modules/src/system/stop.c
modules/src/system/system.c
modules/src/system/system.h
modules/src/system/time.c
modules/src/system/unlock.c
modules/src/system/write.c
util/arch/archiver.c
util/ceg/as_parser/eval/eval.c
util/ceg/as_parser/help.c
util/ceg/as_parser/pars.g
util/cgg/bootgram.y
util/cgg/main.c
util/cmisc/tabgen.c
util/cpp/replace.c

index 49e82f6..1d02768 100644 (file)
@@ -7,6 +7,7 @@
  *  V1.0, 08-Mar-89 AJM
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include "out.h"
 #include "arm.h"
index 12f297b..7ad5b6d 100644 (file)
@@ -9,6 +9,7 @@
  * It uses ~em/modules/lib/libobject.a.
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 
 struct xexec {
@@ -351,7 +352,6 @@ emit_symtab()
        char *chars, *xname;
        struct outname *names;
        register char *xptr;
-       extern char *malloc();
        long off = OFF_CHAR(outhead);
        register char *p;
        register struct outname *np;
index 4ff5e0f..b102fac 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <out.h>
 #include <assert.h>
+#include <stdlib.h>
 
 struct outhead outhead;
 struct outsect outsect[S_MAX];
@@ -163,7 +164,6 @@ main(argc, argv)
  */
 emits(section) struct outsect *section ; {
        char            *p;
-       char            *calloc(), *malloc();
        long sz = section->os_flen;
 
        rd_outsect(section - outsect);
index 86e05b6..8f3d26c 100644 (file)
@@ -78,11 +78,15 @@ separate linker only possible if relocation info produced
 /* ========== Machine independent type declarations ========== */
 
 #ifdef _include
+_include    <stdlib.h>
 _include       <stdio.h>
+_include    <string.h>
 _include       <ctype.h>
 _include       <signal.h>
 #else
+#include    <stdlib.h>
 #include       <stdio.h>
+#include    <string.h>
 #include       <ctype.h>
 #include       <signal.h>
 #endif
index 14f4fc6..7e46204 100644 (file)
@@ -116,14 +116,6 @@ extern valu_t      load();
 extern FILE    *ffcreat();
 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 ========== */
 
 #include       "mach1.c"
index 2b68b40..9adff1e 100644 (file)
@@ -20,7 +20,7 @@ extern YYSTYPE        yylval;
 
 /* ========== Machine independent C routines ========== */
 
-stop() {
+void stop() {
 #if DEBUG < 2
        unlink(temppath);
 #ifdef LISTING
index 07c2908..26570f4 100644 (file)
@@ -2,6 +2,9 @@
 static char rcsid[] = "$Id$";
 #endif
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include "assert.h"
 #include "param.h"
 #include "tables.h"
index 72cbf51..4052c1b 100644 (file)
@@ -2,6 +2,8 @@
 static char rcsid[] = "$Id$";
 #endif
 
+#include <stdlib.h>
+#include <string.h>
 #include "param.h"
 #include "tables.h"
 #include "types.h"
index 99347ce..30554a4 100644 (file)
@@ -2,6 +2,7 @@
 static char rcsid[] = "$Id$";
 #endif
 
+#include <stdlib.h>
 #include "assert.h"
 #include "param.h"
 #include "tables.h"
@@ -29,7 +30,6 @@ static char rcsid[] = "$Id$";
 
 char *stab[MAXSTAB];
 int nstab=0;
-string malloc();
 
 string myalloc(size) {
        register string p;
index a4b303a..325f54a 100644 (file)
@@ -2,6 +2,7 @@
 static char rcsid[] = "$Id$";
 #endif
 
+#include <stdlib.h>
 #include "assert.h"
 #include <stdio.h>
 #include "param.h"
index 347488c..f407aa8 100644 (file)
@@ -2,6 +2,9 @@
 static char rcsid[] = "$Id$";
 #endif
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include "assert.h"
 #include "param.h"
 #include "tables.h"
index 4762619..4052c1b 100644 (file)
@@ -2,6 +2,8 @@
 static char rcsid[] = "$Id$";
 #endif
 
+#include <stdlib.h>
+#include <string.h>
 #include "param.h"
 #include "tables.h"
 #include "types.h"
@@ -15,7 +17,6 @@ static char rcsid[] = "$Id$";
  */
 
 extern string myalloc();
-extern char *strcpy();
 
 glosym_p glolist= (glosym_p) 0;
 
index 5337096..2bafb3f 100644 (file)
@@ -2,6 +2,7 @@
 static char rcsid[] = "$Id$";
 #endif
 
+#include <stdlib.h>
 #include "assert.h"
 #include "param.h"
 #include "tables.h"
@@ -29,7 +30,6 @@ static char rcsid[] = "$Id$";
 
 char *stab[MAXSTAB];
 int nstab=0;
-string malloc();
 
 string myalloc(size) {
        register string p;
index 67e8020..7d99ebc 100644 (file)
@@ -2,8 +2,9 @@
 static char rcsid[] = "$Id$";
 #endif
 
-#include "assert.h"
+#include <stdlib.h>
 #include <stdio.h>
+#include "assert.h"
 #include "param.h"
 #include "tables.h"
 #include "types.h"
index 26769b6..0345426 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <out.h>
 #include <assert.h>
+#include <stdlib.h>
 
 long   lseek();
 
@@ -270,7 +271,6 @@ writef(addr,sz,cnt)
  */
 emits(section) struct outsect *section ; {
        char            *p;
-       char            *calloc(), *malloc();
        long sz = section->os_flen;
 
        rd_outsect(section - outsect);
@@ -484,7 +484,6 @@ emit_symtab()
        register struct outname *A;
        struct sym *MACHnames;
        register struct sym *M;
-       extern char *malloc(), *calloc();
        char *chars;
        long offX = OFF_CHAR(outhead) - 4;
 
index cad0b39..3584221 100644 (file)
@@ -7,6 +7,7 @@
        indicated by the parameters, and then give a core dump
 */
 
+#include <string.h>
 #include <system.h>
 
 static
index a97216c..e484a3e 100644 (file)
@@ -8,6 +8,9 @@
 /*     I/O part of em_code module.
        Also contains C_open, C_close
 */
+
+#include <stdlib.h>
+#include <stdio.h>
 #include <alloc.h>
 #include <em_arith.h>
 #include "insert.h"
index ec32ee1..e207eaa 100644 (file)
@@ -4,6 +4,7 @@
  */
 /* $Id$ */
 
+#include <string.h>
 #include <system.h>
 #include "print.h"
 
index 2706ff5..f6dd3cb 100644 (file)
@@ -86,12 +86,12 @@ EM_doinstr(p)
                                if (! checkarg(&(p->em_arg), cst_ptyp)) return;
                        }
                        else {
-#include "C_mnem_narg"
+#include "C_mnem_narg.h"
                                return;
                        }
                        break;
        }
-#include "C_mnem"
+#include "C_mnem.h"
 }
 
 PRIVATE void
index 7ec49b2..ccf9968 100644 (file)
@@ -17,6 +17,8 @@
        some routines from the system module. and the em_code module
 */
 
+#include <stdlib.h>
+#include <stdio.h>
 #include <assert.h>
 #include <alloc.h>
 #include <system.h>
@@ -35,8 +37,6 @@
 #define ungetbyte(uch) ((uch) >= 0 && (*--_ich = (uch)))
 #define init_input()   (_fill(), _ich--)
 
-#define EOF    -1
-
 static File *fd;
 static char *_ich;
 
index 88d582b..69acf27 100644 (file)
@@ -9,6 +9,7 @@
 */
 
 #include <ctype.h>
+#include <string.h>
 
 /* #define XXX_YYY     /* only for early debugging */
 
index 98389fa..20773c7 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_access(path, mode)
index cbd1150..254ea0c 100644 (file)
@@ -4,15 +4,13 @@
  */
 /* $Id$ */
 
-#include <system.h>
-
-char *sbrk();
+#include "system.h"
+#include <unistd.h>
 
 char *
 sys_break(incr)
        int incr;
 {
-       char *sbrk();
        register char *brk = sbrk(incr);
 
        if (brk == (char *) 0 || brk == (char *)-1)
index faf0723..0c0c1f5 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_chmode(path, mode)
index 7fff589..03aa767 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 void
 sys_close(fp)
index 59bc9ec..21203c4 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 extern File *_get_entry();
 
index 930ca62..c3a62e5 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <system.h>
+#include "system.h"
 
 long
 sys_filesize(path)
index e3051ff..5203fcb 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_lock(path)
index af372b7..129c3bc 100644 (file)
@@ -6,8 +6,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-
-#include <system.h>
+#include "system.h"
 
 long
 sys_modtime(path)
index b99eb66..cf24f32 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 extern File *_get_entry();
 
index 9bb64b8..850d68f 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_read(fp, bufptr, bufsiz, pnbytes)
index ba26085..435d67b 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_remove(path)
index 3876025..f653077 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_rename(path1, path2)
index fbdb4ee..e4d1f85 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 long lseek();
 
index d35c98d..05986b1 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 
 #include <stdlib.h>
-#include <system.h>
+#include "system.h"
 
 void
 sys_stop(how)
index 2c196be..1670c96 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* RCS: $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 File _sys_ftab[SYS_NOPEN] = {
        { 0, OP_READ},
index 5b189a1..72cbd97 100644 (file)
@@ -62,6 +62,4 @@ _PROTOTYPE(long sys_modtime, (char *));
 /* return value for sys_break */
 #define ILL_BREAK      ((char *)0)
 
-/* system's idea of block */
-#define BUFSIZ 1024
 #endif /* __SYSTEM_INCLUDED__ */
index 24dca1f..e06a9fa 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 long time();
 
index dda75e6..51ae6f5 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_unlock(path)
index 62ef98c..7423a59 100644 (file)
@@ -4,7 +4,7 @@
  */
 /* $Id$ */
 
-#include <system.h>
+#include "system.h"
 
 int
 sys_write(fp, bufptr, nbytes)
index 61bbb13..b627556 100644 (file)
@@ -25,6 +25,9 @@ static char RcsId[] = "$Id$";
 #endif
  */
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <signal.h>
@@ -38,7 +41,6 @@ struct ranlib *tab;
 unsigned int   tnum = 0;
 char   *tstrtab;
 unsigned int   tssiz = 0;
-char   *malloc(), *realloc(), *strcpy(), *strncpy();
 long   time();
 unsigned int tabsz, strtabsz;
 #else
index 98d55e6..2a0bcbe 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
 #include "states.h"
index 4f35750..a72652f 100644 (file)
@@ -1,3 +1,6 @@
+#include <stdlib.h>
+#include <string.h>
+
 #if __STDC__
 #include <stdarg.h>
 extern out(char *, ...);
index 4b8fccd..ee0b494 100644 (file)
@@ -38,6 +38,8 @@
  */
 
 {
+#include <stdlib.h>
+#include <string.h>
 
 #include "decl.h"
 extern int lineno, yyleng;
index a3ed36a..02d9a3d 100644 (file)
@@ -11,7 +11,9 @@ static char rcsid[]="$Id$";
  * Author: Hans van Staveren
  */
 
+#include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <assert.h>
 #include <em_spec.h>
 #include <em_flag.h>
@@ -37,8 +39,8 @@ static char rcsid[]="$Id$";
        inst_t yy_instance;
 }
 
-%type <yy_list1> list1,structlistel
-%type <yy_list2> structlist,structdecl
+%type <yy_list1> list1 structlistel
+%type <yy_list2> structlist structdecl
 %type <yy_expr> expr optexpr
 %type <yy_cost> optcost cost optcommacost
 %type <yy_int> optboolexpr optnocoerc mnem emargno tokargno optprop
@@ -48,8 +50,8 @@ static char rcsid[]="$Id$";
 %type <yy_instance> tokeninstance
 %type <yy_string> optformat
 %token <yy_string> IDENT TYPENAME
-%token <yy_ident> RIDENT,PIDENT,TIDENT,EIDENT
-%token <yy_string> LSTRING,STRING
+%token <yy_ident> RIDENT PIDENT TIDENT EIDENT
+%token <yy_string> LSTRING STRING
 %token <yy_int> NUMBER
 %token <yy_intp> CIDENT
 %token REGISTERHEAD TOKENHEAD EXPRESSIONHEAD CODEHEAD MOVEHEAD TESTHEAD STACKHEAD
@@ -63,12 +65,12 @@ static char rcsid[]="$Id$";
 
 %left OR2
 %left AND2
-%left CMPEQ,CMPNE
-%left CMPLT,CMPLE,CMPGT,CMPGE
-%left RSHIFT,LSHIFT
-%left '+','-'
-%left '*','/','%'
-%nonassoc NOT,COMP,UMINUS
+%left CMPEQ CMPNE
+%left CMPLT CMPLE CMPGT CMPGE
+%left RSHIFT LSHIFT
+%left '+' '-'
+%left '*' '/' '%'
+%nonassoc NOT COMP UMINUS
 %nonassoc '$'
 %%
 machinespec
index 449e79a..fba8e31 100644 (file)
@@ -1,20 +1,14 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
 #include <ctype.h>
+#include <string.h>
 #include <em_spec.h>
 #include <em_flag.h>
 #include <em_reg.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) {
        register char *p;
 
index 4e8cf51..777bda8 100644 (file)
@@ -9,7 +9,9 @@
        Many mods by Ceriel Jacobs
 */
 
+#include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 
 #ifndef NORCSID
 static char *RcsId = "$Id$";
@@ -28,8 +30,6 @@ char *ProgCall;               /* callname of this program */
 int TabSize = 128;     /* default size of generated table */
 char *InitialValue;    /* initial value of all table entries */
 
-extern char *malloc(), *strcpy();
-
 main(argc, argv)
        char *argv[];
 {
index 9143fe3..923b2c9 100644 (file)
@@ -5,6 +5,8 @@
  */
 /* PREPROCESSOR: MACRO-TEXT REPLACEMENT ROUTINES */
 
+#include <stdlib.h>
+#include <string.h>
 #include       "debug.h"       /* UF */
 #include       "pathlength.h"  /* UF */
 #include       "textsize.h"    /* UF */