From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrDMa-0005hU-A5 for qemu-devel@nongnu.org; Mon, 24 Jun 2013 16:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrDMZ-0003EP-9b for qemu-devel@nongnu.org; Mon, 24 Jun 2013 16:27:48 -0400 Received: from mail-ee0-x229.google.com ([2a00:1450:4013:c00::229]:37954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrDMZ-0003Ds-2y for qemu-devel@nongnu.org; Mon, 24 Jun 2013 16:27:47 -0400 Received: by mail-ee0-f41.google.com with SMTP id d17so6306126eek.0 for ; Mon, 24 Jun 2013 13:27:45 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51C8ABBC.1070902@redhat.com> Date: Mon, 24 Jun 2013 22:27:40 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1372096130-24994-1-git-send-email-sw@weilnetz.de> <1372096130-24994-3-git-send-email-sw@weilnetz.de> In-Reply-To: <1372096130-24994-3-git-send-email-sw@weilnetz.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] spapr: Fix compiler warning for some versions of gcc (h_remove) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: qemu-devel , Alexander Graf , David Gibson Il 24/06/2013 19:48, Stefan Weil ha scritto: > i686-w64-mingw32-gcc (GCC) 4.6.3 from Debian wheezy reports this warning: > > hw/ppc/spapr_hcall.c:188:1: warning: > control reaches end of non-void function [-Wreturn-type] > > Replacing the 4th case REMOVE_HW (which is currently unused) by the default > case fixes this warning. > > The assertion is dead code because all possible cases are handled in the > switch statements, so remove it. This avoids future warnings from static > code analyzers. > > Signed-off-by: Stefan Weil > --- > hw/ppc/spapr_hcall.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c > index 00f21f5..d49ce53 100644 > --- a/hw/ppc/spapr_hcall.c > +++ b/hw/ppc/spapr_hcall.c > @@ -180,11 +180,9 @@ static target_ulong h_remove(PowerPCCPU *cpu, sPAPREnvironment *spapr, > case REMOVE_PARM: > return H_PARAMETER; > > - case REMOVE_HW: > + default: /* REMOVE_HW */ > return H_HARDWARE; > } > - > - assert(0); > } > > #define H_BULK_REMOVE_TYPE 0xc000000000000000ULL > Does s/assert(0)/abort()/ fix the warning too? That's clearer. Paolo