From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93A26C4167B for ; Mon, 11 Dec 2023 14:55:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.652275.1018031 (Exim 4.92) (envelope-from ) id 1rChgG-0007Up-SW; Mon, 11 Dec 2023 14:54:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 652275.1018031; Mon, 11 Dec 2023 14:54:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rChgG-0007Ug-Oa; Mon, 11 Dec 2023 14:54:48 +0000 Received: by outflank-mailman (input) for mailman id 652275; Mon, 11 Dec 2023 14:54:47 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rChgF-0007Ua-6X for xen-devel@lists.xenproject.org; Mon, 11 Dec 2023 14:54:47 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 38ec11e6-9835-11ee-9b0f-b553b5be7939; Mon, 11 Dec 2023 15:54:45 +0100 (CET) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id D47AC4EE073E; Mon, 11 Dec 2023 15:54:44 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 38ec11e6-9835-11ee-9b0f-b553b5be7939 MIME-Version: 1.0 Date: Mon, 11 Dec 2023 15:54:44 +0100 From: Nicola Vetrini To: Julien Grall Cc: xen-devel@lists.xenproject.org, consulting@bugseng.com, Stefano Stabellini , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: Re: [XEN PATCH 5/7] xen/arm: traps: add ASSERT_UNREACHABLE() where needed In-Reply-To: <08e3c8f0-772e-4c08-9afc-c623f19c85e3@xen.org> References: <394b69b769f2dc2461d2ddb0c7e037f4794eb244.1702283415.git.nicola.vetrini@bugseng.com> <08e3c8f0-772e-4c08-9afc-c623f19c85e3@xen.org> Message-ID: X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 2023-12-11 13:32, Julien Grall wrote: > Hi, > > On 11/12/2023 10:30, Nicola Vetrini wrote: >> The branches of the switch after a call to 'do_unexpected_trap' >> cannot return, but there is one path that may return, hence >> only some clauses are marked with ASSERT_UNREACHABLE(). > I don't understand why this is necessary. The code should never be > reachable because do_unexpected_trap() is a noreturn(). > > Cheers, It was meant as a safeguard against mistakes. There are MISRA rules that deal with this aspect (e.g., a noreturn function should not return), but they are not in Amendment 2, which is what Xen is following. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)