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

This commit is contained in:
Jacob Moody 2024-01-28 03:36:41 +00:00
parent 6b0574e27e
commit 8a234e57b9
120 changed files with 88 additions and 244 deletions

View file

@ -98,7 +98,6 @@ command(Window *w, char *s)
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");

View file

@ -52,7 +52,6 @@ pipecommand(Window *w, char *s)
if(strcmp(s, "Delete")==0){
windel(w, 1);
threadexits(nil);
return 1;
}
if(strcmp(s, "Del")==0){
if(windel(w, 0))

View file

@ -31,9 +31,9 @@ extern void *calloc(size_t, size_t);
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 *);

View file

@ -90,7 +90,7 @@ extern int execle(const char *, const char *, const char *, ...);
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);

View file

@ -416,7 +416,7 @@ extern int dec16chr(int);
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 char* getwd(char*, int);
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 long strtol(char*, char**, int);
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 @@ struct IOchunk
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);

View file

@ -87,8 +87,8 @@ int sendp(Channel *c, void *v);
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 */

View file

@ -123,5 +123,4 @@ main(int argc, char **argv)
else
exits(w->msg);
}
assert(0);
}

View file

@ -160,7 +160,7 @@ extern vlong _NSEC(void);
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);

View file

@ -2,7 +2,7 @@
#include <unistd.h>
#include <signal.h>
void
_Noreturn void
abort(void)
{
kill(getpid(), SIGABRT);

View file

@ -10,7 +10,7 @@ int _sessleader = 0;
static char exitstatus[ERRMAX];
void
_Noreturn void
_exit(int status)
{
_finish(status, 0);

View file

@ -100,7 +100,6 @@ fpaoperation(u32int instr)
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;

View file

@ -281,5 +281,4 @@ vaddr(ulong addr)
}
Bprint(bioout, "User TLB miss vaddr 0x%.8lux\n", addr);
longjmp(errjmp, 0);
return 0; /*to stop compiler whining*/
}

View file

@ -286,7 +286,6 @@ shutdown(void*, char *msg)
threadexitsall(msg);
print("acme: %s\n", msg);
abort();
return 0;
}
void

View file

@ -1206,5 +1206,4 @@ armalloc(int n)
} while (getspace());
fprint(2, "ar: out of memory\n");
exits("malloc");
return 0;
}

View file

@ -169,7 +169,6 @@ value(int c, int f)
return(-1);
fprint(2, "%s: bad input char %c\n", argv0, c);
exits("bad");
return 0; /* to keep ken happy */
}
int
isnum(char *s)

View file

@ -569,7 +569,6 @@ mkdesc(char *f)
return d;
Bad:
sysfatal("bad format: %s", f);
return d;
}
int
@ -608,8 +607,8 @@ main(int argc, char *argv[])
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;

View file

@ -37,7 +37,6 @@ tag(Tagctx *ctx, int t, const char *k, const char *v, int offset, int size, Tagr
if(image){
if(t != Timage)
return;
prog = nil;
if(strcmp(v, "image/jpeg") == 0)
prog = "jpg";
else if(strcmp(v, "image/png") == 0)

View file

@ -53,7 +53,6 @@ main(void)
dup(pfd[0], 0);
execl("/bin/audio/pcmconv", "pcmconv", "-i", fmt, nil);
sysfatal("exec: %r");
return;
}
close(pfd[0]);
}

View file

@ -235,7 +235,6 @@ getcol(Meta *m, int c)
static char tmp[32];
char *s;
s = nil;
switch(c){
case Palbum: s = m->album; break;
case Partist: s = m->artist[0]; break;

View file

@ -271,10 +271,8 @@ endpoints(void)
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;
}

View file

@ -343,10 +343,8 @@ mkasn1(uchar *asn1, char *alg, uchar *d, uint dlen)
}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 */

View file

@ -36,7 +36,6 @@ main(int argc, char **argv)
if(argc > 1)
usage();
n = -1;
if((k = getrsakey(argc, argv, privatekey, nil)) == nil)
sysfatal("%r");
if(privatekey){

View file

@ -149,5 +149,4 @@ main(int argc, char **argv)
if(Bflush(&bout) != 0)
sysfatal("write: %r");
exits(nil);
return 1; /* keep other compilers happy */
}

