Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch only lvalues can be incremented. found by gcc4.



details:   https://anonhg.NetBSD.org/src/rev/ea0b9bec757e
branches:  trunk
changeset: 581022:ea0b9bec757e
user:      chs <chs%NetBSD.org@localhost>
date:      Fri May 20 15:09:45 2005 +0000

description:
only lvalues can be incremented.  found by gcc4.

diffstat:

 sys/arch/hp700/dev/mongoose.c  |  38 +++++++++++-----
 sys/arch/hp700/hp700/mainbus.c |  92 +++++++++++++++++++++++++++++++----------
 sys/arch/hppa/hppa/in_cksum.c  |   6 +-
 3 files changed, 99 insertions(+), 37 deletions(-)

diffs (truncated from 366 to 300 lines):

diff -r e7e5ad05e8b1 -r ea0b9bec757e sys/arch/hp700/dev/mongoose.c
--- a/sys/arch/hp700/dev/mongoose.c     Fri May 20 14:39:04 2005 +0000
+++ b/sys/arch/hp700/dev/mongoose.c     Fri May 20 15:09:45 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mongoose.c,v 1.9 2004/08/30 15:05:17 drochner Exp $    */
+/*     $NetBSD: mongoose.c,v 1.10 2005/05/20 15:09:45 chs Exp $        */
 
 /*     $OpenBSD: mongoose.c,v 1.7 2000/08/15 19:42:56 mickey Exp $     */
 
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mongoose.c,v 1.9 2004/08/30 15:05:17 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mongoose.c,v 1.10 2005/05/20 15:09:45 chs Exp $");
 
 #define MONGOOSE_DEBUG 9
 
@@ -494,11 +494,13 @@
 mg_isa_rr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c)
 {
        u_int16_t r;
+       volatile u_int16_t *p;
 
        h += o;
+       p = (void *)h;
        while (c--) {
-               r = *((volatile u_int16_t *)h)++;
-               *(a++) = le16toh(r);
+               r = *p++;
+               *a++ = le16toh(r);
        }
 }
 
@@ -506,11 +508,13 @@
 mg_isa_rr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c)
 {
        u_int32_t r;
+       volatile u_int32_t *p;
 
        h += o;
+       p = (void *)h;
        while (c--) {
-               r = *((volatile u_int32_t *)h)++;
-               *(a++) = le32toh(r);
+               r = *p++;
+               *a++ = le32toh(r);
        }
 }
 
@@ -518,11 +522,13 @@
 mg_isa_wr_2(void *v, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c)
 {
        u_int16_t r;
+       volatile u_int16_t *p;
 
        h += o;
+       p = (void *)h;
        while (c--) {
-               r = *(a++);
-               *((volatile u_int16_t *)h)++ = htole16(r);
+               r = *a++;
+               *p++ = htole16(r);
        }
 }
 
@@ -530,30 +536,38 @@
 mg_isa_wr_4(void *v, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c)
 {
        u_int32_t r;
+       volatile u_int32_t *p;
 
        h += o;
+       p = (void *)h;
        while (c--) {
-               r = *(a++);
-               *((volatile u_int32_t *)h)++ = htole32(r);
+               r = *a++;
+               *p++ = htole32(r);
        }
 }
 
 void
 mg_isa_sr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t vv, bus_size_t c)
 {
+       volatile u_int16_t *p;
+
        vv = htole16(vv);
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int16_t *)h)++ = vv;
+               *p++ = vv;
 }
 
 void
 mg_isa_sr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t vv, bus_size_t c)
 {
+       volatile u_int32_t *p;
+
        vv = htole32(vv);
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int32_t *)h)++ = vv;
+               *p++ = vv;
 }
 
 int
