shithub: riscv

Download patch

ref: 8a234e57b92f0915aae935aa0c9fe5285113b32f
parent: 6b0574e27e6abffb2328be29e2cc9f3e67e2655b
author: Jacob Moody <moody@posixcafe.org>
date: Sat Jan 27 22:36:41 EST 2024

libc, libthread, ape: mark exit functions as _Noreturn and clean up new warnings

--- a/acme/bin/source/win/main.c
+++ b/acme/bin/source/win/main.c
@@ -98,7 +98,6 @@
 	if(strcmp(s, "Delete")==0 || strcmp(s, "Del")==0){
 		windel(w, 1);
 		threadexitsall(nil);
-		return 1;
 	}
 	if(EQUAL(s, "scroll")){
 		ctlprint(w->ctl, "scroll\nshow");
--- a/acme/bin/source/win/pipe.c
+++ b/acme/bin/source/win/pipe.c
@@ -52,7 +52,6 @@
 	if(strcmp(s, "Delete")==0){
 		windel(w, 1);
 		threadexits(nil);
-		return 1;
 	}
 	if(strcmp(s, "Del")==0){
 		if(windel(w, 0))
--- a/sys/include/ape/stdlib.h
+++ b/sys/include/ape/stdlib.h
@@ -31,9 +31,9 @@
 extern void free(void *);
 extern void *malloc(size_t);
 extern void *realloc(void *, size_t);
-extern void abort(void);
+extern _Noreturn void abort(void);
 extern int atexit(void (*func)(void));
-extern void exit(int);
+extern _Noreturn void exit(int);
 extern char *getenv(const char *);
 extern int putenv(char *);
 extern int system(const char *);
--- a/sys/include/ape/unistd.h
+++ b/sys/include/ape/unistd.h
@@ -90,7 +90,7 @@
 extern int execve(const char *, const char **, const char **);
 extern int execlp(const char *, const char *, ...);
 extern int execvp(const char *, const char **);
-extern void _exit(int);
+extern _Noreturn void _exit(int);
 extern unsigned int alarm(unsigned int);
 extern int pause(void);
 extern unsigned int sleep(unsigned int);
--- a/sys/include/libc.h
+++ b/sys/include/libc.h
@@ -416,7 +416,7 @@
 extern	int	enc16chr(int);
 
 extern	int	encodefmt(Fmt*);
-extern	void	exits(char*);
+extern	_Noreturn void	exits(char*);
 extern	double	frexp(double, int*);
 extern	uintptr	getcallerpc(void*);
 extern	char*	getenv(char*);
@@ -427,7 +427,7 @@
 extern	int	iounit(int);
 extern	long	labs(long);
 extern	double	ldexp(double, int);
-extern	void	longjmp(jmp_buf, int);
+extern	_Noreturn void	longjmp(jmp_buf, int);
 extern	char*	mktemp(char*);
 extern	double	modf(double, double*);
 extern	int	netcrypt(void*, void*);
@@ -443,7 +443,7 @@
 extern	ulong	strtoul(char*, char**, int);
 extern	vlong	strtoll(char*, char**, int);
 extern	uvlong	strtoull(char*, char**, int);
-extern	void	sysfatal(char*, ...);
+extern	_Noreturn void	sysfatal(char*, ...);
 #pragma	varargck	argpos	sysfatal	1
 extern	void	syslog(int, char*, char*, ...);
 #pragma	varargck	argpos	syslog	3
@@ -690,9 +690,9 @@
 	ulong	len;
 } IOchunk;
 
-extern	void	_exits(char*);
+extern	_Noreturn void	_exits(char*);
 
-extern	void	abort(void);
+extern	_Noreturn void	abort(void);
 extern	int	access(char*, int);
 extern	long	alarm(ulong);
 extern	int	await(char*, int);
--- a/sys/include/thread.h
+++ b/sys/include/thread.h
@@ -87,8 +87,8 @@
 int	sendul(Channel *c, ulong v);
 int	threadcreate(void (*f)(void *arg), void *arg, uint stacksize);
 void**	threaddata(void);
-void	threadexits(char *);
-void	threadexitsall(char *);
+_Noreturn void	threadexits(char *);
+_Noreturn void	threadexitsall(char *);
 int	threadgetgrp(void);	/* return thread group of current thread */
 char*	threadgetname(void);
 void	threadint(int);		/* interrupt thread */
--- a/sys/src/ape/9src/tar.c
+++ b/sys/src/ape/9src/tar.c
@@ -123,5 +123,4 @@
 		else
 			exits(w->msg);
 	}
-	assert(0);
 }
--- a/sys/src/ape/lib/9/libc.h
+++ b/sys/src/ape/lib/9/libc.h
@@ -160,7 +160,7 @@
 
 int errstr(char*, unsigned int);
 void rerrstr(char*, unsigned int);
-extern void sysfatal(char*, ...);
+extern _Noreturn void sysfatal(char*, ...);
 
 extern	void		setmalloctag(void*, uintptr_t);
 extern	void		setrealloctag(void*, uintptr_t);
--- a/sys/src/ape/lib/ap/gen/abort.c
+++ b/sys/src/ape/lib/ap/gen/abort.c
@@ -2,7 +2,7 @@
 #include <unistd.h>
 #include <signal.h>
 
-void
+_Noreturn void
 abort(void)
 {
 	kill(getpid(), SIGABRT);
--- a/sys/src/ape/lib/ap/plan9/_exit.c
+++ b/sys/src/ape/lib/ap/plan9/_exit.c
@@ -10,7 +10,7 @@
 
 static char exitstatus[ERRMAX];
 
-void
+_Noreturn void
 _exit(int status)
 {
 	_finish(status, 0);
--- a/sys/src/cmd/5e/fpa.c
+++ b/sys/src/cmd/5e/fpa.c
@@ -100,7 +100,6 @@
 	case 19: res = (vlong) op2; break;
 	case 20: res = sqrt(op2); break;
 	default: sysfatal("unimplemented FPA operation %#x @ %8ux", opc, P->R[15] - 4);
-	return;
 	}
 	switch(prec) {
 	case 0: *Fd = (float) res; break;
--- a/sys/src/cmd/5i/mem.c
+++ b/sys/src/cmd/5i/mem.c
@@ -281,5 +281,4 @@
 	}
 	Bprint(bioout, "User TLB miss vaddr 0x%.8lux\n", addr);
 	longjmp(errjmp, 0);
-	return 0;		/*to stop compiler whining*/
 }
--- a/sys/src/cmd/acme/acme.c
+++ b/sys/src/cmd/acme/acme.c
@@ -286,7 +286,6 @@
 			threadexitsall(msg);
 	print("acme: %s\n", msg);
 	abort();
-	return 0;
 }
 
 void
--- a/sys/src/cmd/ar.c
+++ b/sys/src/cmd/ar.c
@@ -1206,5 +1206,4 @@
 	} while (getspace());
 	fprint(2, "ar: out of memory\n");
 	exits("malloc");
-	return 0;
 }
--- a/sys/src/cmd/ascii.c
+++ b/sys/src/cmd/ascii.c
@@ -169,7 +169,6 @@
 		return(-1);
 	fprint(2, "%s: bad input char %c\n", argv0, c);
 	exits("bad");
-	return 0;	/* to keep ken happy */
 }
 int
 isnum(char *s)
--- a/sys/src/cmd/audio/pcmconv/pcmconv.c
+++ b/sys/src/cmd/audio/pcmconv/pcmconv.c
@@ -569,7 +569,6 @@
 	return d;
 Bad:
 	sysfatal("bad format: %s", f);
-	return d;
 }
 
 int
@@ -608,8 +607,8 @@
 	int k, n, m, nin, nout;
 	vlong l;
 
