WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] __RING_SIZE() macro not aconstant when compiling under w

To: James Harper <james.harper@xxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] __RING_SIZE() macro not aconstant when compiling under windows
From: Daniel Stodden <stodden@xxxxxxxxxx>
Date: Sat, 27 Oct 2007 16:36:30 +0200
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 27 Oct 2007 07:38:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <AEC6C66638C05B468B556EA548C1A77D01249CD0@trantor>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Fakultät für Informatik I10, Technische Universität Münche
References: <AEC6C66638C05B468B556EA548C1A77D01249CD0@trantor>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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