all: clean up misleading indentation warnings

Misleading indentation warnings are actually useful, as they
will occasionally reveal actual bugs (cf the apple `goto fail`
security bug from a few years ago).  Newer versions of clang
(at least) are more aggressive about warnings in this regard,
which has exposed a few warnings that are annoying.  However,
they are easy to address.
This commit is contained in:
Dan Cross
2025-07-25 11:20:03 -04:00
parent 5a9ced10ee
commit 655f7c3184
6 changed files with 28 additions and 22 deletions

View File

@@ -95,11 +95,12 @@ if(chatty9p)
memset(&r->ofcall, 0, sizeof r->ofcall); memset(&r->ofcall, 0, sizeof r->ofcall);
r->type = r->ifcall.type; r->type = r->ifcall.type;
if(chatty9p) if(chatty9p) {
if(r->error) if(r->error)
fprint(2, "<-%d- %F: %s\n", s->infd, &r->ifcall, r->error); fprint(2, "<-%d- %F: %s\n", s->infd, &r->ifcall, r->error);
else else
fprint(2, "<-%d- %F\n", s->infd, &r->ifcall); fprint(2, "<-%d- %F\n", s->infd, &r->ifcall);
}
return r; return r;
} }

View File

@@ -47,6 +47,7 @@ dwarfpctoline(Dwarf *d, ulong pc, char **cdir, char **dir, char **file, ulong *l
int i, first, op, a, l, quantum, isstmt, linebase, linerange, opcodebase, nf; int i, first, op, a, l, quantum, isstmt, linebase, linerange, opcodebase, nf;
char *files, *dirs, *s; char *files, *dirs, *s;
DwarfBuf b; DwarfBuf b;
uintptr bp;
DwarfSym sym; DwarfSym sym;
State emit, cur, reset; State emit, cur, reset;
uchar **f, **newf; uchar **f, **newf;
@@ -74,9 +75,10 @@ dwarfpctoline(Dwarf *d, ulong pc, char **cdir, char **dir, char **file, ulong *l
b.p = d->line.data + off; b.p = d->line.data + off;
b.ep = b.p + d->line.len; b.ep = b.p + d->line.len;
b.addrsize = sym.b.addrsize; /* should i get this from somewhere else? */ b.addrsize = sym.b.addrsize; /* should i get this from somewhere else? */
bp = (uintptr)b.p;
len = dwarfget4(&b); len = dwarfget4(&b);
if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){ if(b.p==nil || b.p+len > b.ep || bp+len < bp){
fprint(2, "bad len\n"); fprint(2, "bad len\n");
goto bad; goto bad;
} }
@@ -89,7 +91,7 @@ dwarfpctoline(Dwarf *d, ulong pc, char **cdir, char **dir, char **file, ulong *l
} }
len = dwarfget4(&b); len = dwarfget4(&b);
if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){ if(b.p==nil || b.p+len > b.ep || bp+len < bp){
fprint(2, "another bad len\n"); fprint(2, "another bad len\n");
goto bad; goto bad;
} }

View File

@@ -64,7 +64,8 @@ memdraw(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Poi
mask = memopaque; mask = memopaque;
if(mask->layer){ if(mask->layer){
if(drawdebug) iprint("mask->layer != nil\n"); if(drawdebug)
iprint("mask->layer != nil\n");
return; /* too hard, at least for now */ return; /* too hard, at least for now */
} }
@@ -75,7 +76,8 @@ if(drawdebug) iprint("mask->layer != nil\n");
} }
if(drawclip(dst, &r, src, &p0, mask, &p1, &srcr, &mr) == 0){ if(drawclip(dst, &r, src, &p0, mask, &p1, &srcr, &mr) == 0){
if(drawdebug) iprint("drawclip dstcr %R srccr %R maskcr %R\n", dst->clipr, src->clipr, mask->clipr); if(drawdebug)
iprint("drawclip dstcr %R srccr %R maskcr %R\n", dst->clipr, src->clipr, mask->clipr);
return; return;
} }

View File

@@ -91,7 +91,8 @@ sunrpcrequestthread(void *v)
while((m = recvp(srv->crequest)) != nil){ while((m = recvp(srv->crequest)) != nil){
/* could look up in cache here? */ /* could look up in cache here? */
if(srv->chatty) fprint(2, "sun msg %p count %d\n", m, m->count); if(srv->chatty)
fprint(2, "sun msg %p count %d\n", m, m->count);
m->srv = srv; m->srv = srv;
p = m->data; p = m->data;
ep = p+m->count; ep = p+m->count;