diff --git a/lang/cem/libcc.ansi/headers/time.h b/lang/cem/libcc.ansi/headers/time.h index 088a0b0d1..582151fd1 100644 --- a/lang/cem/libcc.ansi/headers/time.h +++ b/lang/cem/libcc.ansi/headers/time.h @@ -37,6 +37,7 @@ extern struct tm* localtime(const time_t *_timer); extern size_t strftime(char *_s, size_t _maxsize, const char *_format, const struct tm *_timeptr); +extern void tzset(void); /* Extensions not in the standard */ diff --git a/lang/cem/libcc/headers/time.h b/lang/cem/libcc/headers/time.h index 89a94e055..0423f48dd 100644 --- a/lang/cem/libcc/headers/time.h +++ b/lang/cem/libcc/headers/time.h @@ -23,5 +23,6 @@ extern struct tm *gmtime(); extern struct tm *localtime(); extern char *asctime(); extern char *ctime(); +extern void tzset(void); #endif /* _TIME_H */ diff --git a/mach/i386/ncg/mach.c b/mach/i386/ncg/mach.c index 008d683cf..4e3dfabe6 100644 --- a/mach/i386/ncg/mach.c +++ b/mach/i386/ncg/mach.c @@ -93,8 +93,7 @@ long di_off; int firstreg; int -regscore(off, size, typ, score, totyp) - long off; +regscore(long off, int size, int typ, int score, int totyp) { if (size != 4) return -1; score -= 1; @@ -137,9 +136,7 @@ f_regsave() } void -regsave(regstr, off, size) - const char *regstr; - long off; +regsave(const char* regstr, long off, int size) { if (strcmp(regstr, "esi") == 0) { if (! firstreg) firstreg = -1; diff --git a/mach/i86/ncg/mach.c b/mach/i86/ncg/mach.c index 31d1926ea..14e10be12 100644 --- a/mach/i86/ncg/mach.c +++ b/mach/i86/ncg/mach.c @@ -83,8 +83,7 @@ long di_off; int firstreg; int -regscore(off, size, typ, score, totyp) - long off; +regscore(long off, int size, int typ, int score, int totyp) { if (size != 2) return -1; score -= 1; @@ -133,9 +132,7 @@ f_regsave() } void -regsave(regstr, off, size) - const char *regstr; - long off; +regsave(const char* regstr, long off, int size) { if (strcmp(regstr, "si") == 0) { if (! firstreg) firstreg = -1; diff --git a/mach/m68020/libem/trpstr.c b/mach/m68020/libem/trpstr.c index 58fc397b0..8c1c962b6 100644 --- a/mach/m68020/libem/trpstr.c +++ b/mach/m68020/libem/trpstr.c @@ -1,7 +1,6 @@ #include -char * -_trpstr(d) +char* _trpstr(int d) { switch(d) { diff --git a/mach/m68020/ncg/mach.c b/mach/m68020/ncg/mach.c index b86a06bbd..480adf8e1 100644 --- a/mach/m68020/ncg/mach.c +++ b/mach/m68020/ncg/mach.c @@ -60,8 +60,7 @@ con_mult(word sz) { #include int -regscore(off,size,typ,score,totyp) - long off; +regscore(long off, int size, int typ, int score, int totyp) { if (score == 0) return -1; switch(typ) { @@ -183,9 +182,7 @@ f_regsave() } void -regsave(s,off,size) - const char *s; - long off; +regsave(const char* s, long off, int size) { assert (regnr < 9); regsav[regnr].rs_reg = s; diff --git a/mach/pdp/cv/cv.c b/mach/pdp/cv/cv.c index 455469a6b..429abb77e 100644 --- a/mach/pdp/cv/cv.c +++ b/mach/pdp/cv/cv.c @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -53,10 +54,10 @@ int outputfile_created; FILE *output; int rom_in_text; -static cv_int2(); -static fatal(); -static emits(); -static emit_symtab(); +static void cv_int2(int n); +static void fatal(const char* s, ...); +static void emits(struct outsect*); +static void emit_symtab(void); char *program ; @@ -71,9 +72,7 @@ char flag ; #define LSECT BSSSG+1 #define NSECT LSECT+1 -main(argc, argv) - int argc; - char *argv[]; +int main(int argc, char* argv[]) { register struct exec *e = &exec; @@ -189,7 +188,7 @@ main(argc, argv) return 0; } -cv_int2(n) +void cv_int2(int n) { putc(n, output); putc((n>>8), output); @@ -209,7 +208,7 @@ cv_long(l) /* * Transfer the emitted byted from one file to another. */ -emits(section) struct outsect *section ; { +void emits(struct outsect* section) { register long n ; register int blk; char buffer[BUFSIZ]; @@ -234,7 +233,7 @@ emits(section) struct outsect *section ; { } } -emit_symtab() +void emit_symtab(void) { struct outname ACK_name; /* symbol table entry in ACK format */ struct nlist PDP_name; /* symbol table entry in PDP V7 format */ @@ -303,17 +302,21 @@ emit_symtab() } /* VARARGS1 */ -fatal(s, a1, a2) - char *s; +void fatal(const char* s, ...) { + va_list ap; + fprintf(stderr,"%s: ",program) ; - fprintf(stderr, s, a1, a2); + va_start(ap, s); + vfprintf(stderr, s, ap); + va_end(ap); + if (outputfile_created) unlink(output_file); exit(1); } -rd_fatal() +void rd_fatal(void) { fatal("read error\n"); } diff --git a/mach/proto/cg/salloc.c b/mach/proto/cg/salloc.c index 73d081650..935594872 100644 --- a/mach/proto/cg/salloc.c +++ b/mach/proto/cg/salloc.c @@ -88,8 +88,11 @@ char *salloc(int size) return(p); } -int compar(char **p1, char **p2) +int compar(const void* pp1, const void* pp2) { + const char **p1 = (const char**) pp1; + const char **p2 = (const char**) pp2; + assert(*p1 != *p2); if (*p1 < *p2) return(-1); diff --git a/mach/proto/cg/salloc.h b/mach/proto/cg/salloc.h index 85d0cca60..7fd7f5969 100644 --- a/mach/proto/cg/salloc.h +++ b/mach/proto/cg/salloc.h @@ -10,11 +10,11 @@ #include "types.h" -string myalloc(int size); -void myfree(void* p); -void popstr(int nnstab); -char *salloc(int size); -int compar(char **p1, char **p2); -void garbage_collect(void); +extern string myalloc(int size); +extern void myfree(void* p); +extern void popstr(int nnstab); +extern char *salloc(int size); +extern int compar(const void* pp1, const void* pp2); +extern void garbage_collect(void); #endif /* SALLOC_H_ */ diff --git a/mach/proto/ncg/label.c b/mach/proto/ncg/label.c index bb7fdad20..21eb6b6e2 100644 --- a/mach/proto/ncg/label.c +++ b/mach/proto/ncg/label.c @@ -6,7 +6,7 @@ static label_p label_list = (label_p)0; -void add_label(num, height, flth) +void add_label(int num, int height, int flth) { label_p lbl = (label_p)0; diff --git a/modules/src/data/array.c b/modules/src/data/array.c index 2847bbdd4..40402ff20 100644 --- a/modules/src/data/array.c +++ b/modules/src/data/array.c @@ -12,7 +12,7 @@ static void extend(struct array* array) struct array* newarray = realloc(array->item, newmax * sizeof(*newarray)); array->max = newmax; - array->item = newarray; + array->item = (void**) newarray; } } diff --git a/modules/src/data/smap.c b/modules/src/data/smap.c index 45e25ebbf..35e594997 100644 --- a/modules/src/data/smap.c +++ b/modules/src/data/smap.c @@ -5,7 +5,7 @@ #define INCR_SIZE 8 -static void append(void* mapp, char* key, void* value) +static void append(void* mapp, const char* key, void* value) { struct smap* map = mapp; struct smap_node* node; @@ -26,7 +26,7 @@ static void append(void* mapp, char* key, void* value) } -void smap_put(struct smap *mapp, char* key, void* value) +void smap_put(struct smap *mapp, const char* key, void* value) { struct smap* map = mapp; int i; @@ -71,7 +71,7 @@ void smap_free(struct smap *mapp, int free_key, int free_value) free(mapp->item); } -void smap_add(struct smap *mapp, char* key, void* value) +void smap_add(struct smap *mapp, const char* key, void* value) { struct smap* map = mapp; int i; diff --git a/modules/src/data/smap.h b/modules/src/data/smap.h index f01b38010..184c2b176 100644 --- a/modules/src/data/smap.h +++ b/modules/src/data/smap.h @@ -36,11 +36,11 @@ extern void smap_init(struct smap *mapp); * it does not already exist, otherwise replaces the * value `value` associated with the existing `key`. */ -extern void smap_put(struct smap *mapp, char* key, void* value); +extern void smap_put(struct smap *mapp, const char* key, void* value); /** Adds a new item in a string map only if `key` does * not already exist in the string map. */ -extern void smap_add(struct smap *mapp, char* key, void* value); +extern void smap_add(struct smap *mapp, const char* key, void* value); /** Returns the value associated with the specified `key`, returns * NULL if `key` is not present in the string map. * diff --git a/modules/src/data/stringlist.c b/modules/src/data/stringlist.c index 74d73b331..39f125697 100644 --- a/modules/src/data/stringlist.c +++ b/modules/src/data/stringlist.c @@ -69,7 +69,7 @@ char* stringlist_get(struct stringlist *list, int index) i++; } - return i; + return NULL; } diff --git a/modules/src/data/stringlist.h b/modules/src/data/stringlist.h index 3d9b0c4c1..b3c6ae8e6 100644 --- a/modules/src/data/stringlist.h +++ b/modules/src/data/stringlist.h @@ -3,7 +3,7 @@ struct stringfragment { - const char* data; + char* data; struct stringfragment* next; }; diff --git a/plat/cpm/libsys/fcb.c b/plat/cpm/libsys/fcb.c index 96705c467..e64f92f35 100644 --- a/plat/cpm/libsys/fcb.c +++ b/plat/cpm/libsys/fcb.c @@ -37,7 +37,7 @@ uint8_t cpm_parse_filename(FCB* fcb, const char* filename) c = *filename++; if (isdigit(c)) { - user = strtol(filename-1, &filename, 10); + user = strtol(filename-1, (char**) &filename, 10); c = *filename++; } c = toupper(c); diff --git a/plat/em/include/sgtty.h b/plat/em/include/sgtty.h index 547a4ee6d..36af330a9 100644 --- a/plat/em/include/sgtty.h +++ b/plat/em/include/sgtty.h @@ -116,4 +116,8 @@ struct tchars { #define EXTA 14 #define EXTB 15 +extern int ioctl(int fd, unsigned int request, ...); +extern int gtty(int fildes, struct sgttyb* argp); +extern int stty(int fildes, struct sgttyb* argp); + #endif /* _SGTTY_H */ diff --git a/plat/em/libsys/gtty.c b/plat/em/libsys/gtty.c index 62a82b503..081fb0879 100644 --- a/plat/em/libsys/gtty.c +++ b/plat/em/libsys/gtty.c @@ -1,6 +1,6 @@ /* $Id$ */ #include -int -gtty(fildes,argp) int fildes ; struct sgttyb *argp ; { + +int gtty(int fildes, struct sgttyb* argp) { return ioctl(fildes,TIOCGETP,argp) ; } diff --git a/plat/em/libsys/isatty.c b/plat/em/libsys/isatty.c index f0ccbdcf0..fbfacc9ac 100644 --- a/plat/em/libsys/isatty.c +++ b/plat/em/libsys/isatty.c @@ -1,5 +1,6 @@ -/* $Id$ */ -isatty(f) +#include + +int isatty(int fd) { char buf[128]; /* not a sgttyb struct; it might not be large enough; @@ -7,6 +8,6 @@ isatty(f) where gtty is an ioctl(..., TCGETA, ...) */ - if (gtty(f, buf) < 0) return 0; + if (gtty(fd, (void*) buf) < 0) return 0; return 1; } diff --git a/plat/em/libsys/signal.c b/plat/em/libsys/signal.c index 50d65c7fd..20d262b3d 100644 --- a/plat/em/libsys/signal.c +++ b/plat/em/libsys/signal.c @@ -1,14 +1,14 @@ /* $Id$ */ #include -typedef void (*callvec)() ; +extern void _setsig(int (*)(int)); -static callvec vector[16] = { +static sighandler_t vector[16] = { SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL } ; -static char mapvec[] = { +static const char mapvec[] = { 0, /* EARRAY */ 0, /* ERANGE */ 0, /* ESET */ @@ -42,16 +42,17 @@ static char mapvec[] = { #define VECBASE 128 static firsttime = 1 ; -static int catchtrp() ; -static int procesig() ; +extern int sigtrp(int mapval, int sig) ; +static int catchtrp(int trapno) ; +static int procesig(int signo) ; -callvec signal(sig,func) int sig ; callvec func ; { +sighandler_t signal(int sig, sighandler_t func) { register index, i ; - callvec prev ; + sighandler_t prev ; index= sig-1 ; if ( index<0 || index>=(sizeof vector/sizeof vector[0]) ) { - return (callvec) -1 ; + return (sighandler_t) -1 ; } if ( firsttime ) { firsttime= 0 ; @@ -68,13 +69,13 @@ callvec signal(sig,func) int sig ; callvec func ; { } else { mapval=VECBASE+sig; } - if ( sigtrp(mapval,sig)== -1 ) return (callvec) -1; + if ( sigtrp(mapval,sig)== -1 ) return (sighandler_t) -1; } return prev ; } -static int catchtrp(trapno) int trapno ; { +static int catchtrp(int trapno) { if ( trapno>VECBASE && trapno<=VECBASE + (sizeof vector/sizeof vector[0]) ) { return procesig(trapno-VECBASE) ; @@ -86,9 +87,9 @@ static int catchtrp(trapno) int trapno ; { return 0 ; /* Failed to handle the trap */ } -static int procesig(sig) int sig ; { +static int procesig(int sig) { register index ; - callvec trf ; + sighandler_t trf ; index= sig-1 ; trf= vector[index] ; diff --git a/plat/em/libsys/stty.c b/plat/em/libsys/stty.c index 40a8dabaa..eadd908f7 100644 --- a/plat/em/libsys/stty.c +++ b/plat/em/libsys/stty.c @@ -1,6 +1,6 @@ /* $Id$ */ #include -int -stty(fildes,argp) int fildes ; struct sgttyb *argp ; { + +int stty(int fildes, struct sgttyb* argp) { return ioctl(fildes,TIOCSETP,argp) ; } diff --git a/plat/em/libsys/tell.c b/plat/em/libsys/tell.c index 7aafa529f..eb18bc6a0 100644 --- a/plat/em/libsys/tell.c +++ b/plat/em/libsys/tell.c @@ -3,9 +3,9 @@ * return offset in file. */ -long lseek(); +long lseek(int fd, int offset, int whence); -long tell(f) +long tell(int fd) { - return(lseek(f, 0L, 1)); + return(lseek(fd, 0L, 1)); } diff --git a/plat/em/libsys/time.c b/plat/em/libsys/time.c index 1ff8177ac..e47db6a86 100644 --- a/plat/em/libsys/time.c +++ b/plat/em/libsys/time.c @@ -1,8 +1,10 @@ /* $Id$ */ #include #include -time_t -time(timpt) time_t *timpt ; { + +extern void ftime(struct timeb* buf); + +time_t time(time_t* timpt) { struct timeb buf ; ftime(&buf) ; diff --git a/plat/pdpv7/libsys/cleanup.c b/plat/pdpv7/libsys/cleanup.c index 07d507e3f..3e16568fe 100644 --- a/plat/pdpv7/libsys/cleanup.c +++ b/plat/pdpv7/libsys/cleanup.c @@ -1,3 +1,3 @@ -_cleanup() +void _cleanup(void) { } diff --git a/plat/pdpv7/libsys/exit.c b/plat/pdpv7/libsys/exit.c index afd54b3f7..c29cdaa27 100644 --- a/plat/pdpv7/libsys/exit.c +++ b/plat/pdpv7/libsys/exit.c @@ -1,4 +1,7 @@ -exit(n) +extern void _cleanup(void); +extern void _exit(int n); + +void exit(int n) { _cleanup(); _exit(n); diff --git a/plat/pdpv7/libsys/gtty.c b/plat/pdpv7/libsys/gtty.c index 6e03bd84d..5dd37c23b 100644 --- a/plat/pdpv7/libsys/gtty.c +++ b/plat/pdpv7/libsys/gtty.c @@ -1,7 +1,7 @@ -int -gtty(fildes,argp) - int fildes ; - char *argp ; +extern int ioctl(int fd, unsigned int request, ...); +extern int _ioctl(int fd, int ioc, void* ptr); + +int gtty(int fildes, char* argp) { return ioctl(fildes,/*TIOCGETP*/(('t'<<8)|8),argp) ; } diff --git a/plat/pdpv7/libsys/isatty.c b/plat/pdpv7/libsys/isatty.c index 7bf22b914..1e4becdf3 100644 --- a/plat/pdpv7/libsys/isatty.c +++ b/plat/pdpv7/libsys/isatty.c @@ -1,3 +1,5 @@ +extern int ioctl(int fd, unsigned int request, ...); + int isatty(int fd) { unsigned u; diff --git a/plat/pdpv7/libsys/stty.c b/plat/pdpv7/libsys/stty.c index a77960853..904d2901e 100644 --- a/plat/pdpv7/libsys/stty.c +++ b/plat/pdpv7/libsys/stty.c @@ -1,7 +1,6 @@ -int -stty(fildes,argp) - int fildes ; - char *argp; +extern int _ioctl(int fd, int ioc, void* ptr); + +int stty(int fildes, char* argp) { return _ioctl(fildes,/*TIOCSETP*/(('t'<<8)|9),argp) ; } diff --git a/util/ass/ass00.h b/util/ass/ass00.h index 4e397a105..7354b2b1d 100644 --- a/util/ass/ass00.h +++ b/util/ass/ass00.h @@ -4,6 +4,7 @@ */ #include #include +#include #include #include "em_spec.h" #include "as_spec.h" diff --git a/util/ass/ass60.c b/util/ass/ass60.c index e3b814136..0a99b6d18 100644 --- a/util/ass/ass60.c +++ b/util/ass/ass60.c @@ -28,7 +28,7 @@ cons_t nicepr(int typ, addr_u *ap) case CONST: return (ap->ad_i); case LOCSYM: - return (int_cast ap->ad_lp); + return (int_cast (intptr_t)ap->ad_lp); case GLOOFF: return (ap->ad_df.df_gp - mglobs); case GLOSYM: @@ -135,7 +135,7 @@ void dump(int n) if (lbp->l_defined != EMPTY) printf(" %8d%8d%8d%8d %-s\n", lbp->l_hinum * LOCLABSIZE + i, - int_cast lbp, lbp->l_min, lbp->l_max, + int_cast (intptr_t)lbp, lbp->l_min, lbp->l_max, labstr[(unsigned char)lbp->l_defined]); } } diff --git a/util/ego/ic/ic_lookup.c b/util/ego/ic/ic_lookup.c index 5e4867d1b..97e70f2d5 100644 --- a/util/ego/ic/ic_lookup.c +++ b/util/ego/ic/ic_lookup.c @@ -83,7 +83,7 @@ lab_id instr_lab(short number) /* symlookup */ STATIC unsigned hash(const char *string) { - register char *p; + register const char *p; register unsigned i,sum; for (sum=i=0,p=string;*p;i += 3) diff --git a/util/ego/share/debug.c b/util/ego/share/debug.c index 56514d149..a77ec571d 100644 --- a/util/ego/share/debug.c +++ b/util/ego/share/debug.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "types.h" #include "def.h" @@ -69,7 +70,7 @@ void OUTVERBOSE(const char *s, int n1, int n2) void VA(short *a) { if (a == (short *) 0) error("VA: 0 argument"); - if ( ((unsigned) a & 01) == 01) { + if ( ((intptr_t) a & 01) == 01) { /* MACHINE DEPENDENT TEST */ error("VA: odd argument"); } diff --git a/util/int/m_sigtrp.c b/util/int/m_sigtrp.c index f48f9b0ab..d74e018f0 100644 --- a/util/int/m_sigtrp.c +++ b/util/int/m_sigtrp.c @@ -100,7 +100,7 @@ int do_sigtrp( } else if (tn >= 0 && tn <= 252) {/* legal tn */ - if ((int) signal(sn, HndlEmSig) == -1) + if (signal(sn, HndlEmSig) == SIG_ERR) { sig_map[sn] = old_tn; return (-1); diff --git a/util/int/moncalls.c b/util/int/moncalls.c index 78b507fe7..d2623f338 100644 --- a/util/int/moncalls.c +++ b/util/int/moncalls.c @@ -128,7 +128,7 @@ PRIVATE size buf_cnt[5]; /* Current sizes of the buffers */ PRIVATE char *buf[5]; /* Pointers to the buffers */ PRIVATE check_buf(); -PRIVATE int savestr(); +PRIVATE int savestr(int n, ptr addr); PRIVATE int vec(); void moncall(void) @@ -702,7 +702,7 @@ void moncall(void) #ifdef SYS_V /* from system.h */ utimbuf.x = actime; utimbuf.y = modtime; - if (!savestr(0, dsp1) || utime(buf[0], &utimbuf) == -1) { + if (!savestr(0, dsp1) || utime(buf[0], (struct utimbuf*) &utimbuf) == -1) { #else /* SYS_V */ utimbuf[0] = actime; utimbuf[1] = modtime; @@ -1037,9 +1037,7 @@ PRIVATE check_buf(n, sz) } } -PRIVATE int savestr(n, addr) - int n; - ptr addr; +PRIVATE int savestr(int n, ptr addr) { register size len; register char *cp, ch; diff --git a/util/topgen/pattern.c b/util/topgen/pattern.c index 9e84f5059..93ba5459f 100644 --- a/util/topgen/pattern.c +++ b/util/topgen/pattern.c @@ -123,7 +123,7 @@ void printpatterns(void) { i++; } fputs("};\n", genc); - fputs("int\ncheck_constraint(patno){\n\tint r;\n\tswitch(patno){\n",genc); + fputs("int\ncheck_constraint(int patno){\n\tint r;\n\tswitch(patno){\n",genc); p = pattable; while (p < current) { if (p->p_constraint) {