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: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 29 Oct 2007 08:53:23 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 29 Oct 2007 01:52:17 -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>
References: <AEC6C66638C05B468B556EA548C1A77D01249CD0@trantor>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> "James Harper" <james.harper@xxxxxxxxxxxxxxxx> 27.10.07 13:36 >>>
>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?

I would think that this is a compiler bug, especially since (trivial workaround
for you) adding the address-of operator as in

#define __RING_SIZE(_s, _sz) \
    (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))

makes the code compile (the operator shouldn't be needed since the
conversion is being done implicitly anyway - otherwise the cast wouldn't
work). Since this should be a benign change for all other compilers, it may
be reasonable to change the public header this way.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel