From patchwork Thu May 5 09:11:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 569927 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp584831mal; Thu, 5 May 2022 02:21:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOXAaDaUNrtFGkSbeWEQhkyWBXM00OrzB7074MuVD3DK94IM8lbrtm36atNzpU6ybxPyg+ X-Received: by 2002:a37:b741:0:b0:69e:689f:7639 with SMTP id h62-20020a37b741000000b0069e689f7639mr18064638qkf.160.1651742519116; Thu, 05 May 2022 02:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651742519; cv=none; d=google.com; s=arc-20160816; b=FBNRFMEIPDIx8TxS6T3269ME/6JTD9Up9f/v9hDMn0dIBYSq9wZ98MoEdvON394tZ3 lpnlsHs7WNJUKHDN2o8VF5S8IQZsoNWMdLkpvpjGjuSLZ88ItaUZwY1O/Y4atUsqbb2S MulbAfvsPISz0YejZjTJf+VS6M+3FLZahOL6/SD69VimVzr7XsG9k4iWH2lm90cuyTA9 GfY8uR3KQ9fCH1PWbJOAgiJvfC3Gw4Ah/f5XB0EkmpYS0klGbbK2uttFqB+rwam49OZz ooR+s1jzJjcYLkHUICUY4cKHZJFiRjP780VKagjV2HLWXnV+8ARBqlcUkX+ApsleW4BX 34Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hSAkfjiq8NHovzsRkuZFZACusQ6Byf9p05IGivYIsEk=; b=0XCojwCFn7olsuHCmkxMSomY0BqxI3olV+EjLOk/7pa5mSMCps8AWo6VBvEKmKmM2j ucNb/cRlpHPDMwOjk64IFfjDvIDHvH+wD3rLXko6zY5NLL9j2iLXlPnf3s1Dotx2/OGo Wr0lfhSJoMGVyU0/9cDUMEHEKu/fj+O4WHfvWtFtPddDdbd/co38Z7W0afGCLXnrXiTT oKOUzQ9OQv3WVR6Gl+aAxIWtFwt9ZIrp3271x2jZIv6sGq7OJ9tRJ4adFqlZ1PWJjR4E m4XFNgZKHVdxU68JDFN9fJa5Z5lSRYluN/egr/rGUQMBhp7vNXOxEsEy6v0bxbiC1f2D jziQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BnnXWoEl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c8-20020ac87d88000000b002f3b8bfe203si473001qtd.150.2022.05.05.02.21.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 May 2022 02:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BnnXWoEl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmXgM-0006PE-Ld for patch@linaro.org; Thu, 05 May 2022 05:21:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmXWi-00051f-Um for qemu-devel@nongnu.org; Thu, 05 May 2022 05:12:01 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:43667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nmXWh-0003HP-5y for qemu-devel@nongnu.org; Thu, 05 May 2022 05:12:00 -0400 Received: by mail-wm1-x331.google.com with SMTP id r1-20020a1c2b01000000b00394398c5d51so2243166wmr.2 for ; Thu, 05 May 2022 02:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hSAkfjiq8NHovzsRkuZFZACusQ6Byf9p05IGivYIsEk=; b=BnnXWoEls/1ZUJBnUPnoGJEGoOKXhnk/9Ow5zmAyIOlY8sKr4PEIsRP9xJopWGM187 OD0rFpZHJE20Qj/7UlsYWbFBg6mP2HTpXNtUuzL49fc8ANX/AuC8GctRY35zVNDsBMKE ribhN4T3tDVCU5XqNbvRtiXyKKz+xoObpo7E1xeIT7jrHn5buFDFhvTID6LVNEWseL6y rgQUVis9hVrHpUqWRETzbBQ0HZMBLGfGkdVTVzv5/D7szD50V9F8PjhNsCV9SnnBoLQZ Zpwyhdw/w/fBhnp+0INwwE7A+UB55ka0PjY7fZQMvLdpMz35/04ZqXQJsZ2cm5lSYwSu 7MCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hSAkfjiq8NHovzsRkuZFZACusQ6Byf9p05IGivYIsEk=; b=m1FCV3wqIi5VKr0jLuwsQlaQpuI+qIyFbz7ONsqprxQ+F5ijy77Z9RG2Um63d+K43a y8atYVsfPjZwH3HECyohWCrLem2iOmlUkpjebCiM7kH4X1t16YvxMyf1Lf8jyjN5UuY2 /XG7iIVvaoth1QzxGtcwxL+1SiIJwioD9eGp4DypMa18/7cQa4Xw6Vol0ftNUyF7PCil SUoa9zvzNsOPRedtKasZAZ6n5MX7oFiwFwvABgN9Pyh4E6utC83xnTIqJic92fcdiblr 20AdZIS7X00rZu9lUjVmBYXpwdy+xO8MRGj6Ap+z2dd27utdFySKsb/XUwfKJey4XMbJ D2nw== X-Gm-Message-State: AOAM533i1Ea4wYho38EgOVk8hgHDppJGG95iKtKkbhAUtSGDljzbipT0 TCTIAn9ddti1F3SfsQrFJdcweoN7dibKqQ== X-Received: by 2002:a7b:ce04:0:b0:394:1f46:213 with SMTP id m4-20020a7bce04000000b003941f460213mr3489656wmc.157.1651741917613; Thu, 05 May 2022 02:11:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j14-20020adfe50e000000b0020c6a524fd5sm841612wrm.99.2022.05.05.02.11.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 02:11:57 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/23] target/arm: Avoid bare abort() or assert(0) Date: Thu, 5 May 2022 10:11:31 +0100 Message-Id: <20220505091147.2657652-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220505091147.2657652-1-peter.maydell@linaro.org> References: <20220505091147.2657652-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Standardize on g_assert_not_reached() for "should not happen". Retain abort() when preceeded by fprintf or error_report. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20220501055028.646596-7-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 7 +++---- target/arm/hvf/hvf.c | 2 +- target/arm/kvm-stub.c | 4 ++-- target/arm/kvm.c | 4 ++-- target/arm/machine.c | 4 ++-- target/arm/translate-a64.c | 4 ++-- target/arm/translate-neon.c | 2 +- target/arm/translate.c | 4 ++-- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index f84377babe1..06f8864c778 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8740,8 +8740,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, break; default: /* broken reginfo with out-of-range opc1 */ - assert(false); - break; + g_assert_not_reached(); } /* assert our permissions are not too lax (stricter is fine) */ assert((r->access & ~mask) == 0); @@ -10823,7 +10822,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, break; default: /* Never happens, but compiler isn't smart enough to tell. */ - abort(); + g_assert_not_reached(); } } *prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot); @@ -10944,7 +10943,7 @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, break; default: /* Never happens, but compiler isn't smart enough to tell. */ - abort(); + g_assert_not_reached(); } } if (domain_prot == 3) { diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index b11a8b9a189..86710509d20 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1200,7 +1200,7 @@ int hvf_vcpu_exec(CPUState *cpu) /* we got kicked, no exit to process */ return 0; default: - assert(0); + g_assert_not_reached(); } hvf_sync_vtimer(cpu); diff --git a/target/arm/kvm-stub.c b/target/arm/kvm-stub.c index 56a7099e6b9..965a486b320 100644 --- a/target/arm/kvm-stub.c +++ b/target/arm/kvm-stub.c @@ -15,10 +15,10 @@ bool write_kvmstate_to_list(ARMCPU *cpu) { - abort(); + g_assert_not_reached(); } bool write_list_to_kvmstate(ARMCPU *cpu, int level) { - abort(); + g_assert_not_reached(); } diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 5fc37ac10a5..4339e1cd6e0 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -540,7 +540,7 @@ bool write_kvmstate_to_list(ARMCPU *cpu) ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &r); break; default: - abort(); + g_assert_not_reached(); } if (ret) { ok = false; @@ -575,7 +575,7 @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level) r.addr = (uintptr_t)(cpu->cpreg_values + i); break; default: - abort(); + g_assert_not_reached(); } ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &r); if (ret) { diff --git a/target/arm/machine.c b/target/arm/machine.c index 135d2420b5c..285e387d2c3 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -661,7 +661,7 @@ static int cpu_pre_save(void *opaque) if (kvm_enabled()) { if (!write_kvmstate_to_list(cpu)) { /* This should never fail */ - abort(); + g_assert_not_reached(); } /* @@ -672,7 +672,7 @@ static int cpu_pre_save(void *opaque) } else { if (!write_cpustate_to_list(cpu, false)) { /* This should never fail. */ - abort(); + g_assert_not_reached(); } } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a82f5d5984b..b80313670f9 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -6151,7 +6151,7 @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn) gen_helper_advsimd_rinth(tcg_res, tcg_op, fpst); break; default: - abort(); + g_assert_not_reached(); } write_fp_sreg(s, rd, tcg_res); @@ -6392,7 +6392,7 @@ static void handle_fp_fcvt(DisasContext *s, int opcode, break; } default: - abort(); + g_assert_not_reached(); } } diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c index 2e4d1ec87d9..321c17e2c7e 100644 --- a/target/arm/translate-neon.c +++ b/target/arm/translate-neon.c @@ -679,7 +679,7 @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) } break; default: - abort(); + g_assert_not_reached(); } if ((vd + a->stride * (nregs - 1)) > 31) { /* diff --git a/target/arm/translate.c b/target/arm/translate.c index 050c237b076..4e19191ed5c 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -5156,7 +5156,7 @@ static void gen_srs(DisasContext *s, offset = 4; break; default: - abort(); + g_assert_not_reached(); } tcg_gen_addi_i32(addr, addr, offset); tmp = load_reg(s, 14); @@ -5181,7 +5181,7 @@ static void gen_srs(DisasContext *s, offset = 0; break; default: - abort(); + g_assert_not_reached(); } tcg_gen_addi_i32(addr, addr, offset); gen_helper_set_r13_banked(cpu_env, tcg_constant_i32(mode), addr);