Being a bit more strict on warnings (-Wall).
authorManoel Trapier <godzil@godzil.net>
Mon, 18 Mar 2013 13:16:36 +0000 (14:16 +0100)
committerManoël Trapier <godzil@MacBook-Pro.home>
Wed, 24 Jun 2015 22:41:46 +0000 (23:41 +0100)
22 files changed:
h/missing_proto.h [new file with mode: 0644]
modules/h/em_code.h
modules/src/em_code/em.c
modules/src/em_code/insert.c
modules/src/object/rd.c
modules/src/object/rd_arhdr.c
modules/src/object/rd_bytes.c
modules/src/object/wr.c
modules/src/object/wr_arhdr.c
modules/src/object/wr_bytes.c
modules/src/system/access.c
modules/src/system/chmode.c
modules/src/system/close.c
modules/src/system/create.c
modules/src/system/system.h
util/LLgen/src/Lpars.c
util/LLgen/src/alloc.c
util/LLgen/src/compute.c
util/LLgen/src/global.c
util/LLgen/src/machdep.c
util/LLgen/src/main.c
util/ego/cs/cs_alloc.c

diff --git a/h/missing_proto.h b/h/missing_proto.h
new file mode 100644 (file)
index 0000000..c6fc67d
--- /dev/null
@@ -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 */
\ No newline at end of file
index 26a3251..5cd97f4 100644 (file)
@@ -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 */
\ No newline at end of file
index e1f0b0d..d011763 100644 (file)
@@ -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
index 0627f8b..f8a22b8 100644 (file)
@@ -13,6 +13,9 @@
 
 #include <em_path.h>
 #include <alloc.h>
+
+#include <em_code.h>
+
 #include "insert.h"
 
 char           *C_tmpdir = TMP_DIR;
index 55f67bb..19ae8e6 100644 (file)
@@ -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);
 }
index a2807db..b519c6b 100644 (file)
@@ -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;
index d3554a3..61b2eeb 100644 (file)
@@ -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;
 
index 53267d0..31ce5e3 100644 (file)
@@ -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 */
index ac5f281..9801fe7 100644 (file)
@@ -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++;
index 768a5d6..9d2d088 100644 (file)
@@ -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();
index 20773c7..9d4c93c 100644 (file)
@@ -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;
 }
index 0c0c1f5..86464a5 100644 (file)
@@ -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;
 }
index 03aa767..140e1e8 100644 (file)
@@ -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;
index 21203c4..c027412 100644 (file)
@@ -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;
index 8f8bce4..cee5177 100644 (file)
@@ -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 */
index e241c0e..9c304d5 100644 (file)
@@ -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;
index 25ca26d..f55660d 100644 (file)
  * 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;
index b93bf1f..e018a86 100644 (file)
@@ -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
 
index 8c54e7b..713aa1f 100644 (file)
 # include "extern.h"
 # include "io.h"
 
-# ifndef NORCSID
-static string rcsid4 = "$Id$";
-# endif
-
 char   ltext[LTEXTSZ];
 p_nont nonterms;
 p_nont maxnt;
index 5cf3718..d6fa7b8 100644 (file)
 
 #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
index 9741eab..e023434 100644 (file)
 #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;
 
index b94b3c0..75d21e8 100644 (file)
@@ -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"