From patchwork Fri Apr 5 09:14:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Vetrini X-Patchwork-Id: 13618750 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 D93E4CD1299 for ; Fri, 5 Apr 2024 09:14:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701168.1095421 (Exim 4.92) (envelope-from ) id 1rsfev-0000vP-9G; Fri, 05 Apr 2024 09:14:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701168.1095421; Fri, 05 Apr 2024 09:14:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfeu-0000sL-So; Fri, 05 Apr 2024 09:14:52 +0000 Received: by outflank-mailman (input) for mailman id 701168; Fri, 05 Apr 2024 09:14:51 +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 1rsfes-0007cm-TQ for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:50 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f441b1f7-f32c-11ee-afe6-a90da7624cb6; Fri, 05 Apr 2024 11:14:49 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 0464D4EE0748; Fri, 5 Apr 2024 11:14:48 +0200 (CEST) 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: f441b1f7-f32c-11ee-afe6-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall Subject: [XEN PATCH v2 9/9] eclair_analysis: deviate x86 emulator for Rule 16.2 Date: Fri, 5 Apr 2024 11:14:37 +0200 Message-Id: <31647df45bf37e56ab81e1c8830211e60765d5c9.1712305581.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C Rule 16.2 states: "A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement". Since complying with this rule of the x86 emulator would lead to a lot of code duplication, it is deemed better to exempt those files for this guideline. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Stefano Stabellini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 7 +++++++ docs/misra/deviations.rst | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index de9ba723fbc7..c714b7da03dc 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -358,6 +358,13 @@ therefore have the same behavior of a boolean" # Series 16. # +-doc_begin="Complying with the Rule would entail a lot of code duplication in the implementation of the x86 emulator, +therefore it is deemed better to leave such files as is." +-file_tag+={x86_emulate,"^xen/arch/x86/x86_emulate/.*$"} +-file_tag+={x86_svm_emulate,"^xen/arch/x86/hvm/svm/emulate\\.c$"} +-config=MC3R1.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"} +-doc_end + -doc_begin="Switch clauses ending with continue, goto, return statements are safe." -config=MC3R1.R16.3,terminals+={safe, "node(continue_stmt||goto_stmt||return_stmt)"} diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index eb5ef2bd9dd6..28685ce7ab95 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -296,6 +296,12 @@ Deviations related to MISRA C:2012 Rules: therefore have the same behavior of a boolean. - Project-wide deviation; tagged as `deliberate` for ECLAIR. + * - R16.2 + - Complying with the Rule would entail a lot of code duplication in the + implementation of the x86 emulator, therefore it is deemed better to + leave such files as is. + - Tagged as `deliberate` for ECLAIR. + * - R16.3 - Switch clauses ending with continue, goto, return statements are safe. - Tagged as `safe` for ECLAIR.