-	void (*oconv)(int *, uchar *, int, int, int) = nil;
-	void (*iconv)(int *, uchar *, int, int, int) = nil;
+	void (*oconv)(int *, uchar *, int, int, int);
+	void (*iconv)(int *, uchar *, int, int, int);
 
 	o = mkdesc("s16c2r44100");
 	i = o;
--- a/sys/src/cmd/audio/readtags/readtags.c
+++ b/sys/src/cmd/audio/readtags/readtags.c
@@ -37,7 +37,6 @@
 	if(image){
 		if(t != Timage)
 			return;
-		prog = nil;
 		if(strcmp(v, "image/jpeg") == 0)
 			prog = "jpg";
 		else if(strcmp(v, "image/png") == 0)
--- a/sys/src/cmd/audio/scream/screamdec.c
+++ b/sys/src/cmd/audio/scream/screamdec.c
@@ -53,7 +53,6 @@
 					dup(pfd[0], 0);
 					execl("/bin/audio/pcmconv", "pcmconv", "-i", fmt, nil);
 					sysfatal("exec: %r");
-					return;
 				}
 				close(pfd[0]);
 			}
--- a/sys/src/cmd/audio/zuke/zuke.c
+++ b/sys/src/cmd/audio/zuke/zuke.c
@@ -235,7 +235,6 @@
 	static char tmp[32];
 	char *s;
 
-	s = nil;
 	switch(c){
 	case Palbum: s = m->album; break;
 	case Partist: s = m->artist[0]; break;
--- a/sys/src/cmd/auth/acmed.c
+++ b/sys/src/cmd/auth/acmed.c
@@ -271,10 +271,8 @@
 	jsonfree(j);
 	free(s);
 	if(epnewnonce==nil|| epnewacct==nil || epneworder==nil
-	|| eprevokecert==nil || epkeychange==nil){
+	|| eprevokecert==nil || epkeychange==nil)
 		sysfatal("missing directory entries");
-		return -1;
-	}
 	return 0;
 }
 
--- a/sys/src/cmd/auth/factotum/rsa.c
+++ b/sys/src/cmd/auth/factotum/rsa.c
@@ -343,10 +343,8 @@
 	}else if(strcmp(alg, "sha256") == 0){
 		obj = oidsha256;
 		olen = sizeof(oidsha256);
-	}else{
+	}else
 		sysfatal("bad alg in mkasn1");
-		return -1;
-	}
 
 	p = asn1;
 	*p++ = 0x30;		/* sequence */
--- a/sys/src/cmd/auth/rsa2asn1.c
+++ b/sys/src/cmd/auth/rsa2asn1.c
@@ -36,7 +36,6 @@
 	if(argc > 1)
 		usage();
 
-	n = -1;
 	if((k = getrsakey(argc, argv, privatekey, nil)) == nil)
 		sysfatal("%r");
 	if(privatekey){
--- a/sys/src/cmd/auth/secstore/aescbc.c
+++ b/sys/src/cmd/auth/secstore/aescbc.c
@@ -149,5 +149,4 @@
 	if(Bflush(&bout) != 0)
 		sysfatal("write: %r");
 	exits(nil);
-	return 1;  /* keep  other compilers happy */
 }
--- a/sys/src/cmd/auth/warning.c
+++ b/sys/src/cmd/auth/warning.c
@@ -268,8 +268,6 @@
 
 	/* just in case */
 	sysfatal("can't exec send: %r");
-
-	return 0;		/* for compiler */
 }
 
 void
--- a/sys/src/cmd/aux/aout2efi.c
+++ b/sys/src/cmd/aux/aout2efi.c
@@ -127,7 +127,6 @@
 		relocs = 1;
 		break;
 	default:
-		SET(arch, chars);
 		sysfatal("archloch");
 	}
 	szofdat = fhdr.txtsz + fhdr.datsz;
--- a/sys/src/cmd/aux/flashfs/utils.c
+++ b/sys/src/cmd/aux/flashfs/utils.c
@@ -35,7 +35,6 @@
 
 	fprint(2, "%s: putc3 fail 0x%lux, called from %#p\n", prog, v, getcallerpc(&buff));
 	abort();
-	return -1;
 }
 
 int
--- a/sys/src/cmd/aux/realemu/decode.c
+++ b/sys/src/cmd/aux/realemu/decode.c
@@ -555,7 +555,6 @@
 	else if(a == 4)
 		return 2;
 	abort();
-	return 0;
 }
 
 void
--- a/sys/src/cmd/aux/statusbar.c
+++ b/sys/src/cmd/aux/statusbar.c
@@ -126,7 +126,6 @@
 		sleep(1000);
 		while(!die && (k = eread(Ekeyboard|Emouse, &e))) {
 			if(nokill==0 && k == Ekeyboard && (e.kbdc == Kdel || e.kbdc == Ketx)) {
-				die = 1;
 				postnote(PNPROC, parent, "interrupt");
 				_exits("interrupt");
 			}
--- a/sys/src/cmd/aux/statusmsg.c
+++ b/sys/src/cmd/aux/statusmsg.c
@@ -83,7 +83,6 @@
 		sleep(1000);
 		while(!die && (k = eread(Ekeyboard|Emouse, &e))) {
 			if(nokill==0 && k == Ekeyboard && (e.kbdc == Kdel || e.kbdc == Ketx)) {
-				die = 1;
 				postnote(PNPROC, parent, "interrupt");
 				_exits("interrupt");
 			}
--- a/sys/src/cmd/aux/wpa.c
+++ b/sys/src/cmd/aux/wpa.c
@@ -241,10 +241,8 @@
 		return 0;	/* not an error, might be old kernel */
 
 	brsnelen = hextob(buf, nil, brsne, sizeof(brsne));
-	if(brsnelen <= 4){
+	if(brsnelen <= 4)
 trunc:		sysfatal("invalid or truncated RSNE; brsne: %s", buf);
-		return 0;
-	}
 
 	w = rsne;
 	p = brsne;
@@ -257,10 +255,8 @@
 		*w++ = 0;	/* length */
 	} else if(p[0] == 0xDD){
 		p += 2;
-		if((e - p) < 4 || memcmp(p, wpa1oui, 4) != 0){
+		if((e - p) < 4 || memcmp(p, wpa1oui, 4) != 0)
 			sysfatal("unrecognized WPAIE type; brsne: %s", buf);
-			return 0;
-		}
 
 		/* WPA */
 		*w++ = 0xDD;
@@ -269,10 +265,8 @@
 		memmove(w, wpa1oui, 4);
 		w += 4;
 		p += 4;
-	} else {
+	} else
 		sysfatal("unrecognized RSNE type; brsne: %s", buf);
-		return 0;
-	}
 
 	if((e - p) < 6)
 		goto trunc;
@@ -285,15 +279,11 @@
 			groupcipher = &ccmp;
 		else if(memcmp(p, rsntkipoui, 4) == 0)
 			groupcipher = &tkip;
-		else {
+		else
 			sysfatal("unrecognized RSN group cipher; brsne: %s", buf);
-			return 0;
-		}
 	} else {
-		if(memcmp(p, wpatkipoui, 4) != 0){
+		if(memcmp(p, wpatkipoui, 4) != 0)
 			sysfatal("unrecognized WPA group cipher; brsne: %s", buf);
-			return 0;
-		}
 		groupcipher = &tkip;
 	}
 
@@ -365,10 +355,8 @@
 		}
 		p += 4;
 	}
-	if(i >= n){
+	if(i >= n)
 		sysfatal("auth suite is not PSK or WPA; brsne: %s", buf);
-		return 0;
-	}
 
 	memmove(w, p, 4);
 	w += 4;
