[parisc-linux] Cast of lvalue warning in the last k 2.6.5-rc2 with last gcc-3.3

Joel Soete soete.joel at tiscali.be
Tue Mar 23 00:35:54 MST 2004


Hi all,

here is a warning during the last kernel build (2.6.5-rc2):
  gcc -Wp,-MD,arch/parisc/lib/.bitops.o.d -nostdinc -iwithprefix include
-D__KERNEL__ -Iinclude  -D__KERNEL__ -Iinclude  -Wall -Wstrict-prototypes
-Wno-trigraphs
-fno-strict-aliasing -fno-common -pipe -mno-space-regs -mfast-indirect-calls
-mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000 -O2 -fomit-frame-pointer
    -DKBUILD_BASENAME=bitops -DKBUILD_MODNAME=bitops -c -o arch/parisc/lib/bitops.o
arch/parisc/lib/bitops.c
arch/parisc/lib/bitops.c: In function `__xchg32':
arch/parisc/lib/bitops.c:40: warning: use of cast expressions as lvalues
is deprecated
arch/parisc/lib/bitops.c: In function `__xchg8':
arch/parisc/lib/bitops.c:53: warning: use of cast expressions as lvalues
is deprecated

And here is a patch proposal:
--- /usr/src/linux-2.6.5-rc2-pa2/arch/parisc/lib/bitops.c.orig	2004-03-22
08:35:45.000000000 +0100
+++ /usr/src/linux-2.6.5-rc2-pa2/arch/parisc/lib/bitops.c	2004-03-22 08:42:10.000000000
+0100
@@ -33,11 +33,10 @@
 
 unsigned long __xchg32(int x, int *ptr)
 {
-	unsigned long flags;
-	unsigned long temp;
+	unsigned long temp, flags;
 
 	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
-	(long) temp = (long) *ptr;	/* XXX - sign extension wanted? */
+	temp = (unsigned long) *ptr;	/* XXX - sign extension wanted? */
 	*ptr = x;
 	atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
 	return temp;
@@ -46,11 +45,10 @@
 
 unsigned long __xchg8(char x, char *ptr)
 {
-	unsigned long flags;
-	unsigned long temp;
+	unsigned long temp, flags;
 
 	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
-	(long) temp = (long) *ptr;	/* XXX - sign extension wanted? */
+	temp = (unsigned long) *ptr;	/* XXX - sign extension wanted? */
 	*ptr = x;
 	atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
 	return temp;
@@ -60,8 +58,7 @@
 #ifdef __LP64__
 unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old,
unsigned long new)
 {
-	unsigned long flags;
-	unsigned long prev;
+	unsigned long prev, flags;
 
 	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
 	if ((prev = *ptr) == old)
==========><=========

What do you thing about?

hth,
    Joel

PS1: attached patch in case of bad wrapping webmail

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-aliasing -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
...

----------------------------------------------------------------------------------------
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: bitops.c.diff
Type: application/octet-stream
Size: 1305 bytes
Desc: not available
Url : http://lists.parisc-linux.org/pipermail/parisc-linux/attachments/20040323/ea3a1679/bitops.c.obj


More information about the parisc-linux mailing list