View file

@ -268,8 +268,6 @@ mail(Fs *f, char *rcvr, char *user, long et)
/* just in case */
sysfatal("can't exec send: %r");
return 0; /* for compiler */
}
void

View file

@ -127,7 +127,6 @@ main(int argc, char **argv)
relocs = 1;
break;
default:
SET(arch, chars);
sysfatal("archloch");
}
szofdat = fhdr.txtsz + fhdr.datsz;

View file

@ -35,7 +35,6 @@ putc3(uchar *buff, ulong v)
fprint(2, "%s: putc3 fail 0x%lux, called from %#p\n", prog, v, getcallerpc(&buff));
abort();
return -1;
}
int

View file

@ -555,7 +555,6 @@ otherlen(int a)
else if(a == 4)
return 2;
abort();
return 0;
}
void

View file

@ -126,7 +126,6 @@ bar(Biobuf *b)
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");
}

View file

@ -83,7 +83,6 @@ msg(Biobuf *b)
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");
}

View file

@ -241,10 +241,8 @@ buildrsne(uchar rsne[258])
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 @@ trunc: sysfatal("invalid or truncated RSNE; brsne: %s", buf);
*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 @@ trunc: sysfatal("invalid or truncated RSNE; brsne: %s", buf);
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 @@ trunc: sysfatal("invalid or truncated RSNE; brsne: %s", buf);
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 @@ trunc: sysfatal("invalid or truncated RSNE; brsne: %s", buf);
}
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 @@ background(void)
exits(nil);
case -1:
sysfatal("fork: %r");
return;
case 0:
break;
}

View file

@ -84,7 +84,6 @@ blockread(int in, char *first, int nfirst)
break;
}
_exits(0);
return -1;
}
void

View file

@ -104,5 +104,4 @@ unbflz(int in)
close(in);
close(out);
_exits(0);
return -1;
}

View file

@ -165,7 +165,6 @@ unbzip(int in)
_unbzip(in, out);
_exits(0);
return -1; /* not reached */
}
int bz_config_ok ( void )

View file

@ -16,7 +16,6 @@ main(int argc, char *argv[])
usage:
fprint(2, "usage: chgrp [ -uo ] group file ....\n");
exits("usage");
return;
case 'u':
case 'o':
uflag++;

View file

@ -173,5 +173,4 @@ openfil(char *s)
return b;
fprint(2,"comm: cannot open %s: %r\n",s);
exits("open");
return 0; /* shut up ken */
}

View file

@ -34,7 +34,6 @@ main(int argc, char **argv)
flushout();
fflush(stderr);
exits(nerrs? "errors" : 0);
return 0;
}
void

View file

@ -1453,7 +1453,6 @@ loop:
goto loop;
}
exits(0);
return 0; /* shut up ken */
}
void

View file

@ -114,10 +114,8 @@ prepare(Diff *d, int i, char *arg, char *orig)
} 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));

View file

@ -36,10 +36,8 @@ erealloc(void *p, unsigned n)
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 @@ mktmpfile(int input, Dir **sb)
* 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 @@ statfile(char *file, Dir **sb)
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

View file

@ -101,10 +101,8 @@ adddirec(Direc *root, char *name, XDir *d)
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

View file

@ -368,10 +368,8 @@ getblock(Disk *disk, vlong addr)
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);

View file

@ -293,7 +293,6 @@ editquit(Edit *edit, int argc, char**)
}
exits(0);
return nil; /* not reached */
}
char*

View file

