All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Andryuk <jandryuk@gmail.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Thomas Huth <thuth@redhat.com>, QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH] qtest: fix 'expression is always false' build failure in qtest_has_accel()
Date: Wed, 27 Oct 2021 10:19:42 -0400	[thread overview]
Message-ID: <CAKf6xpvjZSD1p8dqa9G+mSNzXGj2_H=q-a3tSY9U7jhxfSBkuw@mail.gmail.com> (raw)
In-Reply-To: <20211027042734-mutt-send-email-mst@kernel.org>

On Wed, Oct 27, 2021 at 4:34 AM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Wed, Oct 27, 2021 at 03:45:42AM -0400, 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.
> >
> > Fixes: e741aff0f43343 ("tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator")
> > Reported-by: Jason Andryuk <jandryuk@gmail.com>
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
>
>
> > ---
> >  tests/qtest/libqtest.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> > index 25aeea385b..9833e16f84 100644
> > --- a/tests/qtest/libqtest.c
> > +++ b/tests/qtest/libqtest.c
> > @@ -931,6 +931,7 @@ bool qtest_has_accel(const char *accel_name)
> >          return false;
> >  #endif
> >      } else if (g_str_equal(accel_name, "kvm")) {
> > +#if defined(CONFIG_KVM_TARGETS)
>
> Ugh.
>         const char *targets[] = { CONFIG_KVM_TARGETS };
>
> are you use CONFIG_KVM_TARGETS is not defined?
>
> Looks like it's defined, just empty.
>
> which is not standard C BTW.
>
> How about we just add an empty string in meson?
>
> diff --git a/meson.build b/meson.build
> index 2c5b53cbe2..ff85e9c2af 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

This allows Debian buster (gcc 8.3.0) to compile.

Thanks,
Jason


  reply	other threads:[~2021-10-27 15:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27  7:45 [PATCH] qtest: fix 'expression is always false' build failure in qtest_has_accel() Igor Mammedov
2021-10-27  8:33 ` Michael S. Tsirkin
2021-10-27 14:19   ` Jason Andryuk [this message]
2021-10-27 15:59 ` Paolo Bonzini
2021-10-29 11:48   ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKf6xpvjZSD1p8dqa9G+mSNzXGj2_H=q-a3tSY9U7jhxfSBkuw@mail.gmail.com' \
    --to=jandryuk@gmail.com \
    --cc=imammedo@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.