* [Qemu-devel] [PATCH v2] spapr: Fix compiler warnings for some versions of gcc
@ 2013-06-29 13:47 Stefan Weil
2013-06-29 14:28 ` David Gibson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Weil @ 2013-06-29 13:47 UTC (permalink / raw)
To: David Gibson, Alexander Graf; +Cc: Paolo Bonzini, qemu-devel, Stefan Weil
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.
Replacing assert by g_assert would also make sense with a
few exceptions in time critical code (TCG, TCI).
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 = {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] spapr: Fix compiler warnings for some versions of gcc
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
2013-07-02 12:42 ` Alexander Graf
2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2013-06-29 14:28 UTC (permalink / raw)
To: Stefan Weil; +Cc: Paolo Bonzini, Alexander Graf, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 972 bytes --]
On Sat, Jun 29, 2013 at 03:47:26PM +0200, Stefan Weil wrote:
> 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>
Makes sense to me.
Acked-by: David Gibson <david@gibson.dropbear.id.au>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] spapr: Fix compiler warnings for some versions of gcc
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
2013-07-02 12:42 ` Alexander Graf
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2013-07-01 10:50 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel, Alexander Graf, David Gibson
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 = {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] spapr: Fix compiler warnings for some versions of gcc
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
@ 2013-07-02 12:42 ` Alexander Graf
2 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2013-07-02 12:42 UTC (permalink / raw)
To: Stefan Weil; +Cc: Paolo Bonzini, qemu-devel, David Gibson
On 06/29/2013 03:47 PM, Stefan Weil wrote:
> 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>
Thanks, applied to ppc-next.
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-02 12:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-07-02 12:42 ` Alexander Graf
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).