Browse Source

Being a bit more strict on warnings (-Wall).

Manoel Trapier 11 years ago
parent
commit
a262a916dc

+ 12 - 0
h/missing_proto.h

@@ -0,0 +1,12 @@
+#ifndef H_MISSING_PROTO_H
+#define H_MISSING_PROTO_H
+
+#ifdef NOSBRK
+void *sbrk(__intptr_t increment);
+#endif
+
+#ifdef NOMKTEMP
+char *mktemp(char *template);
+#endif
+
+#endif /* H_MISSING_H */

+ 7 - 0
modules/h/em_code.h

@@ -3,10 +3,15 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
+#ifndef H_EM_CODE_H
+#define H_EM_CODE_H
 
 #include "em_mesX.h"
 #include "ansi.h"
 
+void C_flush();
+void C_internal_error();
+
 _PROTOTYPE(void C_ms_com, (char *));
 _PROTOTYPE(void C_ms_ego, (int, arith, arith, int));
 _PROTOTYPE(void C_ms_emx, ( arith, arith));
@@ -34,3 +39,5 @@ _PROTOTYPE(void C_ms_std, (char *, int, int));
 #include "em_codeEK.h"
 #endif
 #endif
+
+#endif /* H_EM_CODE_H */

+ 1 - 1
modules/src/em_code/em.c

@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "alloc.h"
+#include "print.h"
 #include "em_arith.h"
 #include "insert.h"
 #include "em_private.h"
@@ -31,7 +32,6 @@ File		*C_ofp;
 #ifndef INCORE
 File		*C_tfr;
 char		*C_tmpfile;
-char		*strcpy(), *strcat();
 char		*C_ibuf = 0;
 long		C_current_out;
 #endif

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

@@ -13,6 +13,9 @@
 
 #include <em_path.h>
 #include <alloc.h>
+
+#include <em_code.h>
+
 #include "insert.h"
 
 char		*C_tmpdir = TMP_DIR;

+ 27 - 56
modules/src/object/rd.c

@@ -5,6 +5,11 @@
  */
 #include "obj.h"
 
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
 /*
  * Parts of the output file.
  */
@@ -39,12 +44,9 @@ static long		rd_base;
 
 static int sectionnr;
 
