|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] __RING_SIZE() macro not aconstant when compiling under w
On Sat, 2007-10-27 at 21:36 +1000, James Harper wrote:
> When I try and use the __RING_SIZE() macro under windows as the size of
> an array, the ddk compiler complains that it's not a constant
> expression. The exact error it gives is
>
> "
> c:\projects\xen\xenvbd\xenvbd.h(43) : error C2057: expected constant
> expression
> "
>
> Is there something special about gcc that would let this work under it
> but not under the windows compiler?
dunno much about the windows ddk, but does the diff below help?
regards,
dns
--
Daniel Stodden
LRR - Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München D-85748 Garching
http://www.lrr.in.tum.de/~stodden mailto:stodden@xxxxxxxxxx
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33 3D80 457E 82AE B0D8 735B
diff -r d6d3c7856abc xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h Thu Oct 11 10:12:07 2007 +0100
+++ b/xen/include/public/io/ring.h Sat Oct 27 16:34:20 2007 +0200
@@ -43,7 +43,7 @@ typedef unsigned int RING_IDX;
* 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) - (long)&((typeof(_s))0)->ring) /
sizeof(((typeof(_s))0)->ring[0])))
/*
* Macros to make the correct C datatypes for a new kind of ring.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|