@ -60,7 +60,7 @@ Edit edit = {
* Catch the obvious error routines to fix up the disk.
*/
void
sysfatal(char *fmt, ...)
diskfatal(char *fmt, ...)
{
char buf[1024];
va_list arg;
@ -79,11 +79,25 @@ sysfatal(char *fmt, ...)
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
@ -375,9 +389,9 @@ static void
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 @@ mkpart(char *name, vlong lba, vlong size, Tentry *t, vlong ebrstart, int ebrtype
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 @@ addrecover(Table t, ulong lba)
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 @@ findmbr(Edit *edit)
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 @@ plan9print(Dospart *part, int fd)
sep = "";
i = 0;
name = emalloc(strlen(vname)+10);
name = errmalloc(strlen(vname)+10);
sprint(name, "%s", vname);
do {
@ -707,7 +721,7 @@ plan9print(Dospart *part, int fd)
}
} while(ok == 0);
n = emalloc(sizeof(*n));
n = errmalloc(sizeof(*n));
n->name = name;
n->link = namelist;
namelist = n;
@ -1130,7 +1144,7 @@ wrpart(Edit *edit)
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);

View file

@ -378,10 +378,10 @@ receval(Node *n, uchar *p, uchar *e, Enab *en)
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 @@ receval(Node *n, uchar *p, uchar *e, Enab *en)
}
default:
sysfatal("receval: unknown type %α", n->type);
return mkval(VALINT, 0LL);
}
}

View file

@ -182,7 +182,7 @@ egen(Node *n)
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 @@ egen(Node *n)
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 @@ egen(Node *n)
}
case ORECORD:
case OSTR:
default: sysfatal("egen: unknown type %α", n->type); return 0;
default: sysfatal("egen: unknown type %α", n->type);
}
}
@ -307,7 +307,7 @@ tracegen(Node *n, DTActGr *g, int *recoff)
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;
}

View file

@ -385,10 +385,10 @@ type(int typ, ...)
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);
}
}

View file

@ -205,7 +205,6 @@ evalop(int op, int sign, vlong v1, vlong v2)
case OPLOR: return v1 || v2; break;
default:
sysfatal("cfold: unknown op %.2x", op);
return 0;
}
}
@ -289,7 +288,7 @@ calcrecsize(Node *n)
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 @@ calcrecsize(Node *n)
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 @@ insrecord(Node *n)
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;
}

View file

@ -605,7 +605,6 @@ openmount(int sfd)
arg[0] = "/bin/exportfs";
exec(arg[0], arg);
_exits("whoops: exec failed");
return -1;
}
void

View file

@ -246,7 +246,6 @@ lex(char **s)
return t;
}
sysfatal("syntax error at %s", *s);
return nil;
}
void

View file

@ -1217,10 +1217,8 @@ indexpack(char *pack, char *idx, Hash ph)
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)

View file

@ -536,7 +536,6 @@ findCDir(Biobuf *bin, char *file)
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 @@ findCDir(Biobuf *bin, char *file)
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 @@ findCDir(Biobuf *bin, char *file)
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;

View file

@ -50,10 +50,8 @@ void*
erealloc(void *v, ulong sz)
{
v = realloc(v, sz);
if(v == nil){
if(v == nil)
sysfatal("realloc: %r");
threadexitsall("memory");
}
return v;
}

View file

@ -194,10 +194,8 @@ top:
goto top;
}
r = c;
}else{
r = 0;
}else
sysfatal("getrune - can't happen");
}
if(r == '\n')
istack->lineno++;
return r;

View file

@ -165,7 +165,6 @@ setup(int *v6net, int *tunp)
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)

View file

@ -339,7 +339,6 @@ setup(int *v6net)
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)

View file

@ -87,12 +87,10 @@ receive(uchar *h, uchar *e)
&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;

View file

@ -253,7 +253,6 @@ kaproc(void)
}
_exits(0);
return -1;
}
void

View file

@ -131,7 +131,6 @@ main(int argc, char **argv)
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);

View file

@ -701,7 +701,6 @@ thread(void(*f)(void*), void *a)
return pid;
(*f)(a);
_exits(nil);
return 0; // never reaches here
}
void

View file

@ -251,7 +251,6 @@ _filterpkt(Filter *f, Msg *m)
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)

View file

@ -628,7 +628,6 @@ conssim(void)
close(fd);
}
exits(0);
return -1;
}
int

View file