@@ -1146,7 +1134,6 @@
 		exits(nil);
 	case -1:
 		sysfatal("fork: %r");
-		return;
 	case 0:
 		break;
 	}
--- a/sys/src/cmd/bzfs/mkext.c
+++ b/sys/src/cmd/bzfs/mkext.c
@@ -84,7 +84,6 @@
 			break;
 	}
 	_exits(0);
-	return -1;
 }
 
 void
--- a/sys/src/cmd/bzfs/unbflz.c
+++ b/sys/src/cmd/bzfs/unbflz.c
@@ -104,5 +104,4 @@
 	close(in);
 	close(out);
 	_exits(0);
-	return -1;
 }
--- a/sys/src/cmd/bzfs/unbzip.c
+++ b/sys/src/cmd/bzfs/unbzip.c
@@ -165,7 +165,6 @@
 
 	_unbzip(in, out);
 	_exits(0);
-	return -1;	/* not reached */
 }
 
 int bz_config_ok ( void )
--- a/sys/src/cmd/chgrp.c
+++ b/sys/src/cmd/chgrp.c
@@ -16,7 +16,6 @@
 	usage:
 		fprint(2, "usage: chgrp [ -uo ] group file ....\n");
 		exits("usage");
-		return;
 	case 'u':
 	case 'o':
 		uflag++;
--- a/sys/src/cmd/comm.c
+++ b/sys/src/cmd/comm.c
@@ -173,5 +173,4 @@
 		return b;
 	fprint(2,"comm: cannot open %s: %r\n",s);
 	exits("open");
-	return 0;	/* shut up ken */
 }
--- a/sys/src/cmd/cpp/cpp.c
+++ b/sys/src/cmd/cpp/cpp.c
@@ -34,7 +34,6 @@
 	flushout();
 	fflush(stderr);
 	exits(nerrs? "errors" : 0);
-	return 0;
 }
 
 void
--- a/sys/src/cmd/dc.c
+++ b/sys/src/cmd/dc.c
@@ -1453,7 +1453,6 @@
 		goto loop;
 	}
 	exits(0);
-	return 0;	/* shut up ken */
 }
 
 void
--- a/sys/src/cmd/diff/diffio.c
+++ b/sys/src/cmd/diff/diffio.c
@@ -114,10 +114,8 @@
 	} else
 		d->file2 = orig;
 	bp = Bopen(arg, OREAD);
-	if (!bp) {
+	if (!bp)
 		sysfatal("cannot open %s: %r", arg);
-		return 0;
-	}
 	if (d->binary)
 		return bp;
 	nbytes = Bread(bp, buf, MIN(1024, MAXLINELEN));
--- a/sys/src/cmd/diff/util.c
+++ b/sys/src/cmd/diff/util.c
@@ -36,10 +36,8 @@
 int
 mkpathname(char *pathname, char *path, char *name)
 {
-	if (strlen(path) + strlen(name) > MAXPATHLEN) {
+	if (strlen(path) + strlen(name) > MAXPATHLEN)
 		sysfatal("pathname %s/%s too long", path, name);
-		return 1;
-	}
 	sprint(pathname, "%s/%s", path, name);
 	return 0;
 }
@@ -59,19 +57,15 @@
 	 * the system will remove the file for us.
 	 */
 	fd = create(p, OWRITE|ORCLOSE, 0600);
-	if (fd < 0) {
+	if (fd < 0)
 		sysfatal("cannot create %s: %r", p);
-		return 0;
-	}
 	while ((i = read(input, buf, sizeof(buf))) > 0) {
 		if ((i = write(fd, buf, i)) < 0)
 			break;
 	}
 	*sb = dirfstat(fd);
-	if (i < 0) {
+	if (i < 0)
 		sysfatal("cannot read/write %s: %r", p);
-		return 0;
-	}
 	return p;
 }
 
@@ -83,18 +77,14 @@
 
 	dir = dirstat(file);
 	if(dir == nil) {
-		if (strcmp(file, "-") || (dir = dirfstat(0)) == nil) {
+		if (strcmp(file, "-") || (dir = dirfstat(0)) == nil)
 			sysfatal("cannot stat %s: %r", file);
-			return 0;
-		}
 		free(dir);
 		return mktmpfile(0, sb);
 	} else if (!REGULAR_FILE(dir) && !DIRECTORY(dir)) {
 		free(dir);
-		if ((input = open(file, OREAD)) == -1) {
+		if ((input = open(file, OREAD)) == -1)
 			sysfatal("cannot open %s: %r", file);
-			return 0;
-		}
 		file = mktmpfile(input, sb);
 		close(input);
 	} else
--- a/sys/src/cmd/disk/9660/direc.c
+++ b/sys/src/cmd/disk/9660/direc.c
@@ -101,10 +101,8 @@
 	if((p = strrchr(name, '/')) != nil) {
 		*p = '\0';
 		root = walkdirec(root, name);
-		if(root == nil) {
+		if(root == nil)
 			sysfatal("error in proto file: no entry for /%s but /%s/%s", name, name, p+1);
-			return nil;
-		}
 		*p = '/';
 		p++;
 	} else
--- a/sys/src/cmd/disk/prep/edisk.c
+++ b/sys/src/cmd/disk/prep/edisk.c
@@ -368,10 +368,8 @@
 			return b->data;
 	}
 	b = malloc(sizeof(Block) + 2*disk->secsize);
-	if(pread(disk->fd, b->data, disk->secsize, disk->secsize*addr) != disk->secsize){
+	if(pread(disk->fd, b->data, disk->secsize, disk->secsize*addr) != disk->secsize)
 		sysfatal("getblock %llud: %r", addr);
-		return nil;
-	}
 	b->save = &b->data[disk->secsize];
 	memmove(b->save, b->data, disk->secsize);
 
--- a/sys/src/cmd/disk/prep/edit.c
+++ b/sys/src/cmd/disk/prep/edit.c
@@ -293,7 +293,6 @@
 	}
 
 	exits(0);
-	return nil;	/* not reached */
 }
 
 char*
--- a/sys/src/cmd/disk/prep/fdisk.c
+++ b/sys/src/cmd/disk/prep/fdisk.c
@@ -60,7 +60,7 @@
  * Catch the obvious error routines to fix up the disk.
  */
 void
-sysfatal(char *fmt, ...)
+diskfatal(char *fmt, ...)
 {
 	char buf[1024];
 	va_list arg;
@@ -79,13 +79,27 @@
 	exits(buf);
 }
 
-void
-abort(void)
+void*
+errmalloc(ulong sz)
 {
-	fprint(2, "abort\n");
-	recover(&edit);
+	void *v;
+
+	v = malloc(sz);
+	if(v == nil)
+		diskfatal("malloc %lud fails", sz);
+	memset(v, 0, sz);
+	return v;
 }
 
