From patchwork Tue Sep 8 19:11:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 515524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6D3B3140157 for ; Wed, 9 Sep 2015 05:11:58 +1000 (AEST) Received: from localhost ([::1]:36795 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZOJ9-0006SE-L9 for incoming@patchwork.ozlabs.org; Tue, 08 Sep 2015 15:11:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZOIn-00069O-R8 for qemu-devel@nongnu.org; Tue, 08 Sep 2015 15:11:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZOIi-0002wy-U4 for qemu-devel@nongnu.org; Tue, 08 Sep 2015 15:11:33 -0400 Received: from qemu.weilnetz.de ([37.221.198.45]:45120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZOIi-0002vl-PN for qemu-devel@nongnu.org; Tue, 08 Sep 2015 15:11:28 -0400 Received: by qemu.weilnetz.de (Postfix, from userid 1000) id AD4A617F6EA; Tue, 8 Sep 2015 21:11:26 +0200 (CEST) From: Stefan Weil To: QEMU Developer Date: Tue, 8 Sep 2015 21:11:25 +0200 Message-Id: <1441739485-17460-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 37.221.198.45 Cc: Stefan Weil , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH] linux-headers: Fix type cast warning for 64 bit MinGW-w64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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). Nor do I expect that Linux would accept a patch which modifies code to better support compilations for Windows. Are there other possibilities how this could be handled? Regards Stefan include/standard-headers/linux/virtio_ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/standard-headers/linux/virtio_ring.h b/include/standard-headers/linux/virtio_ring.h index 6fe276f..3d531f7 100644 --- a/include/standard-headers/linux/virtio_ring.h +++ b/include/standard-headers/linux/virtio_ring.h @@ -143,7 +143,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, vr->num = num; vr->desc = p; vr->avail = p + num*sizeof(struct vring_desc); - vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__virtio16) + vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) + align-1) & ~(align - 1)); }