From patchwork Mon Mar 11 08:59:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588375 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 10534C54E66 for ; Mon, 11 Mar 2024 09:00:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691272.1077133 (Exim 4.92) (envelope-from ) id 1rjbWB-0000er-6q; Mon, 11 Mar 2024 09:00:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691272.1077133; Mon, 11 Mar 2024 09:00:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbWA-0000aS-JB; Mon, 11 Mar 2024 09:00:22 +0000 Received: by outflank-mailman (input) for mailman id 691272; Mon, 11 Mar 2024 09:00:18 +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 1rjbW6-0006iu-Pw for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:18 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c85b0784-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:18 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 65B984EE0C9E; Mon, 11 Mar 2024 10:00:17 +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: c85b0784-df85-11ee-afdc-a90da7624cb6 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Maria Celeste Cesario , Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu , =?utf-8?q?Roger_Pau_Mo?= =?utf-8?q?nn=C3=A9?= Subject: [XEN PATCH v3 13/16] xen: add deviations for MISRA C.2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:22 +0100 Message-Id: <787aa5a65135796c825d366b43e00ba018c0065b.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add safe deviation for *.c files, as estabilished in past discussion. Add SAF deviation for files that need an #include directive before guard. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- Commit introduced in v3 Link to the discussion thread: https://lists.xenproject.org/archives/html/xen-devel/2023-09/msg00239.html --- automation/eclair_analysis/ECLAIR/deviations.ecl | 5 +++++ docs/misra/deviations.rst | 7 +++++++ docs/misra/safe.json | 8 ++++++++ xen/include/public/arch-x86/xen.h | 1 + 4 files changed, 21 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 039ffaf52a..8082239ccc 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -69,6 +69,11 @@ conform to the directive." -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"} -doc_end +-doc_begin="Including multiple times a .c file is safe because every function or data item +it defines would (in the common case) be already defined. Peer reviewed by the community." +-config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(^.*\\.c$))"} +-doc_end + # # Series 5. # diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index ce855ddae6..7b32dbd23f 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -30,6 +30,13 @@ Deviations related to MISRA C:2012 Directives: not to add an additional encapsulation layer. - Tagged as `deliberate` for ECLAIR. + * - D4.10 + - Including multiple times a .c file is safe because every function or data item + it defines would in (the common case) be already defined. + Peer reviewed by the community. + - Tagged as `safe` for ECLAIR. + + Deviations related to MISRA C:2012 Rules: ----------------------------------------- diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 13208d18ec..dd61b47194 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -60,6 +60,14 @@ }, { "id": "SAF-7-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: include needed before guard", + "text": "These files need to start with an include directive to generate preprocessed code in the correct order." + }, + { + "id": "SAF-8-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index c0f4551247..0b2e9271f8 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -7,6 +7,7 @@ * Copyright (c) 2004-2006, K A Fraser */ +/* SAF-7-safe include before guard needed for correct code generation */ #include "../xen.h" #ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__