+char*
+errstrdup(char *s)
+{
+	s = strdup(s);
+	if(s == nil)
+		diskfatal("strdup (%.10s) fails", s);
+	return s;
+}
+
 void
 usage(void)
 {
@@ -375,9 +389,9 @@
 diskread(Disk *disk, void *data, int ndata, u32int sec, u32int off)
 {
 	if(seek(disk->fd, (vlong)sec*disk->secsize+off, 0) != (vlong)sec*disk->secsize+off)
-		sysfatal("diskread seek %lud.%lud: %r", (ulong)sec, (ulong)off);
+		diskfatal("diskread seek %lud.%lud: %r", (ulong)sec, (ulong)off);
 	if(readn(disk->fd, data, ndata) != ndata)
-		sysfatal("diskread %lud at %lud.%lud: %r", (ulong)ndata, (ulong)sec, (ulong)off);
+		diskfatal("diskread %lud at %lud.%lud: %r", (ulong)ndata, (ulong)sec, (ulong)off);
 }
 
 static int
@@ -403,11 +417,11 @@
 	Dospart *p;
 
 	primary = (ebrstart == 0) && (ebrtype == 0);
-	p = emalloc(sizeof(*p));
+	p = errmalloc(sizeof(*p));
 	if(name)
-		p->name = estrdup(name);
+		p->name = errstrdup(name);
 	else{
-		p->name = emalloc(20);
+		p->name = errmalloc(20);
 		sprint(p->name, "%c%d", primary ? 'p' : 's', ++n);
 	}
 
@@ -452,7 +466,7 @@
 	if((nrtab%8) == 0) {
 		rtab = realloc(rtab, (nrtab+8)*sizeof(rtab[0]));
 		if(rtab == nil)
-			sysfatal("out of memory");
+			diskfatal("out of memory");
 	}
 	rtab[nrtab] = (Recover){t, lba};
 	nrtab++;
@@ -550,7 +564,7 @@
 
 	diskread(edit->disk, &table, Tablesize, 0, Toffset);
 	if(table.magic[0] != Magic0 || table.magic[1] != Magic1)
-		sysfatal("did not find master boot record");
+		diskfatal("did not find master boot record");
 }
 
 static int
@@ -693,7 +707,7 @@
 		sep = "";
 
 	i = 0;
-	name = emalloc(strlen(vname)+10);
+	name = errmalloc(strlen(vname)+10);
 
 	sprint(name, "%s", vname);
 	do {
@@ -707,7 +721,7 @@
 		}
 	} while(ok == 0);
 
-	n = emalloc(sizeof(*n));
+	n = errmalloc(sizeof(*n));
 	n->name = name;
 	n->link = namelist;
 	namelist = n;
@@ -1130,7 +1144,7 @@
 		memset(tp, 0, sizeof(*tp));
 		
 	if(i != edit->npart)
-		sysfatal("cannot happen #1");
+		diskfatal("cannot happen #1");
 
 	if(diskwrite(disk, &table, Tablesize, 0, Toffset) < 0)
 		recover(edit);
--- a/sys/src/cmd/dtracy/act.c
+++ b/sys/src/cmd/dtracy/act.c
@@ -378,10 +378,10 @@
 				return mkval(VALINT, v);
 			case DTV_PROBE:
 				return mkval(VALSTR, en->probe);
-			default: sysfatal("receval: unknown variable %d", n->type); return mkval(VALINT, 0LL);
+			default: sysfatal("receval: unknown variable %d", n->type);
 			}
 			break;
-		default: sysfatal("receval: unknown symbol type %d", n->type); return mkval(VALINT, 0LL);
+		default: sysfatal("receval: unknown symbol type %d", n->type);
 		}
 	case ONUM: return mkval(VALINT, n->num);
 	case OBIN:
@@ -420,7 +420,6 @@
 		}
 	default:
 		sysfatal("receval: unknown type %α", n->type);
-		return mkval(VALINT, 0LL);
 	}
 }
 
--- a/sys/src/cmd/dtracy/cgen.c
+++ b/sys/src/cmd/dtracy/cgen.c
@@ -182,7 +182,7 @@
 			rt = regalloc();
 			emit(DTE(DTE_LDV, n->sym->idx, rt, 0));
 			return rt;
-		default: sysfatal("egen: unknown symbol type %d", n->sym->type); return 0;
+		default: sysfatal("egen: unknown symbol type %d", n->sym->type);
 		}
 	case OBIN:
 		switch(/*oper*/n->op){
@@ -204,7 +204,7 @@
 		case OPLT: op = DTE_SLT; break;
 		case OPLE: op = DTE_SLE; break;
 		case OPXNOR: op = DTE_XNOR; break;
-		default: sysfatal("egen: unknown op %d", n->op); return 0;
+		default: sysfatal("egen: unknown op %d", n->op);
 		}
 		r1 = egen(n->n1);
 		r2 = egen(n->n2);
@@ -240,7 +240,7 @@
 		}
 	case ORECORD:
 	case OSTR:
-	default: sysfatal("egen: unknown type %α", n->type); return 0;
+	default: sysfatal("egen: unknown type %α", n->type);
 	}
 }
 
@@ -307,7 +307,7 @@
 		n->num = *recoff;
 		*recoff += n->typ->size;
 		return n;
-	default: sysfatal("tracegen: unknown type %α", n->type); return nil;
+	default: sysfatal("tracegen: unknown type %α", n->type);
 	}
 	return n;
 }
--- a/sys/src/cmd/dtracy/lex.c
+++ b/sys/src/cmd/dtracy/lex.c
@@ -385,10 +385,10 @@
 		case 0x41: return &typs32;
 		case 0x80: return &typu64;
 		case 0x81: return &typs64;
-		default: sysfatal("type: invalid (size,sign) = (%d,%d)\n", size, sign); return nil;
+		default: sysfatal("type: invalid (size,sign) = (%d,%d)\n", size, sign);
 		}
 	case TYPSTRING: return &typstr;
 	case TYPPTR: return mkptr(va_arg(va, Type *));
-	default: sysfatal("type: unknown %t", typ); return nil;
+	default: sysfatal("type: unknown %t", typ);
 	}
 }
--- a/sys/src/cmd/dtracy/type.c
+++ b/sys/src/cmd/dtracy/type.c
@@ -205,7 +205,6 @@
 	case OPLOR: return v1 || v2; break;
 	default:
 		sysfatal("cfold: unknown op %.2x", op);
-		return 0;
 	}
 
 }
@@ -289,7 +288,7 @@
 				break;
 			}
 			break;
-		default: sysfatal("calcrecsize: unknown symbol type %d", n->sym->type); return nil;
+		default: sysfatal("calcrecsize: unknown symbol type %d", n->sym->type);
 		}
 		break;
 	case OBIN:
@@ -315,7 +314,7 @@
 		n->recsize = min(n->typ->size, n->n1->recsize + n->n2->recsize + n->n3->recsize);
 		break;
 	case ORECORD:
-	default: sysfatal("calcrecsize: unknown type %α", n->type); return nil;
+	default: sysfatal("calcrecsize: unknown type %α", n->type);
 	}
 	return n;
 }
@@ -347,7 +346,7 @@
 		n->n3 = insrecord(n->n3);
 		break;
 	case ORECORD:
-	default: sysfatal("insrecord: unknown type %α", n->type); return nil;
+	default: sysfatal("insrecord: unknown type %α", n->type);
 	}
 	return n;
 }
--- a/sys/src/cmd/exportfs/exportsrv.c
+++ b/sys/src/cmd/exportfs/exportsrv.c
@@ -605,7 +605,6 @@
 	arg[0] = "/bin/exportfs";
 	exec(arg[0], arg);
 	_exits("whoops: exec failed");	
-	return -1;
 }
 
 void
--- a/sys/src/cmd/fplot.c
+++ b/sys/src/cmd/fplot.c
@@ -246,7 +246,6 @@
 			return t;
 		}
 	sysfatal("syntax error at %s", *s);
-	return nil;
 }
 
 void
--- a/sys/src/cmd/git/pack.c
+++ b/sys/src/cmd/git/pack.c
@@ -1217,10 +1217,8 @@
 			if(objectcrc(f, o) == -1)
 				return -1;
 		}
-		if(n == nvalid){
+		if(n == nvalid)
 			sysfatal("fix point reached too early: %d/%d: %r", nvalid, nobj);
-			goto error;
-		}
 		nvalid = n;
 	}
 	if(interactive)
