[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qtest: fix 'expression is always false' build failure in qte
From: |
Igor Mammedov |
Subject: |
Re: [PATCH] qtest: fix 'expression is always false' build failure in qtest_has_accel() |
Date: |
Fri, 29 Oct 2021 13:48:56 +0200 |
On Wed, 27 Oct 2021 17:59:44 +0200
Paolo Bonzini <pbonzini@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
>