From patchwork Wed Mar 12 13:24:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 26097 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 49385236AC for ; Wed, 12 Mar 2014 13:24:52 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id if11sf4568538vcb.0 for ; Wed, 12 Mar 2014 06:24:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=MGzHR7jUkSyWzM5nvHNCypAqDsfve/KC1rZ31Df4MkY=; b=c08unNn4kIDElmFdj/X6OEfCrCbeUKZvIV5guvIbbzxLIgoayK4YPZde8BusHX+vel McArMJrbEpIwlp54Z7nDHIHXnAYMUiII21DBRE4UqIS79FDBfzlBETHUGAvc6mzRff47 BrkrzTogjBu8Ru4YydX+ObDI9sat99zgYkqKQitakdlBkhGfLaH2PURTMtZTleHY3Leb mkt0wgZON3ZpzokpZn6PwLAF3AhZrvIOeGq6ri2uD0RQzibBh5/7lFvz0Y5VxEUQEhfO sIdPBPBnSa0Vbh3ckMx7tyd9/R136ZDL76qiGpdkFzkEuOLDwaBktCfIVXZmDzkW9IW9 /oVA== X-Gm-Message-State: ALoCoQkwMPcwggNcpRP3t6L7TSgyAD9ld+v/03LuSd/RpEH5yG4uenkQfk5nUhQGodSEntl5intc X-Received: by 10.236.90.200 with SMTP id e48mr17913157yhf.28.1394630692036; Wed, 12 Mar 2014 06:24:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.139 with SMTP id f11ls2850335qgf.71.gmail; Wed, 12 Mar 2014 06:24:51 -0700 (PDT) X-Received: by 10.58.170.69 with SMTP id ak5mr764082vec.28.1394630691947; Wed, 12 Mar 2014 06:24:51 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id ue9si6795763veb.130.2014.03.12.06.24.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Mar 2014 06:24:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id cz12so10097464veb.16 for ; Wed, 12 Mar 2014 06:24:51 -0700 (PDT) X-Received: by 10.52.248.138 with SMTP id ym10mr31126282vdc.18.1394630691853; Wed, 12 Mar 2014 06:24:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.78.9 with SMTP id i9csp288151vck; Wed, 12 Mar 2014 06:24:51 -0700 (PDT) X-Received: by 10.194.202.230 with SMTP id kl6mr42543660wjc.9.1394630690611; Wed, 12 Mar 2014 06:24:50 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id p10si14547191wjb.78.2014.03.12.06.24.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 12 Mar 2014 06:24:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WNj9N-00036c-E8; Wed, 12 Mar 2014 13:24:49 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org Subject: [PATCH] target-m68k: Remove custom qemu_assert() function Date: Wed, 12 Mar 2014 13:24:49 +0000 Message-Id: <1394630689-11913-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Remove the custom qemu_assert() function defined by target-m68k/translate.c in favour of either using glib g_assert_not_reached() (for the genuinely can't-happen cases) or cpu_abort() (for the "this isn't implemented", in line with other unimplemented cases in the target). This has the benefit of silencing some clang warnings about variables used while uninitialized (which are emitted because clang can't figure out that qemu_assert(0, something) never returns. Signed-off-by: Peter Maydell Reviewed-by: Andreas Färber --- Since target-m68k is orphan it seems reasonable to just do the minimal amount to at least get it to compile without warnings (even if the warnings are spurious), rather than for instance trying to convert all the unimplemented-behaviour aborts into LOG_UNIMP-and-continue-somehow. target-m68k/translate.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index f54b94a..f747c13 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -110,14 +110,6 @@ void m68k_tcg_init(void) store_dummy = tcg_global_mem_new(TCG_AREG0, -8, "NULL"); } -static inline void qemu_assert(int cond, const char *msg) -{ - if (!cond) { - fprintf (stderr, "badness: %s\n", msg); - abort(); - } -} - /* internal defines */ typedef struct DisasContext { CPUM68KState *env; @@ -199,7 +191,7 @@ static inline TCGv gen_load(DisasContext * s, int opsize, TCGv addr, int sign) tcg_gen_qemu_ld32u(tmp, addr, index); break; default: - qemu_assert(0, "bad load size"); + g_assert_not_reached(); } gen_throws_exception = gen_last_qop; return tmp; @@ -233,7 +225,7 @@ static inline void gen_store(DisasContext *s, int opsize, TCGv addr, TCGv val) tcg_gen_qemu_st32(val, addr, index); break; default: - qemu_assert(0, "bad store size"); + g_assert_not_reached(); } gen_throws_exception = gen_last_qop; } @@ -437,8 +429,7 @@ static inline int opsize_bytes(int opsize) case OS_SINGLE: return 4; case OS_DOUBLE: return 8; default: - qemu_assert(0, "bad operand size"); - return 0; + g_assert_not_reached(); } } @@ -465,8 +456,7 @@ static void gen_partset_reg(int opsize, TCGv reg, TCGv val) tcg_gen_mov_i32(reg, val); break; default: - qemu_assert(0, "Bad operand size"); - break; + g_assert_not_reached(); } } @@ -495,7 +485,7 @@ static inline TCGv gen_extend(TCGv val, int opsize, int sign) tmp = val; break; default: - qemu_assert(0, "Bad operand size"); + g_assert_not_reached(); } return tmp; } @@ -669,7 +659,7 @@ static TCGv gen_ea(CPUM68KState *env, DisasContext *s, uint16_t insn, offset = read_im32(env, s); break; default: - qemu_assert(0, "Bad immediate operand"); + g_assert_not_reached(); } return tcg_const_i32(offset); default: @@ -2092,7 +2082,7 @@ DISAS_INSN(wdebug) return; } /* TODO: Implement wdebug. */ - qemu_assert(0, "WDEBUG not implemented"); + cpu_abort(env, "WDEBUG not implemented"); } DISAS_INSN(trap) @@ -2467,13 +2457,13 @@ DISAS_INSN(fbcc) DISAS_INSN(frestore) { /* TODO: Implement frestore. */ - qemu_assert(0, "FRESTORE not implemented"); + cpu_abort(env, "FRESTORE not implemented"); } DISAS_INSN(fsave) { /* TODO: Implement fsave. */ - qemu_assert(0, "FSAVE not implemented"); + cpu_abort(env, "FSAVE not implemented"); } static inline TCGv gen_mac_extract_word(DisasContext *s, TCGv val, int upper)