--- a/sys/src/cmd/gzip/unzip.c
+++ b/sys/src/cmd/gzip/unzip.c
@@ -536,7 +536,6 @@
 	if(ecoff < 0){
 		fprint(2, "unzip: can't seek to contents of %s\n", file);
 		longjmp(seekjmp, 1);
-		return -1;
 	}
 	if(setjmp(zjmp))
 		return -1;
@@ -545,7 +544,6 @@
 		if(ecoff <= 0 || off >= 1024){
 			fprint(2, "unzip: cannot find end of table of contents in %s\n", file);
 			longjmp(seekjmp, 1);
-			return -1;
 		}
 		off++;
 		ecoff--;
@@ -572,7 +570,6 @@
 	if(Bseek(bin, off, 0) != off){
 		fprint(2, "unzip: can't seek to start of contents of %s\n", file);
 		longjmp(seekjmp, 1);
-		return -1;
 	}
 
 	return entries;
--- a/sys/src/cmd/histogram.c
+++ b/sys/src/cmd/histogram.c
@@ -50,10 +50,8 @@
 erealloc(void *v, ulong sz)
 {
 	v = realloc(v, sz);
-	if(v == nil){
+	if(v == nil)
 		sysfatal("realloc: %r");
-		threadexitsall("memory");
-	}
 	return v;
 }
 
--- a/sys/src/cmd/htmlroff/input.c
+++ b/sys/src/cmd/htmlroff/input.c
@@ -194,10 +194,8 @@
 			goto top;
 		}
 		r = c;
-	}else{
-		r = 0;
+	}else
 		sysfatal("getrune - can't happen");
-	}
 	if(r == '\n')
 		istack->lineno++;	
 	return r;
--- a/sys/src/cmd/ip/6in4.c
+++ b/sys/src/cmd/ip/6in4.c
@@ -165,7 +165,6 @@
 
 	cl = smprint("%s/ipifc/clone", inside);
 	cfd = open(cl, ORDWR);			/* allocate a conversation */
-	n = 0;
 	if (cfd < 0 || (n = read(cfd, buf, sizeof buf - 1)) <= 0)
 		sysfatal("can't make packet interface %s: %r", cl);
 	if (debug)
--- a/sys/src/cmd/ip/ayiya.c
+++ b/sys/src/cmd/ip/ayiya.c
@@ -339,7 +339,6 @@
 
 	cl = smprint("%s/ipifc/clone", inside);
 	cfd = open(cl, ORDWR);			/* allocate a conversation */
-	n = 0;
 	if (cfd < 0 || (n = read(cfd, buf, sizeof buf - 1)) <= 0)
 		sysfatal("can't make packet interface %s: %r", cl);
 	if (debug)
--- a/sys/src/cmd/ip/cifsd/main.c
+++ b/sys/src/cmd/ip/cifsd/main.c
@@ -87,12 +87,10 @@
 		&r.cmd, &r.flags, &r.flags2, &hpid, &sig, &r.tid, &r.pid, &r.uid, &r.mid)) == 0){
 		logit("bad smb header");
 		exits("botch");
-		return;
 	}
 	if(magic != MAGIC) {
 		logit("bad smb magic [%x] %s", magic, (magic == MAGIC_SMB2 ? "(SMB2/3 not supported)" : ""));
 		exits("botch");
-		return;
 	}
 	r.pid |= hpid<<16;
 	r.lh = buffer;
--- a/sys/src/cmd/ip/ftpfs/ftpfs.c
+++ b/sys/src/cmd/ip/ftpfs/ftpfs.c
@@ -253,7 +253,6 @@
 	}
 
 	_exits(0);
-	return -1;
 }
 
 void
--- a/sys/src/cmd/ip/httpd/save.c
+++ b/sys/src/cmd/ip/httpd/save.c
@@ -131,7 +131,6 @@
 	if(htmlfd < 0 || (dir = dirfstat(htmlfd)) == nil){
 		hfail(c, HNotFound, c->req.uri);
 		exits("failed");
-		return;
 	}
 
 	snprint(fn, nfn, "/usr/web/save/%s.data", c->req.uri);
--- a/sys/src/cmd/ip/pptp.c
+++ b/sys/src/cmd/ip/pptp.c
@@ -701,7 +701,6 @@
 		return pid;
 	(*f)(a);
 	_exits(nil);
-	return 0; // never reaches here
 }
 
 void
--- a/sys/src/cmd/ip/snoopy/main.c
+++ b/sys/src/cmd/ip/snoopy/main.c
@@ -251,7 +251,6 @@
 		return _filterpkt(f->l, m);
 	}
 	sysfatal("internal error: filterpkt op: %d", f->op);
-	return 0;
 }
 int
 filterpkt(Filter *f, uchar *ps, uchar *pe, Proto *pr, int needroot)
--- a/sys/src/cmd/ip/telnetd.c
+++ b/sys/src/cmd/ip/telnetd.c
@@ -628,7 +628,6 @@
 		close(fd);
 	}
 	exits(0);
-	return -1;
 }
 
 int
--- a/sys/src/cmd/jpg/readpng.c
+++ b/sys/src/cmd/jpg/readpng.c
@@ -144,10 +144,8 @@
 		}
 		if(type[0] & PropertyBit)
 			goto Again;  /* skip auxiliary chunks fornow */
-		if(strcmp(type,"IDAT")){
+		if(strcmp(type,"IDAT"))
 			sysfatal("unrecognized mandatory chunk %s", type);
-			goto Again;
-		}
 	}
 	return *z->p++;
 }
@@ -407,7 +405,6 @@
 
 	bpc = *h++;
 	colorfmt = *h++;
-	nchan = 0;
 	if(*h++ != 0)
 		sysfatal("only deflate supported for now [%d]", h[-1]);
 	if(*h++ != FilterNone)
@@ -417,7 +414,6 @@
 
 	image = pngmalloc(sizeof(Rawimage), 1);
 	image->r = Rect(0, 0, dx, dy);
-	nout = 0;
 	switch(colorfmt){
 	case 0:	/* grey */
 		if(bpc != 1 && bpc != 2 && bpc != 4 && bpc != 8 && bpc != 16)
--- a/sys/src/cmd/jpg/writegif.c
+++ b/sys/src/cmd/jpg/writegif.c
@@ -566,7 +566,6 @@
 	v = malloc(sz);
 	if(v == nil) {
 		fprint(2, "WriteGIF: out of memory allocating %ld\n", sz);
-abort();
 		exits("mem");
 	}
 	memset(v, 0, sz);
--- a/sys/src/cmd/ki/mem.c
+++ b/sys/src/cmd/ki/mem.c
@@ -236,5 +236,4 @@
 	}
 	Bprint(bioout, "data_access_MMU_miss [addr 0x%.8lux]\n", addr);
 	longjmp(errjmp, 0);
-	return 0;		/*to stop compiler whining*/
 }
--- a/sys/src/cmd/ndb/dns.h
+++ b/sys/src/cmd/ndb/dns.h
@@ -437,7 +437,6 @@
 
 RR*	getdnsservers(int);
 
-void	abort(); /* char*, ... */;
 void	addserver(Server**, char*);
 int	bslashfmt(Fmt*);
 Server*	copyserverlist(Server*);
--- a/sys/src/cmd/patch.c
+++ b/sys/src/cmd/patch.c
@@ -333,7 +333,6 @@
 		switch(ln[0]){
 		default:
 			sysfatal("%s:%d: malformed hunk: leading junk", name, lnum);
-			goto out;
 		case '\\':
 			if(strncmp(ln, "\\ No newline", nelem("\\ No newline")-1) == 0)
 				trimhunk(c, &h);
@@ -563,7 +562,6 @@
 searchln(Fbuf *f, Hunk *h, int ln)
 {
 	int off;
-int n;
 
 	off = f->lines[ln];
 	if(off + h->oldlen > f->len)
@@ -601,7 +599,6 @@
 		}
 	}
 	sysfatal("%s:%d: unable to find hunk offset in %s", fname, h->lnum, h->oldpath);
