]> Cypherpunks repositories - gostls13.git/commitdiff
fix compiler warnings
authorRuss Cox <rsc@golang.org>
Mon, 20 Oct 2008 22:26:38 +0000 (15:26 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 20 Oct 2008 22:26:38 +0000 (15:26 -0700)
R=r
DELTA=44  (10 added, 9 deleted, 25 changed)
OCL=17502
CL=17502

src/cmd/6c/list.c
src/cmd/ar/ar.c
src/cmd/gc/dcl.c
src/cmd/gc/subr.c
src/libmach_amd64/8db.c
src/libmach_amd64/darwin.c
src/libmach_amd64/linux.c
src/libmach_amd64/map.c

index 094f5a2064d4ae0600f895478f2ff4b54d4e94db..e3a0ea81b42fac89c14fcecb2ce9de9fba45551a 100644 (file)
@@ -92,7 +92,7 @@ Pconv(Fmt *fp)
                        p->as, &p->from, &p->to);
                break;
 
-       defaul:
+       default:
                sprint(str, "   %A      %D,%lD", p->as, &p->from, &p->to);
                break;
        }
index 323103bcb17ac6c6e5bc53b1aad0da46397288d1..aeccc8e57308bd08fcae9a99f50628f3bc25ebaa 100644 (file)
@@ -779,7 +779,6 @@ int
 duplicate(char *name)
 {
        Hashchain *p;
-       char *cp;
        int h;
 
        h = hashstr(name) % NHASH;
@@ -1602,8 +1601,7 @@ parsepkgdata(char **pp, char *ep, int *exportp, char **prefixp, char **namep, ch
 int
 parsemethod(char **pp, char *ep, char **methp)
 {
-       char *p, *prefix, *name, *def;
-       int n;
+       char *p;
        
        // skip white space
        p = *pp;
@@ -1664,16 +1662,15 @@ strappend(char *s, char *t)
 void
 getpkgdef(char **datap, int *lenp)
 {
-       Fmt f;
        int i, j, len;
-       char *data, *p, *ep;
+       char *data, *p;
        Import **all, *x;
 
        // make a list of all the exports and count string sizes
        all = armalloc(nimport*sizeof all[0]);
        j = 0;
        len = 7 + 3 + strlen(pkgstmt) + 1;      // import\n$$\npkgstmt\n
-       for(i=0; i<NHASH; i++) {
+       for(i=0; i<NIHASH; i++) {
                for(x=ihash[i]; x; x=x->hash) {
                        all[j++] = x;
                        len += strlen(x->prefix) + 1
index 95f4e020cb7c66311bc62011b90a673bd3050eb7..7eed70e807de89537361819ca52e695eb181a964 100644 (file)
@@ -1120,7 +1120,7 @@ defercheckwidth(void)
 void
 resumecheckwidth(void)
 {
-       TypeList *l, *next;
+       TypeList *l;
 
        if(!defercalc)
                fatal("restartcheckwidth");
index c086aeb8541fb47589dcb852d2161f40ab8b3b57..3953ca20c1776df5402bda9547f81d8d38259abd 100644 (file)
@@ -1351,7 +1351,6 @@ wnames[] =
 int
 Wconv(Fmt *fp)
 {
-       char buf[500];
        int w;
 
        w = va_arg(fp->args, int);
index d4ee633ff4f8f582e89821420a26a81e4d0ac69e..040dd1e8616498c246023404b87521214ba17b93 100644 (file)
@@ -1364,7 +1364,7 @@ igetl(Map *map, Instr *ip, uint32 *lp)
 
 /*
  *  get 8 bytes of the instruction
- */
+ *
 static int
 igetq(Map *map, Instr *ip, vlong *qp)
 {
@@ -1380,6 +1380,7 @@ igetq(Map *map, Instr *ip, vlong *qp)
        *qp = q;
        return 1;
 }
+ */
 
 static int
 getdisp(Map *map, Instr *ip, int mod, int rm, int code, int pcrel)
@@ -1958,11 +1959,11 @@ pea(Instr *ip)
 {
        if (ip->mod == 3) {
                if (ip->osize == 'B')
-                       bprint(ip, (ip->rex & REXB? breg64: breg)[ip->base]);
+                       bprint(ip, (ip->rex & REXB? breg64: breg)[(uchar)ip->base]);
                else if(ip->rex & REXB)
                        bprint(ip, "%s%s", ANAME(ip), reg[ip->base+8]);
                else
-                       bprint(ip, "%s%s", ANAME(ip), reg[ip->base]);
+                       bprint(ip, "%s%s", ANAME(ip), reg[(uchar)ip->base]);
                return;
        }
        if (ip->segment)
index f210f25a94a9d5428fe42362c326bd3b4ff6c9f6..e9e9bddc70bf1bb96ece47c9c071e44213634b2b 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/ptrace.h>
 #include <sys/signal.h>
 #include <mach/mach.h>
+#include <mach/mach_traps.h>
 #include <errno.h>
 #include <libc.h>
 #include <bio.h>
@@ -31,6 +32,8 @@
 #include <ureg_amd64.h>
 typedef struct Ureg Ureg;
 
+extern mach_port_t mach_reply_port(void);      // should be in system headers, is not
+
 // Mach-error wrapper.
 // Takes a mach return code and converts it into 0 / -1,
 // setting errstr when it returns -1.
@@ -197,7 +200,7 @@ enum {
 static Thread*
 addpid(int pid, int force)
 {
-       int i, j, r;
+       int i, j;
        mach_port_t task;
        mach_port_t *thread;
        uint nthread;
@@ -276,6 +279,7 @@ idtotable(int id)
        return &thr[id];
 }
 
+/*
 static int
 idtopid(int id)
 {
@@ -285,6 +289,7 @@ idtopid(int id)
                return -1;
        return t->pid;
 }
+*/
 
 static mach_port_t
 idtotask(int id)
@@ -388,7 +393,6 @@ proctextfile(int pid)
 static int
 machsegrw(Map *map, Seg *seg, uvlong addr, void *v, uint n, int isr)
 {
-       uintptr nn;
        mach_port_t task;
        int r;
 
@@ -397,6 +401,7 @@ machsegrw(Map *map, Seg *seg, uvlong addr, void *v, uint n, int isr)
                return -1;
 
        if(isr){
+               vm_size_t nn;
                nn = n;
                if(me(vm_read_overwrite(task, addr, n, (uintptr)v, &nn)) < 0)
                        return -1;
@@ -477,7 +482,7 @@ machregrw(Map *map, Seg *seg, uvlong addr, void *v, uint n, int isr)
 {
        uint nn;
        mach_port_t thread;
-       int reg, r;
+       int reg;
        union {
                x86_thread_state64_t regs;
                uchar p[1];
@@ -547,7 +552,6 @@ threadstopped(Thread *t)
 {
        struct thread_basic_info info;
        uint size;
-       int r;
 
        size = sizeof info;
        if(me(thread_info(t->thread, THREAD_BASIC_INFO, (thread_info_t)&info, &size)) <  0){
@@ -568,7 +572,7 @@ threadstart(Thread *t, int singlestep)
        x86_thread_state64_t regs;
 
        if(!threadstopped(t))
-               return;
+               return 0;
 
        // Set or clear the processor single-step flag, as appropriate.
        n = x86_THREAD_STATE64_COUNT;
@@ -667,7 +671,7 @@ int
 ctlproc(int id, char *msg)
 {
        Thread *t;
-       int status, r;
+       int status;
 
        // Hang/attached dance is for debugging newly exec'ed programs.
        // After fork, the child does ctlproc("hang") before exec,
index ff4012081b8c9187680117a797d18acea1e2462f..4fb5d49ba308516a9b2018af88261f3e2db47667 100644 (file)
@@ -30,6 +30,7 @@
 #include <u.h>
 #include <sys/ptrace.h>
 #include <sys/signal.h>
+#include <sys/wait.h>
 #include <errno.h>
 #include <libc.h>
 #include <bio.h>
@@ -132,9 +133,7 @@ ptraceattach(int pid)
 Map*
 attachproc(int pid, Fhdr *fp)
 {
-       char buf[64];
        Map *map;
-       vlong n;
 
        if(ptraceattach(pid) < 0)
                return nil;
@@ -264,7 +263,7 @@ procnotes(int pid, char ***pnotes)
 int
 ctlproc(int pid, char *msg)
 {
-       int i, p, status;
+       int i;
 
        if(strcmp(msg, "attached") == 0){
                for(i=0; i<nattached; i++)
index eb7eaf999054b00ae9408e9be7b82768f6d528fc..747969335f76b4ee3c5090f4c1179d488ed1ebb7 100644 (file)
@@ -80,6 +80,7 @@ setmap(Map *map, int fd, uvlong b, uvlong e, vlong f, char *name, Maprw *rw)
        return 1;
 }
 
+/*
 static uvlong
 stacktop(int pid)
 {
@@ -110,6 +111,7 @@ stacktop(int pid)
                return 0;
        return strtoull(cp, 0, 16);
 }
+*/
 
 int
 findseg(Map *map, char *name)