]> Cypherpunks repositories - gostls13.git/commitdiff
libbio, libmach: warnings from the Plan 9 tool chain
authorLucio De Re <lucio.dere@gmail.com>
Mon, 7 Apr 2014 15:40:13 +0000 (08:40 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 7 Apr 2014 15:40:13 +0000 (08:40 -0700)
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
src/libbio/bputrune.c
src/libmach/8db.c

index c9c3332e82141dd695126cfb89861c55c6ba0abc..f61409b8a376272c41f3814e47e703461fcb680f 100644 (file)
@@ -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)\
index 0b4745ab4b044d2ebc74da883a68526fd7f05051..f2077958bc8a925ae05c4e97e7710998914b7988 100644 (file)
@@ -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);
index 6e6338bc2ff3678150129d7f93241a4bb27ad32a..e537006cb390ca60ab944b99427ea7fec9b08596 100644 (file)
@@ -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) {