Wed Jul 27 23:10:41 2011 UTC ()
Make this use offsetof and __typeof__ to appease gcc4.5


(matt)
diff -r1.11 -r1.12 src/sys/arch/xen/include/xen3-public/io/ring.h

cvs diff -r1.11 -r1.12 src/sys/arch/xen/include/xen3-public/io/Attic/ring.h (expand / switch to context diff)
--- src/sys/arch/xen/include/xen3-public/io/Attic/ring.h 2008/08/22 15:28:11 1.11
+++ src/sys/arch/xen/include/xen3-public/io/Attic/ring.h 2011/07/27 23:10:40 1.12
@@ -1,4 +1,4 @@
-/* $NetBSD: ring.h,v 1.11 2008/08/22 15:28:11 cegger Exp $ */
+/* $NetBSD: ring.h,v 1.12 2011/07/27 23:10:40 matt Exp $ */
 /******************************************************************************
  * ring.h
  * 
@@ -60,7 +60,7 @@
  * power of two (so we can mask with (size-1) to loop around).
  */
 #define __RING_SIZE(_s, _sz) \
-    (__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
+    (__RD32(((_sz) - offsetof(__typeof__(*(_s)), ring)) / sizeof((_s)->ring[0])))
 
 /*
  * Macros to make the correct C datatypes for a new kind of ring.