diff -r e7e5ad05e8b1 -r ea0b9bec757e sys/arch/hp700/hp700/mainbus.c
--- a/sys/arch/hp700/hp700/mainbus.c    Fri May 20 14:39:04 2005 +0000
+++ b/sys/arch/hp700/hp700/mainbus.c    Fri May 20 15:09:45 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.25 2005/04/01 11:59:27 yamt Exp $        */
+/*     $NetBSD: mainbus.c,v 1.26 2005/05/20 15:09:45 chs Exp $ */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25 2005/04/01 11:59:27 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.26 2005/05/20 15:09:45 chs Exp $");
 
 #include "locators.h"
 #include "opt_power_switch.h"
@@ -619,65 +619,89 @@
 void
 mbus_rr_1(void *v, bus_space_handle_t h, bus_size_t o, u_int8_t *a, bus_size_t c)
 {
+       volatile u_int8_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *(a++) = *((volatile u_int8_t *)h)++;
+               *a++ = *p++;
 }
 
 void
 mbus_rr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c)
 {
+       volatile u_int16_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *(a++) = *((volatile u_int16_t *)h)++;
+               *a++ = *p++;
 }
 
 void
 mbus_rr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c)
 {
+       volatile u_int32_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *(a++) = *((volatile u_int32_t *)h)++;
+               *a++ = *p++;
 }
 
 void
 mbus_rr_8(void *v, bus_space_handle_t h, bus_size_t o, u_int64_t *a, bus_size_t c)
 {
+       volatile u_int64_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *(a++) = *((volatile u_int64_t *)h)++;
+               *a++ = *p++;
 }
 
 void
 mbus_wr_1(void *v, bus_space_handle_t h, bus_size_t o, const u_int8_t *a, bus_size_t c)
 {
+       volatile u_int8_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int8_t *)h)++ = *(a++);
+               *p++ = *a++;
 }
 
 void
 mbus_wr_2(void *v, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c)
 {
+       volatile u_int16_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int16_t *)h)++ = *(a++);
+               *p++ = *a++;
 }
 
 void
 mbus_wr_4(void *v, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c)
 {
+       volatile u_int32_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int32_t *)h)++ = *(a++);
+               *p++ = *a++;
 }
 
 void
 mbus_wr_8(void *v, bus_space_handle_t h, bus_size_t o, const u_int64_t *a, bus_size_t c)
 {
+       volatile u_int64_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int64_t *)h)++ = *(a++);
+               *p++ = *a++;
 }
 
 void mbus_rrr_2(void *, bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t);
@@ -691,77 +715,101 @@
 void
 mbus_sr_1(void *v, bus_space_handle_t h, bus_size_t o, u_int8_t vv, bus_size_t c)
 {
+       volatile u_int8_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int8_t *)h)++ = vv;
+               *p++ = vv;
 }
 
 void
 mbus_sr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t vv, bus_size_t c)
 {
+       volatile u_int16_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int16_t *)h)++ = vv;
+               *p++ = vv;
 }
 
 void
 mbus_sr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t vv, bus_size_t c)
 {
+       volatile u_int32_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int32_t *)h)++ = vv;
+               *p++ = vv;
 }
 
 void
 mbus_sr_8(void *v, bus_space_handle_t h, bus_size_t o, u_int64_t vv, bus_size_t c)
 {
+       volatile u_int64_t *p;
+
        h += o;
+       p = (void *)h;
        while (c--)
-               *((volatile u_int64_t *)h)++ = vv;
+               *p++ = vv;
 }
 
 void
 mbus_cp_1(void *v, bus_space_handle_t h1, bus_size_t o1,
          bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
 {
+       volatile u_int8_t *p1, *p2;
+
        h1 += o1;
        h2 += o2;
+       p1 = (void *)h1;
+       p2 = (void *)h2;
        while (c--)
-               *((volatile u_int8_t *)h1)++ =
-                       *((volatile u_int8_t *)h2)++;
+               *p1++ = *p2++;
 }
 
 void
 mbus_cp_2(void *v, bus_space_handle_t h1, bus_size_t o1,
          bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
 {
+       volatile u_int16_t *p1, *p2;
+
        h1 += o1;
        h2 += o2;
+       p1 = (void *)h1;
+       p2 = (void *)h2;



Home | Main Index | Thread Index | Old Index