all: fix warnings

cpu.c:587:4: warning: ‘n’ may be used uninitialized in this function
cpu.c:659:3: warning: dereferencing type-punned pointer will break strict-aliasing rules
cpu.c:659:3: warning: dereferencing type-punned pointer will break strict-aliasing rules
kern/devaudio.c:238:25: warning: variable ‘in’ set but not used
kern/devaudio.c:240:8: warning: variable ‘a’ set but not used
kern/sysproc.c:14:11: warning: cast to pointer from integer of different size
libc/nsec.c:56:12: warning: implicit declaration of function ‘libstrtoll’
libc/runestrchr.c:16:2: warning: suggest parentheses around assignment used as truth value
libmemdraw/draw.c:2209:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
libmemdraw/draw.c:2224:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
libmemdraw/draw.c:2455:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
libmemdraw/draw.c:2481:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
This commit is contained in:
Giacomo Tesio 2016-01-07 15:17:21 +01:00 committed by David du Colombier
parent 23d9a24788
commit 19a5046403
7 changed files with 12 additions and 15 deletions

View File

@ -6,7 +6,7 @@ AS=as
RANLIB=ranlib
X11=/usr/X11R6
CC=gcc
CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) -O2
CFLAGS=-Wall -Wno-missing-braces -fno-strict-aliasing -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) -O2
O=o
OS=posix
GUI=x11

2
cpu.c
View File

@ -583,7 +583,7 @@ p9any(int fd)
if(write(fd, buf2, strlen(buf2)+1) != strlen(buf2)+1)
fatal(1, "cannot write user/domain choice in p9any");
if(v2){
if(readstr(fd, buf, sizeof buf) < 0)
if((n = readstr(fd, buf, sizeof buf)) < 0)
fatal(1, "cannot read OK in p9any: got %d %s", n, buf);
if(memcmp(buf, "OK\0", 3) != 0)
fatal(1, "did not get OK in p9any");

View File

@ -17,7 +17,10 @@
#define log2 liblog2
#define log liblog
#define reboot libreboot
#ifdef strtoll
#undef strtoll
#define strtoll libstrtoll
#endif
#undef timeradd
#define timeradd xtimeradd

View File

@ -235,12 +235,10 @@ static long
audiowrite(Chan *c, void *vp, long n, vlong off)
{
long m;
int i, v, left, right, in, out;
int i, v, left, right, out;
Cmdbuf *cb;
char *a;
USED(off);
a = vp;
switch((ulong)c->qid.path) {
default:
error(Eperm);
@ -250,7 +248,6 @@ audiowrite(Chan *c, void *vp, long n, vlong off)
v = Vaudio;
left = 1;
right = 1;
in = 1;
out = 1;
cb = parsecmd(vp, n);
if(waserror()){
@ -278,7 +275,6 @@ audiowrite(Chan *c, void *vp, long n, vlong off)
for(m=0; volumes[m].name; m++) {
if(strcmp(cb->f[i], volumes[m].name) == 0) {
v = m;
in = 1;
out = 1;
left = 1;
right = 1;
@ -291,12 +287,10 @@ audiowrite(Chan *c, void *vp, long n, vlong off)
goto cont0;
}
if(strcmp(cb->f[i], "in") == 0) {
in = 1;
out = 0;
goto cont0;
}
if(strcmp(cb->f[i], "out") == 0) {
in = 0;
out = 1;
goto cont0;
}

View File

@ -5,7 +5,7 @@
#include "error.h"
long
sysexits(ulong *arg)
sysexits(uintptr_t *arg)
{
char *status;
char *inval = "invalid exit string";

View File

@ -13,7 +13,7 @@ runestrchr(Rune *s, Rune c)
return s-1;
}
while(c1 = *s++)
while((c1 = *s++))
if(c1 == c0)
return s-1;
return 0;

View File

@ -2206,7 +2206,7 @@ DBG print("dp %p v %lux lm %ux (v ^ *dp) & lm %lux\n", dp, v, lm, (v^*dp)&lm);
case 16:
p[0] = v; /* make little endian */
p[1] = v>>8;
v = *(ushort*)p;
v = *(ushort*)(void*)p;
DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n",
dp, dx, dy, dwid);
for(y=0; y<dy; y++, dp+=dwid)
@ -2221,7 +2221,7 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n",
p[1] = v>>8;
p[2] = v>>16;
p[3] = v>>24;
v = *(ulong*)p;
v = *(ulong*)(void*)p;
for(y=0; y<dy; y++, dp+=dwid)
memsetl(dp, v, dx);
return 1;
@ -2452,7 +2452,7 @@ DBG print("bits %lux sh %d...", bits, i);
break;
case 16:
ws = (ushort*)wp;
v = *(ushort*)sp;
v = *(ushort*)(void*)sp;
for(x=bx; x>ex; x--, ws++){
i = x&7;
if(i == 8-1)
@ -2478,7 +2478,7 @@ DBG print("bits %lux sh %d...", bits, i);
break;
case 32:
wl = (ulong*)wp;
v = *(ulong*)sp;
v = *(ulong*)(void*)sp;
for(x=bx; x>ex; x--, wl++){
i = x&7;
if(i == 8-1)