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 55AFFC4332F for ; Tue, 7 Nov 2023 11:10:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.628775.980582 (Exim 4.92) (envelope-from ) id 1r0Jyg-0004o0-Dp; Tue, 07 Nov 2023 11:10:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 628775.980582; Tue, 07 Nov 2023 11:10:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r0Jyg-0004nt-BJ; Tue, 07 Nov 2023 11:10:38 +0000 Received: by outflank-mailman (input) for mailman id 628775; Tue, 07 Nov 2023 11:10:37 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r0Jyf-0004nn-7G for xen-devel@lists.xenproject.org; Tue, 07 Nov 2023 11:10:37 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 469a4b62-7d5e-11ee-98da-6d05b1d4d9a1; Tue, 07 Nov 2023 12:10:36 +0100 (CET) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id 8CD554EE0C81; Tue, 7 Nov 2023 12:10:30 +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: 469a4b62-7d5e-11ee-98da-6d05b1d4d9a1 MIME-Version: 1.0 Date: Tue, 07 Nov 2023 12:10:30 +0100 From: Nicola Vetrini To: Jan Beulich Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, George Dunlap , Julien Grall , Wei Liu , Bertrand Marquis , Volodymyr Babchuk , Simone Ballarin , Doug Goldstein , xen-devel@lists.xenproject.org Subject: Re: [RFC PATCH 0/4] address MISRA C:2012 Rule 15.2 In-Reply-To: <88e164aa-4b7f-d86e-3ee6-0f720dcd21ed@suse.com> References: <88e164aa-4b7f-d86e-3ee6-0f720dcd21ed@suse.com> Message-ID: <61648922e51442f7ccaf10ccbc1e0dd2@bugseng.com> 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-11-07 11:52, Jan Beulich wrote: > On 07.11.2023 11:33, Nicola Vetrini wrote: >> This series is aimed at presenting some strategies that can be used to >> deal with >> violations of Rule 15.2: >> "The goto statement shall jump to a label declared later in the same >> function". > > I don't recall this rule being discussed on any of the meetings. > This series is aimed mainly at collecting opinions on the possible resolution strategies, and based on the feedback decide what to focus the discussion on in the meetings. >> The rule's rationale is about possible developer confusion, therefore >> it could >> be argued that there is no substantial gain in complying with it, >> given the >> torough review process in place. > > To be honest, forward goto have potential of developer confusion as > well: All > other entities need to be declared / defined before they can be used. > Just > labels don't. (Or have I missed any other outlier?) IOW if I saw Misra > make > any rule here, I think it ought to suggest to avoid using "goto" > altogether. > > Jan There is Rule 15.1 that says precisely that "do not use goto", but it's advisory and has never been proposed (there are likely hundreds of violations, and some are perhaps legitimate uses of goto). MISRA says that, if 15.1 is not followed, then a constrained use of goto is regulated by subsequent rules 15.2 and 15.3. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)