@ -144,10 +144,8 @@ zread(void *va)
}
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 @@ readslave(Biobuf *b)
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 @@ readslave(Biobuf *b)
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)

View file

@ -566,7 +566,6 @@ gifmalloc(ulong sz)
v = malloc(sz);
if(v == nil) {
fprint(2, "WriteGIF: out of memory allocating %ld\n", sz);
abort();
exits("mem");
}
memset(v, 0, sz);

View file

@ -236,5 +236,4 @@ vaddr(ulong addr)
}
Bprint(bioout, "data_access_MMU_miss [addr 0x%.8lux]\n", addr);
longjmp(errjmp, 0);
return 0; /*to stop compiler whining*/
}

View file

@ -437,7 +437,6 @@ extern ulong target;
RR* getdnsservers(int);
void abort(); /* char*, ... */;
void addserver(Server**, char*);
int bslashfmt(Fmt*);
Server* copyserverlist(Server*);

View file

@ -333,7 +333,6 @@ hunk:
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 @@ char*
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 @@ search(Fbuf *f, Hunk *h, char *fname)
}
}
sysfatal("%s:%d: unable to find hunk offset in %s", fname, h->lnum, h->oldpath);
return nil;
}
char*

View file

@ -66,10 +66,8 @@ main(int argc, char *argv[])
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];
}

View file

@ -468,7 +468,6 @@ fcmp(ulong ir)
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);
}

View file

@ -267,5 +267,4 @@ vaddr(ulong addr)
}
Bprint(bioout, "data_access_MMU_miss [addr 0x%.8lux]\n", addr);
longjmp(errjmp, 0);
return 0; /*to stop compiler whining*/
}

View file

@ -335,8 +335,6 @@ shutdown(void *, char *msg)
}
fprint(2, "rio %d: abort: %s\n", getpid(), msg);
abort();
exits(msg);
return 0;
}
void

View file

@ -228,7 +228,6 @@ send(int fd)
write(fd, buf, 0);
exits(0);
return 0; /* to keep compiler happy */
}
void

View file

@ -235,7 +235,6 @@ out:
return t != TEOF;
syntax:
sysfatal("syntax error");
return 0;
}
int oneflag, multiflag;

View file

@ -40,7 +40,6 @@ static int no_box;
extern int ntrail, s_trail, pno, depth;
extern Symbol *oFname;
extern void exit(int);
extern void putpostlude(void);
static void putpages(void);

View file

@ -95,7 +95,6 @@ void a_stats(void);
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);

View file

@ -273,10 +273,8 @@ sendpkt(char *fmt, ...)
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 @@ dispatch(void)
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;

View file

@ -358,10 +358,8 @@ sendpkt(char *fmt, ...)
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;

View file

@ -169,7 +169,6 @@ rdmagic(void)
return rdsysiii;
sysfatal("Out of phase--get MERT help");
return nil;
}
void

View file

@ -181,7 +181,6 @@ conv(char *name, int from)
return(c);
}
sysfatal("charset `%s' unknown", name);
return(0); /* just shut the compiler up */
}
static int

View file

@ -490,7 +490,6 @@ setnum(Biobuf *b, char *name, int min, int max)
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

View file

@ -18,7 +18,6 @@ main(int argc, char *argv[])
mtpt = argv[2];
break;
default:
SET(mnted, mtpt);
fprint(2, "usage: unmount mountpoint\n");
fprint(2, " unmount mounted mountpoint\n");
exits("usage");

View file

@ -743,7 +743,6 @@ egetnum(Biobuf *b, int want, jmp_buf jb)
}
werrstr("unexpected eof");
longjmp(jb, 1);
return -1;
}
Dreprog*

View file

@ -34,7 +34,6 @@ getfolder(Biobuf *out)
return f;
}
sysfatal("folder.c:ftab too small");
return 0;
}
static int

View file

@ -51,7 +51,6 @@ opendeliver(int *pip, char *folder, char *from, long t)
exec("/bin/upas/mbappend", av);
ilog("exec: %r");
_exits("b0rked");
return -1;
default:
*pip = fd[0];
close(fd[1]);

View file

