kvm: Fix enable_cap helpers on older gcc
commit61c7bbd236b90da7531fcf957223a2456670d44d
authorAlexander Graf <agraf@suse.de>
Mon, 12 May 2014 09:51:37 +0000 (12 11:51 +0200)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Tue, 20 May 2014 11:05:57 +0000 (20 13:05 +0200)
tree662ef33b285c427338cba561cca85dd2ba4d2e88
parentc5fa6c86d0765f837515d1c10654c621724a77e0
kvm: Fix enable_cap helpers on older gcc

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 <thuth@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
include/sysemu/kvm.h