From 24192bbd001385ca15ed1f769ddb467e41f4bf9c Mon Sep 17 00:00:00 2001 From: Lucio De Re Date: Mon, 7 Apr 2014 08:40:13 -0700 Subject: [PATCH] libbio, libmach: warnings from the Plan 9 tool chain Superficial inconsistencies that trigger warnings in Plan 9. Small enough to be considered trivial and seemingly benign outside of the Plan 9 environment. LGTM=iant R=golang-codereviews, 0intro, iant CC=golang-codereviews https://golang.org/cl/73460043 --- include/bio.h | 2 +- src/libbio/bputrune.c | 3 ++- src/libmach/8db.c | 57 +++++++++++++++++++++++-------------------- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/include/bio.h b/include/bio.h index c9c3332e82..f61409b8a3 100644 --- a/include/bio.h +++ b/include/bio.h @@ -73,7 +73,7 @@ struct Biobuf * next few bytes in little-endian order. */ #define BGETC(bp)\ - ((bp)->icount?(bp)->ebuf[(bp)->icount++]:Bgetc((bp))) + ((bp)->icount?(int)((bp)->ebuf[(bp)->icount++]):Bgetc((bp))) #define BGETLE2(bp)\ ((bp)->icount<=-2?((bp)->icount+=2,((bp)->ebuf[(bp)->icount-2])|((bp)->ebuf[(bp)->icount-1]<<8)):Bgetle2((bp))) #define BGETLE4(bp)\ diff --git a/src/libbio/bputrune.c b/src/libbio/bputrune.c index 0b4745ab4b..f2077958bc 100644 --- a/src/libbio/bputrune.c +++ b/src/libbio/bputrune.c @@ -36,7 +36,8 @@ Bputrune(Biobuf *bp, long c) rune = (Rune)c; if(rune < Runeself) { - BPUTC(bp, (int)rune); + n = BPUTC(bp, (int)rune); + USED(n); return 1; } n = runetochar(str, &rune); diff --git a/src/libmach/8db.c b/src/libmach/8db.c index 6e6338bc2f..e537006cb3 100644 --- a/src/libmach/8db.c +++ b/src/libmach/8db.c @@ -195,33 +195,36 @@ i386trace(Map *map, uvlong pc, uvlong sp, uvlong link, Tracer trace) break; if(s.value == morestack) { - // This code is old and won't work anymore. - // But no one uses it anyway. - // Leave it obviously broken until someone needs it. - werrstr("morestack not implemented correctly"); - return -1; - // In the middle of morestack. - // Caller is m->morepc. - // Caller's caller is in m->morearg. - // TODO(rsc): 386 - geta(map, offsetof(struct UregAmd64, r14), &m); - - pc = 0; - sp = 0; - pc1 = 0; - s1 = s; - memset(&s, 0, sizeof s); - geta(map, m+1*mach->szaddr, &pc1); // m->morepc - geta(map, m+2*mach->szaddr, &sp); // m->morebuf.sp - geta(map, m+3*mach->szaddr, &pc); // m->morebuf.pc - findsym(pc1, CTEXT, &s); - (*trace)(map, pc1, sp-mach->szaddr, &s1); // morestack symbol; caller's PC/SP - - // caller's caller - s1 = s; - findsym(pc, CTEXT, &s); - (*trace)(map, pc, sp, &s1); // morestack's caller; caller's caller's PC/SP - continue; + if (0) { + // This code is old and won't work anymore. + // But no one uses it anyway. + // Leave it obviously broken until someone needs it. + // In the middle of morestack. + // Caller is m->morepc. + // Caller's caller is in m->morearg. + // TODO(rsc): 386 + geta(map, offsetof(struct UregAmd64, r14), &m); + + pc = 0; + sp = 0; + pc1 = 0; + s1 = s; + memset(&s, 0, sizeof s); + geta(map, m+1*mach->szaddr, &pc1); // m->morepc + geta(map, m+2*mach->szaddr, &sp); // m->morebuf.sp + geta(map, m+3*mach->szaddr, &pc); // m->morebuf.pc + findsym(pc1, CTEXT, &s); + (*trace)(map, pc1, sp-mach->szaddr, &s1); // morestack symbol; caller's PC/SP + + // caller's caller + s1 = s; + findsym(pc, CTEXT, &s); + (*trace)(map, pc, sp, &s1); // morestack's caller; caller's caller's PC/SP + continue; + } else { + werrstr("morestack not implemented correctly"); + return -1; + } } if(pc == lessstack) { -- 2.50.0