From: Eric Blake <eblake@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] main_loop: Make main_loop_wait() return void
Date: Fri, 31 Mar 2017 09:10:03 -0500 [thread overview]
Message-ID: <d2b71d89-8741-48f6-dea1-8bed1ebc1f21@redhat.com> (raw)
In-Reply-To: <1490968309-13672-1-git-send-email-peter.maydell@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]
On 03/31/2017 08:51 AM, Peter Maydell wrote:
> In commit e330c118f2a5a the last usage of main_loop_wait() that cared
> about the return value was changed to no longer use it. Drop the
> now-useless return value and make the function return void.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Coverity complains (CID 1372464) about main_loop() calling
> main_loop_wait() and ignoring its return value. I suspect
> this change will just displace that to within main_loop_wait()
> itself since the underlying issue there is "the ppoll() that
> gets called to poll fds can return an error code, but what
> do we do if it does?". Suggestions on that point welcome.
At one point, there was a suggestion to introduce an ignore_value()
macro that ignores values that the compiler/coverity would otherwise
complain about, in contexts where we really are okay ignoring the value.
If making main_loop_wait() return void shifts where Coverity blames,
then ignore_value(ppoll()) seems like it might help.
>
> I guess this will make the compiler warn about ret being
> set and never used if CONFIG_SLIRP is not defined, which
> is irritating. I'm postponing messing about with fixing
> that in favour of seeing whether anybody has a good answer
> to the question above (which might make it moot).
> ---
> -int main_loop_wait(int nonblocking)
> +void main_loop_wait(int nonblocking)
> {
> int ret;
> uint32_t timeout = UINT32_MAX;
> @@ -513,7 +513,7 @@ int main_loop_wait(int nonblocking)
> qemu_start_warp_timer();
> qemu_clock_run_all_timers();
>
> - return ret;
> + return;
> }
We generally avoid lone return; at the end of a void function.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-03-31 14:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-31 13:51 [Qemu-devel] [PATCH] main_loop: Make main_loop_wait() return void Peter Maydell
2017-03-31 13:54 ` Peter Maydell
2017-03-31 14:10 ` Eric Blake [this message]
2017-05-30 14:08 ` Peter Maydell
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=d2b71d89-8741-48f6-dea1-8bed1ebc1f21@redhat.com \
--to=eblake@redhat.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).