From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZZ6o-0005F2-UA for qemu-devel@nongnu.org; Wed, 09 Sep 2015 02:43:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZZ6k-00006j-Q3 for qemu-devel@nongnu.org; Wed, 09 Sep 2015 02:43:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZZ6k-00006d-K7 for qemu-devel@nongnu.org; Wed, 09 Sep 2015 02:43:50 -0400 Date: Wed, 9 Sep 2015 09:43:47 +0300 From: "Michael S. Tsirkin" Message-ID: <20150909094310-mutt-send-email-mst@redhat.com> References: <1441739485-17460-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] linux-headers: Fix type cast warning for 64 bit MinGW-w64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Stefan Weil , thuth@redhat.com, QEMU Developer On Tue, Sep 08, 2015 at 08:15:50PM +0100, Peter Maydell wrote: > On 8 September 2015 at 20:11, Stefan Weil wrote: > > Type casts from pointers to unsigned long don't work on 64 bit Windows > > because both types have different size. > > > > Compiler warning: > > > > include/standard-headers/linux/virtio_ring.h:146:23: > > warning: cast from pointer to integer of different size > > [-Wpointer-to-int-cast] > > vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + ... > > ^ > > > > Signed-off-by: Stefan Weil > > --- > > > > This is a modification of a Linux header file, > > something we usually try to avoid. > > > > I did not succeed in removing this header from compilations > > for Windows (which would have been the best solution). > > No, this header is supposed to work everywhere (that's why > it's in standard-headers/ rather than linux-headers), > because virtio devices must work everywhere. We need to > improve the process which creates it from the kernel header > by automatedly fixing up non-portable constructs > (which is handled by scripts/update-linux-headers.sh). > Some extra seddery in cp_virtio() is probably required. > > thanks > -- PMM commit d768f32aec8c0ebb8499ffca89cfed8f5f1a4432 Author: Thomas Huth Date: Thu Jul 2 09:21:22 2015 +0200 virtio: Fix typecast of pointer in vring_init() The virtio_ring.h header is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast in vring_init() should be done with (uintptr_t) instead of (unsigned long). Signed-off-by: Thomas Huth Signed-off-by: Michael S. Tsirkin Fixed this, so it's just a question of updating from latest linux. -- MST