From patchwork Sat Apr 28 15:52:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 155666 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 01FFDB6FDE for ; Sun, 29 Apr 2012 01:52:45 +1000 (EST) Received: from localhost ([::1]:51009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SO9ww-0001ob-VH for incoming@patchwork.ozlabs.org; Sat, 28 Apr 2012 11:52:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SO9wq-0001oS-Ni for qemu-devel@nongnu.org; Sat, 28 Apr 2012 11:52:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SO9wo-0000Ry-T8 for qemu-devel@nongnu.org; Sat, 28 Apr 2012 11:52:36 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:60604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SO9wo-0000RZ-NA; Sat, 28 Apr 2012 11:52:34 -0400 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id 750D772800B6; Sat, 28 Apr 2012 17:52:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S+dp-B+sWWDV; Sat, 28 Apr 2012 17:52:31 +0200 (CEST) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id EC3D672800B7; Sat, 28 Apr 2012 17:52:31 +0200 (CEST) From: Stefan Weil To: qemu-devel@nongnu.org Date: Sat, 28 Apr 2012 17:52:31 +0200 Message-Id: <1335628351-28941-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.9 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.47.199.172 Cc: Blue Swirl , Stefan Weil , =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-ppc@nongnu.org, Alexander Graf Subject: [Qemu-devel] [PATCH] ppce500_spin: Replace assert by hw_error (fixes compiler warning) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The default case in function spin_read should never be reached, therefore the old code used assert(0) to abort QEMU. This does not work when QEMU is compiled with macro NDEBUG defined. In this case (and also when the compiler does not know that assert never returns), there is a compiler warning because of the missing return value. Using hw_error allows an improved error message and aborts always. Signed-off-by: Stefan Weil --- hw/ppce500_spin.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c index 960b7b0..57dc995 100644 --- a/hw/ppce500_spin.c +++ b/hw/ppce500_spin.c @@ -178,7 +178,7 @@ static uint64_t spin_read(void *opaque, target_phys_addr_t addr, unsigned len) case 4: return ldl_p(spin_p); default: - assert(0); + hw_error("ppce500: unexpected spin_read with len = %u", len); } }