From: Daniel Stodden Subject: Re: __RING_SIZE() macro not aconstant when compiling under windows Date: Sat, 27 Oct 2007 16:36:30 +0200 Message-ID: <1193495790.12382.6.camel@thinkpad.localdomain> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-6OrlbaUCeUwSL3eAiWF9" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: James Harper Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=-6OrlbaUCeUwSL3eAiWF9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 >=20 > " > c:\projects\xen\xenvbd\xenvbd.h(43) : error C2057: expected constant > expression > " >=20 > 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 --=20 Daniel Stodden LRR - Lehrstuhl f=C3=BCr Rechnertechnik und Rechnerorganisation Institut f=C3=BCr Informatik der TU M=C3=BCnchen D-85748 Garc= hing http://www.lrr.in.tum.de/~stodden mailto:stodden@cs.tum.edu PGP Fingerprint: F5A4 1575 4C56 E26A 0B33 3D80 457E 82AE B0D8 735B --=-6OrlbaUCeUwSL3eAiWF9 Content-Description: Content-Disposition: inline; filename=ringsize.patch Content-Type: text/x-patch; charset=utf-8 Content-Transfer-Encoding: 7bit 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. --=-6OrlbaUCeUwSL3eAiWF9 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-6OrlbaUCeUwSL3eAiWF9--