-	return nil;
 }
 
 char*
--- a/sys/src/cmd/proof/main.c
+++ b/sys/src/cmd/proof/main.c
@@ -66,10 +66,8 @@
 
 	if (argc > 0) {
 		close(0);
-		if (open(argv[0], 0) != 0) {
+		if (open(argv[0], 0) != 0)
 			sysfatal("can't open %s: %r", argv[0]);
-			exits("open failure");
-		}
 		if(dotrack)
 			track = argv[0];
 	}
--- a/sys/src/cmd/qi/float.c
+++ b/sys/src/cmd/qi/float.c
@@ -468,7 +468,6 @@
 		if(trace)
 			itrace("fcmpo\tcr%d,f%d,f%d", rd, ra, rb);
 		if(isNaN(reg.fd[ra]) || isNaN(reg.fd[rb])) {	/* BUG: depends whether quiet or signalling ... */
-			fc = CRFU;
 			Bprint(bioout, "invalid_fp_register\n");
 			longjmp(errjmp, 0);
 		}
--- a/sys/src/cmd/qi/mem.c
+++ b/sys/src/cmd/qi/mem.c
@@ -267,5 +267,4 @@
 	}
 	Bprint(bioout, "data_access_MMU_miss [addr 0x%.8lux]\n", addr);
 	longjmp(errjmp, 0);
-	return 0;		/*to stop compiler whining*/
 }
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -335,8 +335,6 @@
 		}
 	fprint(2, "rio %d: abort: %s\n", getpid(), msg);
 	abort();
-	exits(msg);
-	return 0;
 }
 
 void
--- a/sys/src/cmd/rx.c
+++ b/sys/src/cmd/rx.c
@@ -228,7 +228,6 @@
 		write(fd, buf, 0);
 
 	exits(0);
-	return 0;			/* to keep compiler happy */
 }
 
 void
--- a/sys/src/cmd/sat.c
+++ b/sys/src/cmd/sat.c
@@ -235,7 +235,6 @@
 	return t != TEOF;
 syntax:
 	sysfatal("syntax error");
-	return 0;
 }
 
 int oneflag, multiflag;
--- a/sys/src/cmd/spin/msc_tcl.c
+++ b/sys/src/cmd/spin/msc_tcl.c
@@ -40,7 +40,6 @@
 extern int	ntrail, s_trail, pno, depth;
 extern Symbol	*oFname;
 
-extern void	exit(int);
 extern void	putpostlude(void);
 
 static void	putpages(void);
--- a/sys/src/cmd/spin/tl.h
+++ b/sys/src/cmd/spin/tl.h
@@ -95,7 +95,6 @@
 void	addtrans(Graph *, char *, Node *, char *);
 void	cache_stats(void);
 void	dump(Node *);
-void	exit(int);
 void	Fatal(char *, char *);
 void	fatal(char *, char *);
 void	fsm_print(void);
--- a/sys/src/cmd/ssh.c
+++ b/sys/src/cmd/ssh.c
@@ -273,10 +273,8 @@
 	va_start(a, fmt);
 	n = vpack(send.b, sizeof(send.b), fmt, a);
 	va_end(a);
-	if(n < 0) {
+	if(n < 0)
 toobig:		sysfatal("sendpkt: message too big");
-		return;
-	}
 	send.r = send.b;
 	send.w = send.b+n;
 
@@ -978,7 +976,6 @@
 		if(unpack(recv.r, recv.w-recv.r, "_us", &c, &s, &n) < 0)
 			break;
 		sysfatal("disconnect: (%d) %.*s", c, utfnlen(s, n), s);
-		return;
 	case MSG_DEBUG:
 		if(unpack(recv.r, recv.w-recv.r, "__sb", &s, &n, &c) < 0)
 			break;
--- a/sys/src/cmd/sshfs.c
+++ b/sys/src/cmd/sshfs.c
@@ -358,10 +358,8 @@
 	va_start(a, fmt);
 	n = vpack(buf+4, sizeof(buf)-4, fmt, a);
 	va_end(a);
-	if(n < 0) {
+	if(n < 0)
 		sysfatal("sendpkt: message too big");
-		return;
-	}
 	PUT4(buf, n);
 	n += 4;
 
--- a/sys/src/cmd/tapefs/cpiofs.c
+++ b/sys/src/cmd/tapefs/cpiofs.c
@@ -169,7 +169,6 @@
 		return rdsysiii;
 
 	sysfatal("Out of phase--get MERT help");
-	return nil;
 }
 
 void
--- a/sys/src/cmd/tcs/tcs.c
+++ b/sys/src/cmd/tcs/tcs.c
@@ -181,7 +181,6 @@
 			return(c);
 	}
 	sysfatal("charset `%s' unknown", name);
-	return(0);	/* just shut the compiler up */
 }
 
 static int
--- a/sys/src/cmd/troff2html/troff2html.c
+++ b/sys/src/cmd/troff2html/troff2html.c
@@ -490,7 +490,6 @@
 	if(min<=i && i<max)
 		return i;
 	sysfatal("value of %s is %d; min %d max %d at %s:#%d", name, i, min, max, filename, cno);
-	return i;
 }
 
 void
--- a/sys/src/cmd/unmount.c
+++ b/sys/src/cmd/unmount.c
@@ -18,7 +18,6 @@
 		mtpt = argv[2];
 		break;
 	default:
-		SET(mnted, mtpt);
 		fprint(2, "usage: unmount mountpoint\n");
 		fprint(2, "       unmount mounted mountpoint\n");
 		exits("usage");
--- a/sys/src/cmd/upas/bayes/dfa.c
+++ b/sys/src/cmd/upas/bayes/dfa.c
@@ -743,7 +743,6 @@
 	}
 	werrstr("unexpected eof");
 	longjmp(jb, 1);
-	return -1;
 }
 
 Dreprog*
--- a/sys/src/cmd/upas/common/folder.c
+++ b/sys/src/cmd/upas/common/folder.c
@@ -34,7 +34,6 @@
 			return f;
 	}
 	sysfatal("folder.c:ftab too small");
-	return 0;
 }
 
 static int
--- a/sys/src/cmd/upas/imap4d/copy.c
+++ b/sys/src/cmd/upas/imap4d/copy.c
@@ -51,7 +51,6 @@
 		exec("/bin/upas/mbappend", av);
 		ilog("exec: %r");
 		_exits("b0rked");
-		return -1;
 	default:
 		*pip = fd[0];
 		close(fd[1]);
--- a/sys/src/cmd/upas/imap4d/quota.c
+++ b/sys/src/cmd/upas/imap4d/quota.c
@@ -21,7 +21,6 @@
 		exec(cmd, av);
 		ilog("exec: %r");
 		_exits("b0rked");
-		return -1;
 	default:
 		*pip = fd[0];
 		close(fd[1]);
--- a/sys/src/cmd/upas/ml/common.c
+++ b/sys/src/cmd/upas/ml/common.c
@@ -157,9 +157,6 @@
 	av[ac] = 0;
 	exec("/bin/upas/send", av);
 	sysfatal("execing mailer: %r");
-
-	/* not reached */
-	return -1;
 }
 
 void
--- a/sys/src/cmd/upas/pop3/pop3.c
+++ b/sys/src/cmd/upas/pop3/pop3.c
@@ -488,7 +488,6 @@
 {
 	synccmd(nil);
 	exits(nil);
-	return 0;
 }
 
 static int
