RE: [parisc-linux] Cast of lvalue warning in the last k 2.6.5-rc2 with last gcc-3.3 (next)

Joel Soete soete.joel at tiscali.be
Wed Mar 24 08:54:52 MST 2004


Hi all,


>PS2: still have to make the same exercise for:
>  gcc -Wp,-MD,arch/parisc/lib/.io.o.d -nostdinc -iwithprefix include >-D__KERNEL__
>-Iinclude  -D__KERNEL__ -Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs
>-fno-strict-aliasin
>  -fno-common -pipe -mno-space-regs -mfast-indirect-calls
>-mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000 -O2 >-fomit-frame-pointer
>    -DKBUILD_BASENAME=io -DKBUILD_MODNAME=io -c -o arch/parisc/lib/io.o
>arch/parisc/lib/io.c
>arch/parisc/lib/io.c: In function `__memcpy_toio':
>arch/parisc/lib/io.c:24: warning: use of cast expressions as lvalues is
>deprecated
>arch/parisc/lib/io.c:24: warning: use of cast expressions as lvalues is
>deprecated

here is the next io.c diff file proposal (if some interest :) )
--- arch/parisc/lib/io.c.orig	2004-03-24 14:47:42.703516192 +0100
+++ arch/parisc/lib/io.c	2004-03-24 14:52:46.808285240 +0100
@@ -21,19 +21,19 @@
 		goto bytecopy;
 	while (dest & 3) {
 		writeb(*(char *)src, dest++);
-		((char *)src)++;
-		count--;
+		src += sizeof(char);
+		count -= sizeof(char);
 	}
 	while (count > 3) {
 		__raw_writel(*(u32 *)src, dest);
-		src += 4;
-		dest += 4;
-		count -= 4;
+		src += sizeof(u32);
+		dest += sizeof(u32);
+		count -= sizeof(u32);
 	}
  bytecopy:
 	while (count--) {
 		writeb(*(char *)src, dest++);
-		((char *)src)++;
+		src += sizeof(char);
 	}
 }
 
@@ -62,39 +62,39 @@
 	/* Then check for misaligned start address */
 	if (src & 1) {
 		*(u8 *)dest = readb(src);
-		((u8 *)src)++;
-		((u8 *)dest)++;
-		count--;
+		src += sizeof(u8);
+		dest += sizeof(u8);
+		count -= sizeof(u8);
 		if (count < 2) goto bytecopy;
 	}
 
 	if (src & 2) {
 		*(u16 *)dest = __raw_readw(src);
-		((u16 *)src)++;
-		((u16 *)dest)++;
-		count-=2;
+		src += sizeof(u16);
+		dest += sizeof(u16);
+		count -= sizeof(u16);
 	}
 
 	while (count > 3) {
 		*(u32 *)dest = __raw_readl(src);
-		dest += 4;
-		src += 4;
-		count -= 4;
+		dest += sizeof(u32);
+		src += sizeof(u32);
+		count -= sizeof(u32);
 	}
 
  shortcopy:
 	while (count > 1) {
 		*(u16 *)dest = __raw_readw(src);
-		((u16 *)src)++;
-		((u16 *)dest)++;
-		count-=2;
+		src += sizeof(u16);
+		dest += sizeof(u16);
+		count -= sizeof(u16);
 	}
 
  bytecopy:
 	while (count--) {
 		*(char *)dest = readb(src);
-		((char *)src)++;
-		((char *)dest)++;
+		src += sizeof(char);
+		dest += sizeof(char);
 	}
 }
 
@@ -130,7 +130,7 @@
 			return;
 		count--;
 		*(unsigned char *) dst = inb(port);
-		((unsigned char *) dst)++;
+		dst += sizeof(unsigned char);
 	}
 
 	while (count >= 4) {
@@ -141,13 +141,13 @@
 		w |= inb(port) << 8;
 		w |= inb(port);
 		*(unsigned int *) dst = w;
-		((unsigned int *) dst)++;
+		dst += sizeof(unsigned int);
 	}
 
 	while (count) {
 		--count;
 		*(unsigned char *) dst = inb(port);
-		((unsigned char *) dst)++;
+		dst += sizeof(unsigned char);
 	}
 }
 
@@ -175,7 +175,7 @@
 			l = cpu_to_le16(inw(port)) << 16;
 			l |= cpu_to_le16(inw(port));
 			*(unsigned int *) dst = l;
-			((unsigned int *) dst)++;
+			dst += sizeof(unsigned int);
 		}
 		if (count) {
 			*(unsigned short *) dst = cpu_to_le16(inw(port));
@@ -184,15 +184,15 @@
 	
 	 case 0x02:			/* Buffer 16-bit aligned */
 		*(unsigned short *) dst = cpu_to_le16(inw(port));
-		((unsigned short *) dst)++;
-		count--;
+		dst += sizeof(unsigned short);
+		count -= sizeof(unsigned short);
 		while (count>=2) {
 			
 			count -= 2;
 			l = cpu_to_le16(inw(port)) << 16;
 			l |= cpu_to_le16(inw(port));
 			*(unsigned int *) dst = l;
-			((unsigned int *) dst)++;
+			dst += sizeof(unsigned int);
 		}
 		if (count) {
 			*(unsigned short *) dst = cpu_to_le16(inw(port));
@@ -207,12 +207,12 @@
 		
 		l = cpu_to_le16(inw(port));
 		*(unsigned char *) dst = l >> 8;
-		((unsigned char *) dst)++;
+		dst += sizeof(unsigned char);
 		while (count--)
 		{
 			l2 = cpu_to_le16(inw(port));
 			*(unsigned short *) dst = (l & 0xff) << 8 | (l2 >> 8);
-			((unsigned short *) dst)++;
+			dst += sizeof(unsigned short);
 			l = l2;
 		}
 		*(unsigned char *) dst = l & 0xff;
@@ -241,7 +241,7 @@
 		while (count--)
 		{
 			*(unsigned int *) dst = cpu_to_le32(inl(port));
-			((unsigned int *) dst)++;
+			dst += sizeof(unsigned int);
 		}
 		break;
 	
@@ -250,13 +250,13 @@
 		
 		l = cpu_to_le32(inl(port));
 		*(unsigned short *) dst = l >> 16;
-		((unsigned short *) dst)++;
+		dst += sizeof(unsigned short);
 		
 		while (count--)
 		{
 			l2 = cpu_to_le32(inl(port));
 			*(unsigned int *) dst = (l & 0xffff) << 16 | (l2 >> 16);
-			((unsigned int *) dst)++;
+			dst += sizeof(unsigned int);
 			l = l2;
 		}
 		*(unsigned short *) dst = l & 0xffff;
@@ -266,14 +266,14 @@
 		
 		l = cpu_to_le32(inl(port));
 		*(unsigned char *) dst = l >> 24;
-		((unsigned char *) dst)++;
+		dst += sizeof(unsigned char);
 		*(unsigned short *) dst = (l >> 8) & 0xffff;
-		((unsigned short *) dst)++;
+		dst += sizeof(unsigned short);
 		while (count--)
 		{
 			l2 = cpu_to_le32(inl(port));
 			*(unsigned int *) dst = (l & 0xff) << 24 | (l2 >> 8);
-			((unsigned int *) dst)++;
+			dst += sizeof(unsigned int);
 			l = l2;
 		}
 		*(unsigned char *) dst = l & 0xff;
@@ -283,16 +283,16 @@
 		
 		l = cpu_to_le32(inl(port));
 		*(unsigned char *) dst = l >> 24;
-		((unsigned char *) dst)++;
+		dst += sizeof(unsigned char);
 		while (count--)
 		{
 			l2 = cpu_to_le32(inl(port));
 			*(unsigned int *) dst = (l & 0xffffff) << 8 | l2 >> 24;
-			((unsigned int *) dst)++;
+			dst += sizeof(unsigned int);
 			l = l2;
 		}
 		*(unsigned short *) dst = (l >> 8) & 0xffff;
-		((unsigned short *) dst)++;
+		dst += sizeof(unsigned short);
 		*(unsigned char *) dst = l & 0xff;
 		break;
 	}
@@ -308,9 +308,9 @@
 void outsb(unsigned long port, const void * src, unsigned long count)
 {
 	while (count) {
-		count--;
 		outb(*(char *)src, port);
-		((char *) src)++;
+		src += sizeof(char);
+		count -= sizeof(char);
 	}
 }
 
@@ -333,7 +333,7 @@
 		while (count>=2) {
 			count -= 2;
 			l = *(unsigned int *) src;
-			((unsigned int *) src)++;
+			src += sizeof(unsigned int);
 			outw(le16_to_cpu(l >> 16), port);
 			outw(le16_to_cpu(l & 0xffff), port);
 		}
@@ -345,13 +345,13 @@
 	 case 0x02:			/* Buffer 16-bit aligned */
 		
 		outw(le16_to_cpu(*(unsigned short*)src), port);
-		((unsigned short *) src)++;
+		src += sizeof(unsigned short);
 		count--;
 		
 		while (count>=2) {
 			count -= 2;
 			l = *(unsigned int *) src;
-			((unsigned int *) src)++;
+			src += sizeof(unsigned int);
 			outw(le16_to_cpu(l >> 16), port);
 			outw(le16_to_cpu(l & 0xffff), port);
 		}
@@ -365,13 +365,13 @@
 		 * in this case, 16bit will have to do -- DE */
 		
 		l  = *(unsigned char *) src << 8;
-		((unsigned char *) src)++;
+		src += sizeof(unsigned char);
 		count--;
 		while (count)
 		{
 			count--;
 			l2 = *(unsigned short *) src;
-			((unsigned short *) src)++;
+			src += sizeof(unsigned short);
 			outw(le16_to_cpu(l | l2 >> 8), port);
 		        l = l2 << 8;
 		}
@@ -402,7 +402,7 @@
 		while (count--)
 		{
 			outl(le32_to_cpu(*(unsigned int *) src), port);
-			((unsigned int *) src)++;
+			src += sizeof(unsigned int);
 		}
 		break;
 	
@@ -410,12 +410,12 @@
 		--count;
 		
 		l = *(unsigned short *) src;
-		((unsigned short *) src)++;
+		src += sizeof(unsigned short);
 		
 		while (count--)
 		{
 			l2 = *(unsigned int *) src;
-			((unsigned int *) src)++;
+			src += sizeof(unsigned int);
 			outl (le32_to_cpu(l << 16 | l2 >> 16), port);
 			l = l2;
 		}
@@ -426,13 +426,13 @@
 		--count;
 		
 		l  = *(unsigned char *) src << 24;
-		((unsigned char *) src)++;
+		src += sizeof(unsigned char);
 		l |= *(unsigned short *) src << 8;
-		((unsigned short *) src)++;
+		src += sizeof(unsigned short);
 		while (count--)
 		{
 			l2 = *(unsigned int *) src;
-			((unsigned int *) src)++;
+			src += sizeof(unsigned int);
 			outl (le32_to_cpu(l | l2 >> 24), port);
 			l = l2 << 8;
 		}
@@ -443,16 +443,16 @@
 		--count;
 		
 		l  = *(unsigned char *) src << 24;
-		((unsigned char *) src)++;
+		src += sizeof(unsigned char);
 		while (count--)
 		{
 			l2 = *(unsigned int *) src;
-			((unsigned int *) src)++;
+			src += sizeof(unsigned int);
 			outl (le32_to_cpu(l | l2 >> 8), port);
 			l = l2 << 24;
 		}
 		l2  = *(unsigned short *) src << 16;
-		((unsigned short *) src)++;
+		src += sizeof(unsigned short);
 		l2 |= *(unsigned char *) src;
 		outl (le32_to_cpu(l | l2), port);
 		break;
=========><=========

hth,
    Joel

PS: I am runing a kernel with this patch on my n4k :)

----------------------------------------------------------------------------------------
Tiscali ADSL: 35 €/mois, la meilleure offre du marché!
http://reg.tiscali.be/default.asp?lg=fr



-------------- next part --------------
A non-text attachment was scrubbed...
Name: io.c.diff
Type: application/octet-stream
Size: 7567 bytes
Desc: not available
Url : http://lists.parisc-linux.org/pipermail/parisc-linux/attachments/20040324/5d2befb8/io.c.obj


More information about the parisc-linux mailing list