Commit 28912ce0 authored by Russ Cox's avatar Russ Cox

fix compiler warnings

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