On Wed, 27 Oct 2021 17:59:44 +0200 Paolo Bonzini <pbonz...@redhat.com> wrote:
> On 27/10/21 09:45, Igor Mammedov wrote: > > 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 compiling KVM related part only if > > CONFIG_KVM_TARGETS is set. > > Another possibility is to add a trailing NULL to the array and change > the loop to "for (i = 0; targets[i]; i++)". Thanks, I've sent v2 with Michael suggested approach, it seems to me a bit more cleaner. > > Paolo >