From: Igor Mammedov Date: Wed, 27 Oct 2021 15:10:12 +0000 (-0400) Subject: qtest: fix 'expression is always false' build failure in qtest_has_accel() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=44d3d8981402ce7eef435dd912f21fb84f1f7c4d;p=qemu.git qtest: fix 'expression is always false' build failure in qtest_has_accel() If KVM is disabled or not present, qtest library build may fail with: libqtest.c: In function 'qtest_has_accel': comparison of unsigned expression < 0 is always false [-Werror=type-limits] for (i = 0; i < ARRAY_SIZE(targets); i++) { due to empty 'targets' array. Fix it by making sure that CONFIG_KVM_TARGETS isn't empty. Fixes: e741aff0f43343 ("tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator") Reported-by: Jason Andryuk Suggested-by: "Michael S. Tsirkin" Signed-off-by: Igor Mammedov Message-Id: <20211027151012.2639284-1-imammedo@redhat.com> Tested-by: Jason Andryuk Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/meson.build b/meson.build index b092728397..ab4a5723f0 100644 --- a/meson.build +++ b/meson.build @@ -75,7 +75,7 @@ else kvm_targets = [] endif -kvm_targets_c = '' +kvm_targets_c = '""' if not get_option('kvm').disabled() and targetos == 'linux' kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"' endif