Received: from eggs.gnu.org ([2001:4830:134:3::10]:57397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsvUz-00079c-0p for qemu-devel@nongnu.org; Sat, 29 Jun 2013 09:47:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsvUw-0001wT-OI for qemu-devel@nongnu.org; Sat, 29 Jun 2013 09:47:32 -0400 Received: from [2a03:4000:2:362::1] (port=36390 helo=v2201305906712890.yourvserver.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsvUw-0001w8-IU for qemu-devel@nongnu.org; Sat, 29 Jun 2013 09:47:30 -0400 From: Stefan Weil Date: Sat, 29 Jun 2013 15:47:26 +0200 Message-Id: <1372513646-6053-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH v2] spapr: Fix compiler warnings for some versions of gcc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- 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