--- a/sys/src/cmd/upas/send/filter.c
+++ b/sys/src/cmd/upas/send/filter.c
@@ -28,7 +28,6 @@
 {
 	fprint(2, "%s\n", cp);
 	exits("error");
-	return 0;
 }
 
 void
--- a/sys/src/cmd/upas/smtp/smtpd.c
+++ b/sys/src/cmd/upas/smtp/smtpd.c
@@ -474,7 +474,6 @@
 		rejectcount++;
 		reply("554 5.7.0 Liar!\r\n");
 		exits("client pretended to be us");
-		return;
 	}
 
 	if(strchr(him, '.') == 0 && nci != nil && strchr(nci->rsys, '.') != nil)
--- a/sys/src/cmd/vac/glob.c
+++ b/sys/src/cmd/vac/glob.c
@@ -131,7 +131,6 @@
 			continue;
 		}
 		
-		inc = 0;
 		if(strncmp(p, "include ", 8) == 0){
 			inc = 1;
 		}else if(strncmp(p, "exclude ", 8) == 0){
--- a/sys/src/cmd/venti/copy.c
+++ b/sys/src/cmd/venti/copy.c
@@ -162,7 +162,6 @@
 	}
 	if(!rewrite && memcmp(score, nscore, VtScoreSize) != 0){
 		fprint(2, "not rewriting: wrote %V got %V\n", score, nscore);
-		abort();
 		sysfatal("not rewriting: wrote %V got %V", score, nscore);
 	}
 	
--- a/sys/src/cmd/venti/srv/conv.c
+++ b/sys/src/cmd/venti/srv/conv.c
@@ -235,7 +235,6 @@
 		break;
 	default:
 		sysfatal("packarena unknown version %d", arena->version);
-		return -1;
 	}
 
 	p = buf;
@@ -370,7 +369,6 @@
 		break;
 	default:
 		sysfatal("packarenahead unknown version %d", head->version);
-		return -1;
 	}
 
 	p = buf;
--- a/sys/src/cmd/vl/asm.c
+++ b/sys/src/cmd/vl/asm.c
@@ -1472,7 +1472,6 @@
 	case AADDVU:		return SP(3,1);
 	}
 	diag("bad irr %d", a);
-abort();
 	return 0;
 }
 
--- a/sys/src/cmd/vmx/ksetup.c
+++ b/sys/src/cmd/vmx/ksetup.c
@@ -691,7 +691,6 @@
 usage:
 	fprint(2, "openbsd cmdline usage: kernel [-asdc] [var=value ...]\nsupported vars: device tty db_console\n");
 	threadexitsall("usage");
-	return 0;
 }
 
 static int
--- a/sys/src/cmd/xd.c
+++ b/sys/src/cmd/xd.c
@@ -74,7 +74,6 @@
 	Binit(&bout, 1, OWRITE);
 	Blethal(&bout, nil);
 	err = 0;
-	ap = 0;
 	while(argc>1 && argv[1][0]=='-' && argv[1][1]){
 		--argc;
 		argv++;
--- a/sys/src/games/galaxy/body.c
+++ b/sys/src/games/galaxy/body.c
@@ -133,7 +133,6 @@
 			return cmd;
 	}
 	sysfatal("getcmd: no such command %s", l);
-	return NOCMD;
 }
 
 void
--- a/sys/src/games/gb/cpu.c
+++ b/sys/src/games/gb/cpu.c
@@ -551,5 +551,4 @@
 	case 0xff: return call(0x38, -1);
 	}
 	sysfatal("undefined opcode %#.2x at pc=%#.4x", op, curpc);
-	return 0;
 }
--- a/sys/src/games/gba/gba.c
+++ b/sys/src/games/gba/gba.c
@@ -150,7 +150,6 @@
 		break;
 	default:
 		sysfatal("typestr: unknown type %d -- shouldn't happen", type);
-		return;
 	}
 	snprint(s, BACKTYPELEN, "%s%d%s", st, size/128, id);
 }
--- a/sys/src/games/glendy.c
+++ b/sys/src/games/glendy.c
@@ -325,7 +325,6 @@
 	default:
 		sysfatal("andrey messed up big time");
 	}
