From patchwork Tue May 20 11:44:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 350662 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 3F46614007F for ; Tue, 20 May 2014 21:46:26 +1000 (EST) Received: from localhost ([::1]:52674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmiUy-0002vV-4n for incoming@patchwork.ozlabs.org; Tue, 20 May 2014 07:46:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmiU2-0001Qd-AV for qemu-devel@nongnu.org; Tue, 20 May 2014 07:45:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmiTp-0001WS-KP for qemu-devel@nongnu.org; Tue, 20 May 2014 07:45:26 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:55728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmiTp-0001WD-CX for qemu-devel@nongnu.org; Tue, 20 May 2014 07:45:13 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 May 2014 12:45:11 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 20 May 2014 12:45:09 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id B08292190042 for ; Tue, 20 May 2014 12:44:59 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4KBj8aN3080504 for ; Tue, 20 May 2014 11:45:08 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s4KBj62v000495 for ; Tue, 20 May 2014 05:45:08 -0600 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-107.boeblingen.de.ibm.com [9.152.224.107]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s4KBj4BF000360; Tue, 20 May 2014 05:45:06 -0600 From: Cornelia Huck To: qemu-devel@nongnu.org Date: Tue, 20 May 2014 13:44:54 +0200 Message-Id: <1400586302-3253-2-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400586302-3253-1-git-send-email-cornelia.huck@de.ibm.com> References: <1400586302-3253-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14052011-0542-0000-0000-000009111578 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.113 Cc: Cornelia Huck , peter.maydell@linaro.org, agraf@suse.de, aliguori@amazon.com, borntraeger@de.ibm.com Subject: [Qemu-devel] [PULL 1/9] kvm: Fix enable_cap helpers on older gcc 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 From: Alexander Graf Commit 40f1ee27aa1 introduced handy helpers for enable_cap calls on vcpu and vm level. Unfortunately some older gcc versions (4.7.1, 4.6) seem to choke on signedness detection in inline created variables: target-ppc/kvm.c: In function 'kvmppc_booke_watchdog_enable': target-ppc/kvm.c:1302:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] target-ppc/kvm.c: In function 'kvmppc_set_papr': target-ppc/kvm.c:1504:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] However - thanks to Thomas Huth for the suggestion - we can just cast the offending potentially 0 value to a signed type, making the comparison signed. Reviewed-by: Thomas Huth Acked-by: Cornelia Huck Signed-off-by: Alexander Graf Signed-off-by: Cornelia Huck --- include/sysemu/kvm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index e7ad9d1..25c8a2b 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -300,7 +300,7 @@ int kvm_check_extension(KVMState *s, unsigned int extension); }; \ uint64_t args_tmp[] = { __VA_ARGS__ }; \ int i; \ - for (i = 0; i < ARRAY_SIZE(args_tmp) && \ + for (i = 0; i < (int)ARRAY_SIZE(args_tmp) && \ i < ARRAY_SIZE(cap.args); i++) { \ cap.args[i] = args_tmp[i]; \ } \ @@ -315,7 +315,7 @@ int kvm_check_extension(KVMState *s, unsigned int extension); }; \ uint64_t args_tmp[] = { __VA_ARGS__ }; \ int i; \ - for (i = 0; i < ARRAY_SIZE(args_tmp) && \ + for (i = 0; i < (int)ARRAY_SIZE(args_tmp) && \ i < ARRAY_SIZE(cap.args); i++) { \ cap.args[i] = args_tmp[i]; \ } \