Browse Source

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

dtrg 18 years ago
parent
commit
84f3a18362
48 changed files with 80 additions and 66 deletions
  1. 1 0
      mach/arm/cv/cv.c
  2. 1 1
      mach/i386/cv/cv.c
  3. 1 1
      mach/minixST/cv/cv.c
  4. 4 0
      mach/proto/as/comm0.h
  5. 0 8
      mach/proto/as/comm1.h
  6. 1 1
      mach/proto/as/comm4.c
  7. 3 0
      mach/proto/cg/compute.c
  8. 2 0
      mach/proto/cg/glosym.c
  9. 1 1
      mach/proto/cg/salloc.c
  10. 1 0
      mach/proto/cg/subr.c
  11. 3 0
      mach/proto/ncg/compute.c
  12. 2 1
      mach/proto/ncg/glosym.c
  13. 1 1
      mach/proto/ncg/salloc.c
  14. 2 1
      mach/proto/ncg/subr.c
  15. 1 2
      mach/vax4/cv/cv.c
  16. 1 0
      modules/src/assert/BadAssert.c
  17. 3 0
      modules/src/em_code/em.c
  18. 1 0
      modules/src/print/format.c
  19. 2 2
      modules/src/read_em/mkcalls.c
  20. 2 2
      modules/src/read_em/read_em.c
  21. 1 0
      modules/src/read_em/reade.c
  22. 1 1
      modules/src/system/access.c
  23. 2 4
      modules/src/system/break.c
  24. 1 1
      modules/src/system/chmode.c
  25. 1 1
      modules/src/system/close.c
  26. 1 1
      modules/src/system/create.c
  27. 1 1
      modules/src/system/filesize.c
  28. 1 1
      modules/src/system/lock.c
  29. 1 2
      modules/src/system/modtime.c
  30. 1 1
      modules/src/system/open.c
  31. 1 1
      modules/src/system/read.c
  32. 1 1
      modules/src/system/remove.c
  33. 1 1
      modules/src/system/rename.c
  34. 1 1
      modules/src/system/seek.c
  35. 1 1
      modules/src/system/stop.c
  36. 1 1
      modules/src/system/system.c
  37. 0 2
      modules/src/system/system.h
  38. 1 1
      modules/src/system/time.c
  39. 1 1
      modules/src/system/unlock.c
  40. 1 1
      modules/src/system/write.c
  41. 3 1
      util/arch/archiver.c
  42. 1 0
      util/ceg/as_parser/eval/eval.c
  43. 3 0
      util/ceg/as_parser/help.c
  44. 2 0
      util/ceg/as_parser/pars.g
  45. 12 10
      util/cgg/bootgram.y
  46. 2 8
      util/cgg/main.c
  47. 2 2
      util/cmisc/tabgen.c
  48. 2 0
      util/cpp/replace.c

+ 1 - 0
mach/arm/cv/cv.c

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

+ 1 - 1
mach/i386/cv/cv.c

@@ -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;

+ 1 - 1
mach/minixST/cv/cv.c

@@ -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);

+ 4 - 0
mach/proto/as/comm0.h

@@ -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

+ 0 - 8
mach/proto/as/comm1.h

@@ -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"

+ 1 - 1
mach/proto/as/comm4.c

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

+ 3 - 0
mach/proto/cg/compute.c

@@ -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"

+ 2 - 0
mach/proto/cg/glosym.c

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

+ 1 - 1
mach/proto/cg/salloc.c

@@ -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;

+ 1 - 0
mach/proto/cg/subr.c

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

+ 3 - 0
mach/proto/ncg/compute.c

@@ -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"

+ 2 - 1
mach/proto/ncg/glosym.c

@@ -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;
 

+ 1 - 1
mach/proto/ncg/salloc.c

@@ -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;

+ 2 - 1
mach/proto/ncg/subr.c

@@ -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"

+ 1 - 2
mach/vax4/cv/cv.c

@@ -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;
 

+ 1 - 0
modules/src/assert/BadAssert.c

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

+ 3 - 0
modules/src/em_code/em.c

@@ -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"

+ 1 - 0
modules/src/print/format.c

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

+ 2 - 2
modules/src/read_em/mkcalls.c

@@ -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

+ 2 - 2
modules/src/read_em/read_em.c

@@ -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;
 

+ 1 - 0
modules/src/read_em/reade.c

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

+ 1 - 1
modules/src/system/access.c

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

+ 2 - 4
modules/src/system/break.c

@@ -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)

+ 1 - 1
modules/src/system/chmode.c

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

+ 1 - 1
modules/src/system/close.c

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

+ 1 - 1
modules/src/system/create.c

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

+ 1 - 1
modules/src/system/filesize.c

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

+ 1 - 1
modules/src/system/lock.c

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

+ 1 - 2
modules/src/system/modtime.c

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

+ 1 - 1
modules/src/system/open.c

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

+ 1 - 1
modules/src/system/read.c

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

+ 1 - 1
modules/src/system/remove.c

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

+ 1 - 1
modules/src/system/rename.c

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

+ 1 - 1
modules/src/system/seek.c

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

+ 1 - 1
modules/src/system/stop.c

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

+ 1 - 1
modules/src/system/system.c

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

+ 0 - 2
modules/src/system/system.h

@@ -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__ */

+ 1 - 1
modules/src/system/time.c

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

+ 1 - 1
modules/src/system/unlock.c

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

+ 1 - 1
modules/src/system/write.c

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

+ 3 - 1
util/arch/archiver.c

@@ -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

+ 1 - 0
util/ceg/as_parser/eval/eval.c

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

+ 3 - 0
util/ceg/as_parser/help.c

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

+ 2 - 0
util/ceg/as_parser/pars.g

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

+ 12 - 10
util/cgg/bootgram.y

@@ -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

+ 2 - 8
util/cgg/main.c

@@ -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;
 

+ 2 - 2
util/cmisc/tabgen.c

@@ -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[];
 {

+ 2 - 0
util/cpp/replace.c

@@ -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 */