-	return 1000;
 }
 /* the following two routines constitute the "game AI"
 * they score the field based on the number of moves
--- a/sys/src/games/md/mem.c
+++ b/sys/src/games/md/mem.c
@@ -45,7 +45,6 @@
 		return (~z80bus & BUSACK) >> 1;
 	}
 	sysfatal("read from 0xa1%.4ux (pc=%#.6ux)", a, curpc);
-	return 0;
 }
 
 void
@@ -191,7 +190,6 @@
 	default:
 	invalid:
 		sysfatal("read from %#.6ux (pc=%#.6ux)", a, curpc);
-		return 0;
 	}
 }
 
--- a/sys/src/games/md/z80.c
+++ b/sys/src/games/md/z80.c
@@ -503,7 +503,6 @@
 	case 0x4f: return 9;
 	}
 	sysfatal("undefined z80 opcode ed%.2x at pc=%#.4x", op, scurpc);
-	return 0;
 }
 
 static int
@@ -579,7 +578,6 @@
 	case 0x2e: ix[n] = ix[n] & 0xff00 | fetch8(); return 11;
 	}
 	sysfatal("undefined z80 opcode %.2x%.2x at pc=%#.4x", n ? 0xfd : 0xdd, op, scurpc);
-	return 0;
 }
 
 int
@@ -817,5 +815,4 @@
 	case 0xff: return call(0x38, 1);
 	}
 	sysfatal("undefined z80 opcode %#.2x at pc=%#.4x", op, scurpc);
-	return 0;
 }
--- a/sys/src/games/v8e/cpu.c
+++ b/sys/src/games/v8e/cpu.c
@@ -109,7 +109,7 @@
 	case 13: v = fetch16(); return memread32(r[c & 15] + (s16int) v);
 	case 14: v = fetch32(); return (u32int)(r[c & 15] + v);
 	case 15: v = fetch32(); return memread32(r[c & 15] + v);
-	default: sysfatal("unimplemented addressing mode %.2x", c); return -1;
+	default: sysfatal("unimplemented addressing mode %.2x", c);
 	}
 }
 
@@ -136,7 +136,7 @@
 	case 0: return memread8(a);
 	case 1: return memread16(a);
 	case 2: return memread32(a);
-	default: sysfatal("readm: unimplemented size %d (a=%.llx, pc=%.8x)", s, a, curpc); return -1;
+	default: sysfatal("readm: unimplemented size %d (a=%.llx, pc=%.8x)", s, a, curpc);
 	}
 }
 
@@ -233,7 +233,6 @@
 		return v;
 	default:
 		sysfatal("subtract: unimplemented size %d", s);
-		return 0;
 	}
 }
 
@@ -280,7 +279,6 @@
 		return v;
 	default:
 		sysfatal("subtract: unimplemented size %d", s);
-		return 0;
 	}
 }
 
@@ -349,7 +347,6 @@
 		return v;
 	default:
 		sysfatal("mul: unimplemented size %d", s);
-		return 0;
 	}
 }
 
@@ -383,7 +380,6 @@
 		return v;
 	default:
 		sysfatal("div: unimplemented size %d", s);
-		return 0;
 	}
 }
 
@@ -422,7 +418,6 @@
 		break;
 	default:
 		sysfatal("alu: unimplemented %d", r);
-		return;
 	}
 	switch(o){
 	case ADD: v = add(a, b, s); break;
@@ -435,7 +430,7 @@
 	case BIS: v = a | b; ps &= ~FLAGV; break;
 	case XOR: v = a ^ b; ps &= ~FLAGV; break;
 	case BIT: nzv(a & b, s); return;
-	default: sysfatal("unimplemented %d in alu", o); v = 0;
+	default: sysfatal("unimplemented %d in alu", o);
 	}
 	nz(v, s);
 	writem(c, v, s);
--- a/sys/src/games/v8e/sys.c
+++ b/sys/src/games/v8e/sys.c
@@ -113,7 +113,6 @@
 	no = arg(0);
 	if(no == 0) exits(nil);
 	exits(smprint("%d", no));
-	return 0;
 }
 
 static int
--- a/sys/src/games/vocdec.c
+++ b/sys/src/games/vocdec.c
@@ -30,7 +30,6 @@
 	default:
 		sysfatal("unsupported");
 	}
-	return nil;
 }
 
 void
--- a/sys/src/games/vocenc.c
+++ b/sys/src/games/vocenc.c
@@ -54,7 +54,6 @@
 	return d;
 Bad:
 	sysfatal("bad format: %s", f);
-	return d;
 }
 
 int
@@ -72,7 +71,6 @@
 	default:
 		sysfatal("bad format");
 	}
-	return -1;
 }
 
 void
--- a/sys/src/games/xs.c
+++ b/sys/src/games/xs.c
@@ -887,5 +887,4 @@
 			points, getuser(), starttime, endtime-starttime);
 	}
 	threadexitsall(nil);
-	exits(0);
 }
--- a/sys/src/libc/9sys/abort.c
+++ b/sys/src/libc/9sys/abort.c
@@ -1,6 +1,6 @@
 #include <u.h>
 #include <libc.h>
-void
+_Noreturn void
 abort(void)
 {
 	while(*(int*)0)
--- a/sys/src/libc/9sys/sysfatal.c
+++ b/sys/src/libc/9sys/sysfatal.c
@@ -17,7 +17,7 @@
 
 void (*_sysfatal)(char *fmt, va_list arg) = _sysfatalimpl;
 
-void
+_Noreturn void
 sysfatal(char *fmt, ...)
 {
 	va_list arg;
--- a/sys/src/libc/port/exits.c
+++ b/sys/src/libc/port/exits.c
@@ -5,7 +5,7 @@
 
 #pragma profile off
 
-void
+_Noreturn void
 exits(char *s)
 {
 	if(_onexit != nil) (*_onexit)();
--- a/sys/src/libcontrol/scribble.c
+++ b/sys/src/libcontrol/scribble.c
@@ -165,7 +165,6 @@
 	cmd = _ctllookup(cp->args[0], cmds, nelem(cmds));
 	switch(cmd){
 	default:
-		abort();
 		ctlerror("%q: unrecognized message '%s'", b->name, cp->str);
 		break;
 	case EAlign:
--- a/sys/src/libdisk/proto.c
+++ b/sys/src/libdisk/proto.c
@@ -514,7 +514,6 @@
 	if(memchr(p, 0, Blinelen(mkaux->b)) != nil){
 		warn(mkaux, "null bytes in proto");
 		longjmp(mkaux->jmp, 1);
-		return nil;
 	}
 	while((c = *p++) != '\n')
 		if(c == ' ')
--- a/sys/src/libdraw/event.c
+++ b/sys/src/libdraw/event.c
@@ -153,7 +153,6 @@
 	buf[0] = MAXSLAVE;
 	write(epipe[1], buf, 1);
 	_exits(0);
-	return 0;
 }
 
 ulong
@@ -181,7 +180,6 @@
 	t[0] = MAXSLAVE;
 	write(epipe[1], t, 1);
 	_exits(0);
-	return 0;
 }
 
 static void
@@ -359,7 +357,6 @@
 	if(pid != parentpid)
 		return 0;
 	exits("killed");
-	return 1;
 }
 
 static void
--- a/sys/src/libmp/port/mpfmt.c
+++ b/sys/src/libmp/port/mpfmt.c
@@ -243,7 +243,6 @@
 		break;
 	default:
 		abort();
-		return nil;
 	}
 	if(rv < 0){
 		if(alloced)
--- a/sys/src/libmp/port/strtomp.c
+++ b/sys/src/libmp/port/strtomp.c
@@ -191,7 +191,6 @@
 		break;
 	default:
 		abort();
-		return nil;
 	}
 
 	if(pp != nil)
--- a/sys/src/libregexp/regcomp.c
+++ b/sys/src/libregexp/regcomp.c
@@ -69,7 +69,6 @@
 		regerror(error);
 		longjmp(plex->exitenv, 1);
 	}
-	return nil;
 }
 
 static Renode*
--- a/sys/src/libsunrpc/emalloc.c
+++ b/sys/src/libsunrpc/emalloc.c
@@ -10,10 +10,7 @@
 
 	v = mallocz(n, 1);
 	if(v == nil)
-{
-abort();
 		sysfatal("out of memory");
-}
 	setmalloctag(v, getcallerpc(&n));
 	return v;
 }
@@ -23,10 +20,7 @@
 {
 	v = realloc(v, n);
 	if(v == nil)
-{
-abort();
 		sysfatal("out of memory");
-}
 	setrealloctag(v, getcallerpc(&n));
 	return v;
 }
--- a/sys/src/libthread/channel.c
+++ b/sys/src/libthread/channel.c
@@ -311,7 +311,6 @@
 	default:
 		fprint(2, "ERROR: channel alt returned %d\n", r);
 		abort();
-		return -1;
 	}
 }
 
@@ -511,7 +510,6 @@
 		return v;
 	}
 	abort();
-	return nil;
 }
 
 static void
--- a/sys/src/libthread/exit.c
+++ b/sys/src/libthread/exit.c
@@ -6,7 +6,7 @@
 char *_threadexitsallstatus;
 Channel *_threadwaitchan;
 
-void
+_Noreturn void
 threadexits(char *exitstr)
 {
 	Proc *p;
@@ -21,7 +21,7 @@
 	_sched();
 }
 
-void
+_Noreturn void
 threadexitsall(char *exitstr)
 {
 	Proc *p;
--- a/sys/src/libttf/hint.c
+++ b/sys/src/libttf/hint.c
@@ -533,7 +533,7 @@
 	case 0x63: r = (vlong)(int)a * (vlong)(int)b >> 6; break;
 	case 0x8b: r = a < b ? b : a; break;
 	case 0x8c: r = a < b ? a : b; break;
-	default: SET(r); abort();
+	default: abort();
 	}
 	push(h, r);
 }
@@ -553,7 +553,7 @@
 	case 0x66: r = a & -64; break;
 	case 0x67: r = -(-a & -64); break;
 	case 0x68: case 0x69: case 0x6a: case 0x6b: r = ttround(h, a); break;
-	default: SET(r); abort();
+	default: abort();
 	}
 	push(h, r);
 }
--- a/sys/src/libventi/packet.c
+++ b/sys/src/libventi/packet.c
@@ -974,8 +974,6 @@
 static int
 memhead(Mem *m, uchar *rp, int n)
 {
-	fprint(2, "memhead called\n");
-	abort();
 	lock(&m->lk);
 	if(m->rp != rp) {
 		unlock(&m->lk);
@@ -989,8 +987,6 @@
 static int
 memtail(Mem *m, uchar *wp, int n)
 {
-	fprint(2, "memtail called\n");
-	abort();
 	lock(&m->lk);
 	if(m->wp != wp) {
 		unlock(&m->lk);
--- a/sys/src/libventi/rpc.c
+++ b/sys/src/libventi/rpc.c
@@ -168,7 +168,6 @@
 	tag = top[1];
 	if((r = z->wait[tag]) == nil){
 		fprint(2, "libventi: unexpected packet tag %d in vtrpc\n", tag);
-abort();
 		packetfree(p);
 		return;
 	}