diff options
| author | Dan Cross <cross@gajendra.net> | 2025-07-25 11:20:03 -0400 |
|---|---|---|
| committer | Dan Cross <cross@gajendra.net> | 2025-07-25 11:20:03 -0400 |
| commit | 655f7c3184fe2f1eb039211e689c2fe037fa8320 (patch) | |
| tree | a4b1fc2d8979ffb10ad0647a394331df628ad215 | |
| parent | 5a9ced10ee6abaecb129b0440e211253395588c3 (diff) | |
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.
| -rw-r--r-- | src/cmd/fossil/check.c | 4 | ||||
| -rw-r--r-- | src/lib9p/req.c | 12 | ||||
| -rw-r--r-- | src/lib9p/srv.c | 19 | ||||
| -rw-r--r-- | src/libmach/dwarfpc.c | 6 | ||||
| -rw-r--r-- | src/libmemlayer/draw.c | 6 | ||||
| -rw-r--r-- | src/libsunrpc/server.c | 3 |
6 files changed, 28 insertions, 22 deletions
diff --git a/src/cmd/fossil/check.c b/src/cmd/fossil/check.c index 6aa90fc7..beec846b 100644 --- a/src/cmd/fossil/check.c +++ b/src/cmd/fossil/check.c @@ -293,7 +293,7 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, } if(!(e.flags & VtEntryActive)) continue; -if(0) fprint(2, "%x[%d] tag=%x snap=%d score=%V\n", + if(0)fprint(2, "%x[%d] tag=%x snap=%d score=%V\n", addr, i, e.tag, e.snap, e.score); ep = epoch; if(e.snap != 0){ @@ -599,7 +599,7 @@ chkDir(Fsck *chk, char *name, Source *source, Source *meta) name, o); continue; } -if(0) fprint(2, "source %V:%d block %d addr %d\n", source->score, + if(0)fprint(2, "source %V:%d block %d addr %d\n", source->score, source->offset, o, b->addr); if(b->addr != NilBlock && getBit(chk->errmap, b->addr)) warn(chk, "previously reported error in block %ux is in %s", diff --git a/src/lib9p/req.c b/src/lib9p/req.c index 9acbcdc5..2a868272 100644 --- a/src/lib9p/req.c +++ b/src/lib9p/req.c @@ -58,8 +58,8 @@ allocreq(Reqpool *pool, ulong tag) Req* lookupreq(Reqpool *pool, ulong tag) { -if(chatty9p > 1) - fprint(2, "lookupreq %lud\n", tag); + if(chatty9p > 1) + fprint(2, "lookupreq %lud\n", tag); return lookupkey(pool->map, tag); } @@ -69,8 +69,8 @@ closereq(Req *r) if(r == nil) return; -if(chatty9p > 1) - fprint(2, "closereq %p %ld\n", r, r->ref.ref); + if(chatty9p > 1) + fprint(2, "closereq %p %ld\n", r, r->ref.ref); if(decref(&r->ref) == 0){ if(r->fid) @@ -104,7 +104,7 @@ if(chatty9p > 1) Req* removereq(Reqpool *pool, ulong tag) { -if(chatty9p > 1) - fprint(2, "removereq %lud\n", tag); + if(chatty9p > 1) + fprint(2, "removereq %lud\n", tag); return deletekey(pool->map, tag); } diff --git a/src/lib9p/srv.c b/src/lib9p/srv.c index c3d65479..621d5cf9 100644 --- a/src/lib9p/srv.c +++ b/src/lib9p/srv.c @@ -83,8 +83,8 @@ getreq(Srv *s) r->type = 0; r->srv = s; r->pool = nil; -if(chatty9p) - fprint(2, "<-%d- %F: dup tag\n", s->infd, &f); + if(chatty9p) + fprint(2, "<-%d- %F: dup tag\n", s->infd, &f); return r; } @@ -95,11 +95,12 @@ if(chatty9p) memset(&r->ofcall, 0, sizeof r->ofcall); r->type = r->ifcall.type; -if(chatty9p) - if(r->error) - fprint(2, "<-%d- %F: %s\n", s->infd, &r->ifcall, r->error); - else - fprint(2, "<-%d- %F\n", s->infd, &r->ifcall); + if(chatty9p) { + if(r->error) + fprint(2, "<-%d- %F: %s\n", s->infd, &r->ifcall, r->error); + else + fprint(2, "<-%d- %F\n", s->infd, &r->ifcall); + } return r; } @@ -798,8 +799,8 @@ respond(Req *r, char *error) if(srv->fake) return; -if(chatty9p) - fprint(2, "-%d-> %F\n", srv->outfd, &r->ofcall); + if(chatty9p) + fprint(2, "-%d-> %F\n", srv->outfd, &r->ofcall); qlock(&srv->wlock); n = convS2M(&r->ofcall, srv->wbuf, srv->msize); diff --git a/src/libmach/dwarfpc.c b/src/libmach/dwarfpc.c index 628b3eb8..2360e5ed 100644 --- a/src/libmach/dwarfpc.c +++ b/src/libmach/dwarfpc.c @@ -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; char *files, *dirs, *s; DwarfBuf b; + uintptr bp; DwarfSym sym; State emit, cur, reset; 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.ep = b.p + d->line.len; b.addrsize = sym.b.addrsize; /* should i get this from somewhere else? */ + bp = (uintptr)b.p; 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"); goto bad; } @@ -89,7 +91,7 @@ dwarfpctoline(Dwarf *d, ulong pc, char **cdir, char **dir, char **file, ulong *l } 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"); goto bad; } diff --git a/src/libmemlayer/draw.c b/src/libmemlayer/draw.c index c352a0b2..d6c6c25d 100644 --- a/src/libmemlayer/draw.c +++ b/src/libmemlayer/draw.c @@ -64,7 +64,8 @@ memdraw(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Poi mask = memopaque; if(mask->layer){ -if(drawdebug) iprint("mask->layer != nil\n"); + if(drawdebug) + iprint("mask->layer != nil\n"); 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(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; } diff --git a/src/libsunrpc/server.c b/src/libsunrpc/server.c index b94b7643..b9a644f0 100644 --- a/src/libsunrpc/server.c +++ b/src/libsunrpc/server.c @@ -91,7 +91,8 @@ sunrpcrequestthread(void *v) while((m = recvp(srv->crequest)) != nil){ /* 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; p = m->data; ep = p+m->count; |