From 655f7c3184fe2f1eb039211e689c2fe037fa8320 Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Fri, 25 Jul 2025 11:20:03 -0400 Subject: 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. --- src/libmach/dwarfpc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libmach') 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; } -- cgit v1.2.3