From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH v2] spapr: Fix compiler warnings for some versions of gcc
Date: Mon, 01 Jul 2013 12:50:21 +0200 [thread overview]
Message-ID: <51D15EED.3070000@redhat.com> (raw)
In-Reply-To: <1372513646-6053-1-git-send-email-sw@weilnetz.de>
Il 29/06/2013 15:47, Stefan Weil ha scritto:
> i686-w64-mingw32-gcc (GCC) 4.6.3 from Debian wheezy reports these warnings:
>
> hw/ppc/spapr_hcall.c:188:1: warning:
> control reaches end of non-void function [-Wreturn-type]
>
> hw/ppc/spapr_pci.c:454:1: warning:
> control reaches end of non-void function [-Wreturn-type]
>
> Both warnings are fixed by using g_assert_not_reached instead of assert.
> A second line with assert(0) in spapr_pci.c which did not raise a compiler
> warning was modified, too, because g_assert_not_reached documents the
> purpose of that statement and is not removed in release builds.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> This patch is an improved version which replaces
> http://patchwork.ozlabs.org/patch/253939/ and
> http://patchwork.ozlabs.org/patch/253938/.
>
> Patch http://patchwork.ozlabs.org/patch/253937/ of my
> previous series is still applicable. Please consider
> applying it to the ppc queue.
>
> I suggest replacing assert(0) by g_assert_not_reached()
> in the rest of QEMU's code, too. If there is consensus,
> I'll send a patch which does this.
Makes sense, thanks!
> Replacing assert by g_assert would also make sense with a
> few exceptions in time critical code (TCG, TCI).
Note that most Linux distros is never using -DNDEBUG (in general, not
just for QEMU).
Paolo
> Regards
> Stefan W.
>
> hw/ppc/spapr_hcall.c | 2 +-
> hw/ppc/spapr_pci.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 8f0b7e8..93af469 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -184,7 +184,7 @@ static target_ulong h_remove(PowerPCCPU *cpu, sPAPREnvironment *spapr,
> return H_HARDWARE;
> }
>
> - assert(0);
> + g_assert_not_reached();
> }
>
> #define H_BULK_REMOVE_TYPE 0xc000000000000000ULL
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 04e8362..4b69b04 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -450,7 +450,7 @@ static uint64_t spapr_io_read(void *opaque, hwaddr addr,
> case 4:
> return cpu_inl(addr);
> }
> - assert(0);
> + g_assert_not_reached();
> }
>
> static void spapr_io_write(void *opaque, hwaddr addr,
> @@ -467,7 +467,7 @@ static void spapr_io_write(void *opaque, hwaddr addr,
> cpu_outl(addr, data);
> return;
> }
> - assert(0);
> + g_assert_not_reached();
> }
>
> static const MemoryRegionOps spapr_io_ops = {
>
next prev parent reply other threads:[~2013-07-01 10:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-29 13:47 [Qemu-devel] [PATCH v2] spapr: Fix compiler warnings for some versions of gcc Stefan Weil
2013-06-29 14:28 ` David Gibson
2013-07-01 10:50 ` Paolo Bonzini [this message]
2013-07-02 12:42 ` Alexander Graf
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=51D15EED.3070000@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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.