-static void
-OUTREAD(p, b, n)
-	char *b;
-	long n;
+static void OUTREAD(int p, char *b, long n)
 {
-	register long l = outseek[p];
+	long l = outseek[p];
 
 	if (currpos != l) {
 		lseek(outfile, l, 0);
@@ -58,9 +60,7 @@ OUTREAD(p, b, n)
 /*
  * Open the output file according to the chosen strategy.
  */
-int
-rd_open(f)
-	char *f;
+int rd_open(char *f)
 {
 
 	if ((outfile = open(f, 0)) < 0)
@@ -70,10 +70,9 @@ rd_open(f)
 
 static int offcnt;
 
-int
-rd_fdopen(fd)
+int rd_fdopen(int fd)
 {
-	register int i;
+	int i;
 
 	for (i = 0; i < NPARTS; i++) outseek[i] = 0;
 	offcnt = 0;
@@ -88,32 +87,28 @@ rd_fdopen(fd)
 	return 1;
 }
 
-void
-rd_close()
+void rd_close()
 {
 
 	close(outfile);
 	outfile = -1;
 }
 
-int
-rd_fd()
+int rd_fd()
 {
 	return outfile;
 }
 
-void
-rd_ohead(head)
-	register struct outhead	*head;
+void rd_ohead(struct outhead *head)
 {
-	register long off;
+	long off;
 
 	OUTREAD(PARTEMIT, (char *) head, (long) SZ_HEAD);
 #if BYTE_ORDER == 0x0123
 	if (sizeof(struct outhead) != SZ_HEAD)
 #endif
 	{
-		register char *c = (char *) head + (SZ_HEAD-4);
+		char *c = (char *) head + (SZ_HEAD-4);
 		
 		head->oh_nchar = get4(c);
 		c -= 4; head->oh_nemit = get4(c);
@@ -136,21 +131,16 @@ rd_ohead(head)
 #endif
 }
 
-void
-rd_rew_relos(head)
-	register struct outhead *head;
+void rd_rew_relos(struct outhead *head)
 {
-	register long off = OFF_RELO(*head) + rd_base;
+	long off = OFF_RELO(*head) + rd_base;
 
 	BEGINSEEK(PARTRELO, off);
 }
 
-void
-rd_sect(sect, cnt)
-	register struct outsect	*sect;
-	register unsigned int	cnt;
+void rd_sect(struct outsect *sect, unsigned int cnt)
 {
-	register char *c = (char *) sect + cnt * SZ_SECT;
+	char *c = (char *) sect + cnt * SZ_SECT;
 
 	OUTREAD(PARTEMIT, (char *) sect, (long)cnt * SZ_SECT);
 	sect += cnt;
@@ -171,8 +161,7 @@ rd_sect(sect, cnt)
 	}
 }
 
-void
-rd_outsect(s)
+void rd_outsect(int s)
 {
 	OUTSECT(s);
 	sectionnr = s;
@@ -181,27 +170,20 @@ rd_outsect(s)
 /*
  * We don't have to worry about byte order here.
  */
-void
-rd_emit(emit, cnt)
-	char		*emit;
-	long		cnt;
+void rd_emit(char *emit, long cnt)
 {
 	OUTREAD(PARTEMIT, emit, cnt);
 	offset[sectionnr] += cnt;
 }
 
-void
-rd_relo(relo, cnt)
-	register struct outrelo	*relo;
-	register unsigned int cnt;
+void rd_relo(struct outrelo *relo, unsigned int cnt)
 {
-
 	OUTREAD(PARTRELO, (char *) relo, (long) cnt * SZ_RELO);
 #if BYTE_ORDER == 0x0123
 	if (sizeof(struct outrelo) != SZ_RELO)
 #endif
 	{
-		register char *c = (char *) relo + (long) cnt * SZ_RELO;
+		char *c = (char *) relo + (long) cnt * SZ_RELO;
 
 		relo += cnt;
 		while (cnt--) {
@@ -214,18 +196,14 @@ rd_relo(relo, cnt)
 	}
 }
 
-void
-rd_name(name, cnt)
-	register struct outname	*name;
-	register unsigned int cnt;
+void rd_name(struct outname *name, unsigned int cnt)
 {
-
 	OUTREAD(PARTNAME, (char *) name, (long) cnt * SZ_NAME);
 #if BYTE_ORDER == 0x0123
 	if (sizeof(struct outname) != SZ_NAME)
 #endif
 	{
-		register char *c = (char *) name + (long) cnt * SZ_NAME;
+		char *c = (char *) name + (long) cnt * SZ_NAME;
 
 		name += cnt;
 		while (cnt--) {
@@ -238,20 +216,13 @@ rd_name(name, cnt)
 	}
 }
 
-void
-rd_string(addr, len)
-	char *addr;
-	long len;
+void rd_string(char *addr, long len)
 {
-	
 	OUTREAD(PARTCHAR, addr, len);
 }
 
 #ifdef SYMDBUG
-void
-rd_dbug(buf, size)
-	char		*buf;
-	long		size;
+void rd_dbug(char *buf, long size)
 {
 	OUTREAD(PARTDBUG, buf, size);
 }

+ 8 - 6
modules/src/object/rd_arhdr.c

@@ -5,14 +5,16 @@
  */
 #include "obj.h"
 
-int
-rd_arhdr(fd, arhdr)
-	register struct ar_hdr	*arhdr;
+void rd_fatal();
+
+#include <unistd.h>
+
+int rd_arhdr(int fd, struct ar_hdr	*arhdr)
 {
 	char buf[AR_TOTAL];
-	register char *c = buf;
-	register char *p = arhdr->ar_name;
-	register int i;
+	char *c = buf;
+	char *p = arhdr->ar_name;
+	int i;
 
 	i = read(fd, c, AR_TOTAL);
 	if (i == 0) return 0;

+ 5 - 5
modules/src/object/rd_bytes.c

@@ -6,24 +6,24 @@
 
 #include "obj.h"
 
+#include <unistd.h>
+
 #define MININT		(1 << (sizeof(int) * 8 - 1))
 #define MAXCHUNK	(~MININT)	/* Highest count we read(2).	*/
 /* Unfortunately, MAXCHUNK is too large with some  compilers. Put it in
    an int!
 */
 
+void rd_fatal();
+
 static int maxchunk = MAXCHUNK;
 
 /*
  * We don't have to worry about byte order here.
  * Just read "cnt" bytes from file-descriptor "fd".
  */
-void 
-rd_bytes(fd, string, cnt)
-	register char	*string;
-	register long	cnt;
+void rd_bytes(int fd, char *string, long cnt)
 {
-
 	while (cnt) {
 		register int n = cnt >= maxchunk ? maxchunk : cnt;
 

+ 1 - 3
modules/src/object/wr.c

@@ -27,9 +27,7 @@ int			__sectionnr;
 #define sectionnr	__sectionnr
 static int		offcnt;
 
-void
-__wr_flush(ptr)
-	register struct fil *ptr;
+void __wr_flush(struct fil *ptr)
 {
 #ifdef OUTSEEK
 	/* seek to correct position even if we aren't going to write now */

+ 4 - 6
modules/src/object/wr_arhdr.c

@@ -5,14 +5,12 @@
  */
 #include "obj.h"
 
-void
-wr_arhdr(fd, arhdr)
-	register struct ar_hdr	*arhdr;
+void wr_arhdr(int fd, struct ar_hdr *arhdr)
 {
 	char buf[AR_TOTAL];
-	register char *c = buf;
-	register char *p = arhdr->ar_name;
-	register int i = 14;
+	char *c = buf;
+	char *p = arhdr->ar_name;
+	int i = 14;
 
 	while (i--) {
 		*c++ = *p++;

+ 6 - 6
modules/src/object/wr_bytes.c

@@ -6,6 +6,10 @@
 
 #include "obj.h"
 
+#include <unistd.h>
+
+void wr_fatal();
+
 #define MININT		(1 << (sizeof(int) * 8 - 1))
 #define MAXCHUNK	(~MININT)	/* Highest count we write(2).	*/
 /* Notice that MAXCHUNK itself might be too large with some compilers.
@@ -17,14 +21,10 @@ static int maxchunk = MAXCHUNK;
 /*
  * Just write "cnt" bytes to file-descriptor "fd".
  */
-void
-wr_bytes(fd, string, cnt)
-	register char	*string;
-	register long	cnt;
+void wr_bytes(int fd, char *string, long cnt)
 {
-
 	while (cnt) {
-		register int n = cnt >= maxchunk ? maxchunk : cnt;
+		int n = cnt >= maxchunk ? maxchunk : cnt;
 
 		if (write(fd, string, n) != n)
 			wr_fatal();

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

@@ -6,10 +6,7 @@
 
 #include "system.h"
 
-int
-sys_access(path, mode)
-	char *path;
-	int mode;
+int sys_access(char *path, int mode)
 {
 	return access(path, mode) == 0;
 }

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

@@ -6,10 +6,7 @@
 
 #include "system.h"
 
-int
-sys_chmode(path, mode)
-	char *path;
-	int mode;
+int sys_chmode(char *path, int mode)
 {
 	return chmod(path, mode) == 0;
 }

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

@@ -6,9 +6,7 @@
 
 #include "system.h"
 
-void
-sys_close(fp)
-	register File *fp;
+void sys_close(File *fp)
 {
 	if (fp) {
 		fp->o_flags = 0;

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

@@ -8,11 +8,7 @@
 
 extern File *_get_entry();
 
-int
-sys_create(filep, path, mode)
-	File **filep;
-	char *path;
-	int mode;
+int sys_create(File **filep, char *path, int mode)
 {
 	register fd;
 	register File *fp;

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

@@ -8,6 +8,13 @@
 
 #include <ansi.h>
 
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <missing_proto.h>
+
 struct _sys_fildes {
 	int o_fd;	/* UNIX filedescriptor */
 	int o_flags;	/* flags for open; 0 if not used */

+ 0 - 4
util/LLgen/src/Lpars.c

@@ -387,10 +387,6 @@ static short LL_index[] = {0,0,
  * This file is copied into Lpars.c.
  */
 
-#ifndef lint
-static char *rcsid = "$Id$";
-#endif
-
 unsigned int	LLtcnt[LL_NTERMINALS];
 unsigned int	LLscnt[LL_NSETS];
 int		LLcsymb, LLsymb;

+ 11 - 14
util/LLgen/src/alloc.c

@@ -15,40 +15,37 @@
  * alloc.c
  * Interface to malloc() and realloc()
  */
-
+#include <stdio.h>
 #include <stdlib.h>
 # include "types.h"
 # include "extern.h"
-
-# ifndef NORCSID
-static string rcsid = "$Id$";
-# endif
+# include "LLgen.h"
 
 static string e_nomem = "Out of memory";
 
-p_mem
-alloc(size) unsigned size; {
+p_mem alloc(unsigned int size)
+{
 	/*
 	   Allocate "size" bytes. Panic if it fails
 	 */
 	p_mem	p;
 
-	if ((p = malloc(size)) == 0) fatal(linecount,e_nomem);
+	if ((p = malloc(size)) == 0) fatal(linecount,e_nomem, NULL, NULL);
 	return p;
 }
 
-p_mem
-ralloc(p,size) p_mem p; unsigned size; {
+p_mem ralloc(p_mem p, unsigned int size)
+{
 	/*
 	   Re-allocate the chunk of memory indicated by "p", to
 	   occupy "size" bytes
 	 */
-	if ((p = realloc(p,size)) == 0) fatal(linecount,e_nomem);
+	if ((p = realloc(p,size)) == 0) fatal(linecount,e_nomem, NULL, NULL);
 	return p;
 }
 
-p_mem
-new_mem(p) register p_info p; {
+p_mem new_mem(p_info p)
+{
 	/*
 	   This routine implements arrays that can grow.
 	   It must be called every time a new element is added to it.
@@ -60,7 +57,7 @@ new_mem(p) register p_info p; {
 	   be updated each time this routine is called
 	 */
 	p_mem	rp;
-	unsigned sz;
+	unsigned int sz;
 
 	if (p->i_max >= p->i_top) {	/* No more free elements */
 		sz = p->i_size;

+ 2 - 0
util/LLgen/src/compute.c

@@ -579,6 +579,7 @@ static int nc_nfollow(p_nont p)
 	return follow(p->n_nc_follow, p->n_rule);
 }
 
+#if 0
 static int nc_follow(p_set setp, p_gram p)
 {
 	/*
@@ -650,6 +651,7 @@ static int nc_follow(p_set setp, p_gram p)
 		p++;
 	}
 }
+#endif
 
 #endif
 

+ 0 - 4
util/LLgen/src/global.c

@@ -20,10 +20,6 @@
 # include "extern.h"
 # include "io.h"
 
-# ifndef NORCSID
-static string rcsid4 = "$Id$";
-# endif
-
 char	ltext[LTEXTSZ];
 p_nont	nonterms;
 p_nont	maxnt;

+ 2 - 9
util/LLgen/src/machdep.c

@@ -24,16 +24,9 @@
 
 #include "LLgen.h"
 
-# ifndef NORCSID
-static string rcsid5 = "$Id$";
-# endif
-
 /* In this file the following routines are defined: */
-/* extern	UNLINK(); */
-/* extern	RENAME(); */
-/* extern string	libpath(); */
-
-void UNLINK(string x) {
+void UNLINK(string x)
+{
 	/* Must remove the file "x" */
 
 #ifdef USE_SYS

+ 5 - 2
util/LLgen/src/main.c

@@ -23,12 +23,15 @@
 #include "assert.h"
 #include "LLgen.h"
 
+#include <missing_proto.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-int main(int argc, char *argv[]) {
-	register string arg;
+int main(int argc, char *argv[])
+{
+	string arg;
 	string libpath();
 	char	*beg_sbrk = 0;
 

+ 0 - 2
util/ego/cs/cs_alloc.c

@@ -4,8 +4,6 @@
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
 
-#include <stdlib.h>
-
 #include "../share/types.h"
 #include "../share/alloc.h"
 #include "cs.h"