@ -21,7 +21,6 @@ openpipe(int *pip, char *cmd, char *av[])
exec(cmd, av);
ilog("exec: %r");
_exits("b0rked");
return -1;
default:
*pip = fd[0];
close(fd[1]);

View file

@ -157,9 +157,6 @@ startmailer(char *name)
av[ac] = 0;
exec("/bin/upas/send", av);
sysfatal("execing mailer: %r");
/* not reached */
return -1;
}
void

View file

@ -488,7 +488,6 @@ quitcmd(char*)
{
synccmd(nil);
exits(nil);
return 0;
}
static int

View file

@ -28,7 +28,6 @@ refuse(dest*, message *, char *cp, int, int)
{
fprint(2, "%s\n", cp);
exits("error");
return 0;
}
void

View file

@ -474,7 +474,6 @@ hello(String *himp, int extended)
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)

View file

@ -131,7 +131,6 @@ loadexcludefile(char *file)
continue;
}
inc = 0;
if(strncmp(p, "include ", 8) == 0){
inc = 1;
}else if(strncmp(p, "exclude ", 8) == 0){

View file

@ -162,7 +162,6 @@ walk(uchar score[VtScoreSize], uint type, int base)
}
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);
}

View file

@ -235,7 +235,6 @@ _packarena(Arena *arena, u8int *buf, int forceext)
break;
default:
sysfatal("packarena unknown version %d", arena->version);
return -1;
}
p = buf;
@ -370,7 +369,6 @@ packarenahead(ArenaHead *head, u8int *buf)
break;
default:
sysfatal("packarenahead unknown version %d", head->version);
return -1;
}
p = buf;

View file

@ -1472,7 +1472,6 @@ opirr(int a)
case AADDVU: return SP(3,1);
}
diag("bad irr %d", a);
abort();
return 0;
}

View file

@ -691,7 +691,6 @@ obsdcmdline(int argc, char **argv)
usage:
fprint(2, "openbsd cmdline usage: kernel [-asdc] [var=value ...]\nsupported vars: device tty db_console\n");
threadexitsall("usage");
return 0;
}
static int

View file

@ -74,7 +74,6 @@ main(int argc, char *argv[])
Binit(&bout, 1, OWRITE);
Blethal(&bout, nil);
err = 0;
ap = 0;
while(argc>1 && argv[1][0]=='-' && argv[1][1]){
--argc;
argv++;

View file

@ -133,7 +133,6 @@ getcmd(char *l)
return cmd;
}
sysfatal("getcmd: no such command %s", l);
return NOCMD;
}
void

View file

@ -551,5 +551,4 @@ step(void)
case 0xff: return call(0x38, -1);
}
sysfatal("undefined opcode %#.2x at pc=%#.4x", op, curpc);
return 0;
}

View file

@ -150,7 +150,6 @@ typename(char *s, int type, int size)
break;
default:
sysfatal("typestr: unknown type %d -- shouldn't happen", type);
return;
}
snprint(s, BACKTYPELEN, "%s%d%s", st, size/128, id);
}

View file

@ -325,7 +325,6 @@ checknext(int dir, int x, int y)
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

View file

@ -45,7 +45,6 @@ regread(u16int a)
return (~z80bus & BUSACK) >> 1;
}
sysfatal("read from 0xa1%.4ux (pc=%#.6ux)", a, curpc);
return 0;
}
void
@ -191,7 +190,6 @@ memread(u32int a)
default:
invalid:
sysfatal("read from %#.6ux (pc=%#.6ux)", a, curpc);
return 0;
}
}

View file

@ -503,7 +503,6 @@ ed(void)
case 0x4f: return 9;
}
sysfatal("undefined z80 opcode ed%.2x at pc=%#.4x", op, scurpc);
return 0;
}
static int
@ -579,7 +578,6 @@ index(int n)
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 @@ z80step(void)
case 0xff: return call(0x38, 1);
}
sysfatal("undefined z80 opcode %#.2x at pc=%#.4x", op, scurpc);
return 0;
}

Some files were not shown because too many files have changed in this diff Show more