From nobody Fri Oct 31 04:01:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1749243902; cv=none; d=zohomail.com; s=zohoarc; b=M9ZOkhJXS/u5MOyr7YSbcuQWkhtaMBZSzzu7oGIo5yhxaChHX7XmDNd9Jx1UEcr0K2uVC0sshdkBiGWVPUFUk8tVNIg6ex6ESRn8K8JHJuBDdXvL5jAH29Tg7eZTpuo5jlQiUmTofQ2sdgsqxRyCX7u8Kdu2E+zoYY1Ce0OerkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749243902; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PGd9YkOO//9OYaRcQ2aHPiZWXhoHqBnb3a4m6jy1NSc=; b=YUIWdYY0tbqcXgUBvGBKR2dY1SjRzVEAhJGoEmagMcWAk39d3MotKjD+FsetVt6joFm9RhT5ncRy1JZKjvsAok1e33eYpc3iQEYveCr6g14cRxY7U3BT2W62CYs3Wt1z2wX8ZXTVBCJBqJYT3+caJgNmE2FX4r241PmlhS1qeQ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1749243902242998.5200839882697; Fri, 6 Jun 2025 14:05:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1008878.1388042 (Exim 4.92) (envelope-from ) id 1uNeF0-0000pP-AG; Fri, 06 Jun 2025 21:04:42 +0000 Received: by outflank-mailman (output) from mailman id 1008878.1388042; Fri, 06 Jun 2025 21:04:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uNeF0-0000pI-6j; Fri, 06 Jun 2025 21:04:42 +0000 Received: by outflank-mailman (input) for mailman id 1008878; Fri, 06 Jun 2025 21:04:40 +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 1uNeEy-0000p9-Rz for xen-devel@lists.xenproject.org; Fri, 06 Jun 2025 21:04:40 +0000 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d94b8d4d-4319-11f0-b894-0df219b8e170; Fri, 06 Jun 2025 23:04:35 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 1B5EB629D9; Fri, 6 Jun 2025 21:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9887FC4CEF1; Fri, 6 Jun 2025 21:04:32 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: d94b8d4d-4319-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749243873; bh=X8cYOL4YCMIKMC8uDJlrxH6w/ePZilNmWdJ2hhxLK8U=; h=Date:From:To:cc:Subject:From; b=WB5qk2004qx6eVgaTXdhl4aXvyTOvtYDFZ/sRLesYsRsJhy2iJ2OMBfsG8Ntaug6q U/Y/MHM5ZhQ0d7kUpXtpG1tfCUkI6n4p3iJFUPM/EnLrHbYhEpSkDhAVPJ3BTRC2Rc PPIFktCu69d6Bu2mLBZP/r+m0VvUDZ+Jzap4S4+AvfN4p6X3lwhGhbSGDTHAsbQTRf BQ5CblkmA+2UtkR3jHSxk+CV9Qm99y27gw5XYAQFkmtZnXg3sriZnM8hdFxIKjjX/p ntZjD7qdBovNUzLtN8QKvb34edKXDJYTn+0cfu4BActwJe2RSy/kgFng0x2bwOuGvP Ybw7e/c/m0QdQ== Date: Fri, 6 Jun 2025 14:04:32 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: xen-devel@lists.xenproject.org cc: Andrew Cooper , Stefano Stabellini , michal.orzel@amd.com, jbeulich@suse.com, julien@xen.org, roger.pau@citrix.com, sstabellini@kernel.org, bertrand.marquis@arm.com, federico.serafini@bugseng.com, Nicola Vetrini Subject: [PATCH v4] automation/eclair: update configuration of D4.10 Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1749243903014116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" MISRA C Directive 4.10 states that "Precautions shall be taken in order to prevent the contents of a header file being included more than once". Add a SAF tag to the existing comment on top of cpufeatures.h. Add a header inclusion guard to compile.h. Update ECLAIR configuration to: - extend existing deviation to other comments explicitly saying a file is intended for multiple inclusion; - extend existing deviation to other autogenerated files; - tag the guidelines as clean. Update deviations.rst accordingly. Signed-off-by: Federico Serafini Signed-off-by: Stefano Stabellini --- Changes in v4: - remove deviation for xen/arch/{arm,x86}/include/generated/asm/\* --- automation/eclair_analysis/ECLAIR/deviations.ecl | 11 +++++++---- automation/eclair_analysis/ECLAIR/tagging.ecl | 1 + docs/misra/deviations.rst | 12 ++++++++++++ xen/arch/x86/include/asm/cpufeatures.h | 8 +++++--- xen/include/xen/compile.h.in | 3 +++ xen/tools/process-banner.sed | 5 +++++ 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index 9c67358d46..3b5bc87e1d 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -72,11 +72,14 @@ they are not instances of commented-out code." -config=3DMC3A2.D4.3,reports+=3D{deliberate, "any_area(any_loc(file(arm64_= bitops))&&context(name(int_clear_mask16)))"} -doc_end =20 --doc_begin=3D"Files that are intended to be included more than once do not= need to -conform to the directive." +-doc_begin=3D"Files that are intended to be included more than once (and h= ave +a comment that says this explicitly) do not need to conform to the directi= ve." -config=3DMC3A2.D4.10,reports+=3D{safe, "first_area(text(^/\\* This file i= s intended to be included multiple times\\. \\*/$, begin-4))"} --config=3DMC3A2.D4.10,reports+=3D{safe, "first_area(text(^/\\* Generated f= ile, do not edit! \\*/$, begin-3))"} --config=3DMC3A2.D4.10,reports+=3D{safe, "all_area(all_loc(file(^xen/includ= e/generated/autoconf.h$)))"} +-config=3DMC3A2.D4.10,reports+=3D{safe, "first_area(text(^/\\* Generated f= ile, do not edit! \\*/$, begin-3...begin-2))"} +-doc_end + +-doc_begin=3D"Autogenerated files that do not need to conform to the direc= tive." +-config=3DMC3A2.D4.10,reports+=3D{safe, "all_area(all_loc(file(^xen/includ= e/generated/autoconf\\.h$)))"} -doc_end =20 -doc_begin=3D"Including multiple times a .c file is safe because every fun= ction or data item diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/ecl= air_analysis/ECLAIR/tagging.ecl index f9da5d5f4d..b95f07feb0 100644 --- a/automation/eclair_analysis/ECLAIR/tagging.ecl +++ b/automation/eclair_analysis/ECLAIR/tagging.ecl @@ -23,6 +23,7 @@ "MC3A2.D1.1|| MC3A2.D2.1|| MC3A2.D4.1|| +MC3A2.D4.10|| MC3A2.D4.11|| MC3A2.D4.14|| MC3A2.R1.1|| diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index fe0b1e10a2..63caa8f4a2 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -30,6 +30,18 @@ Deviations related to MISRA C:2012 Directives: not to add an additional encapsulation layer. - Tagged as `deliberate` for ECLAIR. =20 + * - D4.10 + - Files that are intended to be included more than once (and have + a comment that says this explicitly) do not need to conform to the + directive. + - Tagged as `safe` for ECLAIR. + + * - D4.10 + - There are autogenerated files that do not need to comply to the + directive. + - Tagged as `safe` for ECLAIR. Such files are: + - xen/include/generated/autoconf.h + * - D4.10 - Including multiple times a .c file is safe because every function o= r data item it defines would in (the common case) be already defined. diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/= asm/cpufeatures.h index 9e3ed21c02..bd1f00f5d2 100644 --- a/xen/arch/x86/include/asm/cpufeatures.h +++ b/xen/arch/x86/include/asm/cpufeatures.h @@ -1,6 +1,6 @@ -/* - * Explicitly intended for multiple inclusion. - */ +/* This file is intended to be included multiple times. */ +/*#ifndef X86_CPUFEATURES_H */ +/*#define X86_CPUFEATURES_H */ =20 #include =20 @@ -63,3 +63,5 @@ XEN_CPUFEATURE(USE_VMCALL, X86_SYNTH(30)) /* Use V= MCALL instead of VMMCAL =20 /* Total number of capability words, inc synth and bug words. */ #define NCAPINTS (FSCAPINTS + X86_NR_SYNTH + X86_NR_BUG) /* N 32-bit words= worth of info */ + +/*#endif X86_CPUFEATURES_H */ diff --git a/xen/include/xen/compile.h.in b/xen/include/xen/compile.h.in index 3151d1e7d1..9206341ba6 100644 --- a/xen/include/xen/compile.h.in +++ b/xen/include/xen/compile.h.in @@ -1,3 +1,6 @@ +#ifndef XEN_COMPILE_H +#define XEN_COMPILE_H + #define XEN_COMPILE_DATE "@@date@@" #define XEN_COMPILE_TIME "@@time@@" #define XEN_COMPILE_BY "@@whoami@@" diff --git a/xen/tools/process-banner.sed b/xen/tools/process-banner.sed index 56c76558bc..4cf3f9a116 100755 --- a/xen/tools/process-banner.sed +++ b/xen/tools/process-banner.sed @@ -12,3 +12,8 @@ s_(.*)_"\1\\n"_ =20 # Trailing \ on all but the final line. $!s_$_ \\_ + +# Append closing header guard +$a\ +\ +#endif /* XEN_COMPILE_H */ --=20 2.25.1