From nobody Mon Feb 9 19:32:56 2026 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=1748912491; cv=none; d=zohomail.com; s=zohoarc; b=UCkwvJab6QObPgN9mRU2rHOqV9qOpBTDvtQnJL+Y1DXWf8RNbZSrdiiooIE/Su/Wwf7i4x7Amm+0MFmUzy27gi3mcSE1yHrAZZ9ECdMMdfAe+oyVvCRP+5CTmdv0g5QCt8HJcAJtMCEkypTzO7jc+pO/igc5ABiWm8D0/CE15YI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748912491; 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=y+IZMiiKA65OmGYa7H6U4pHNspo7/mApHRVd8ndtQ74=; b=bLf6j/yoWrFDvi+viP2hc3aIVf51bDIWPEwA3TUSC5YlOgNbr4yRgY8zwFae/TKY7S6Wteabh1UfAlJKjsUUDnaBwUU+4nD8PxjMtOgYaPLCjWM0ZJJsdlwoMW0ebwnZHgcPuPedNN7rN63rvxk4F6f4zb83ExOQqQwEBt3wQpI= 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 1748912491536648.3743212676883; Mon, 2 Jun 2025 18:01:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1003942.1383574 (Exim 4.92) (envelope-from ) id 1uMG1g-0003US-DP; Tue, 03 Jun 2025 01:01:12 +0000 Received: by outflank-mailman (output) from mailman id 1003942.1383574; Tue, 03 Jun 2025 01:01:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uMG1g-0003TR-9r; Tue, 03 Jun 2025 01:01:12 +0000 Received: by outflank-mailman (input) for mailman id 1003942; Tue, 03 Jun 2025 01:01:11 +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 1uMG1f-0002ih-1A for xen-devel@lists.xenproject.org; Tue, 03 Jun 2025 01:01:11 +0000 Received: from tor.source.kernel.org (tor.source.kernel.org [2600:3c04:e001:324:0:1991:8:25]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 36d545eb-4016-11f0-b894-0df219b8e170; Tue, 03 Jun 2025 03:01:00 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 859F961155; Tue, 3 Jun 2025 01:00:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3049AC4CEEB; Tue, 3 Jun 2025 01:00:57 +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: 36d545eb-4016-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748912458; bh=gUWEOxy+ArxWs2+pcdbzIbJgdOuvw8mAqKKAjxlWx/U=; h=Date:From:To:cc:Subject:From; b=nAjLZ/1/2kXG1NmErzRnMeIeaWRt0rCj30kDhhJlqoWcfzymBZU25IKfrnOF9SX8j Tx8DLhXczRAxpmnkCfU+cHrlFvd5f5RsYqjHFlQzKgSQ9F2cmRW74FvKbnf01NXIcS TS9G4u0blI/Y7gNjpqcNP4y2W1fuDVYo6Yu70QkDF727yuqKzhk/AzS9vDst04anbb 4ctVesektOE18CILlhOOOHaqDw25gCD7DW5LiZP7Mn3SzM1gPvgVSmXg89hM0y0cfS ygpXEqWwBAN6Bj1I3FQ2NeQ+GIHpAF1KAyHL10jVGmfsz91UKuONLv+a6MqejhKKqK l5b2XZSYbd6ow== Date: Mon, 2 Jun 2025 18:00:55 -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 v2] 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: 1748912492753116600 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 v2: - merge the two "Generated file, do not edit!" deviations into one - change cpufeatures.h deviation to SAF - remove compile.h deviation and change compile.h.in instead --- diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index 9c67358d46..3490db5a13 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -72,11 +72,16 @@ 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$)))"} +-config=3DMC3A2.D4.10,reports+=3D{safe, "all_area(all_loc(file(^xen/includ= e/compat/xlat\\.h$)))"} +-config=3DMC3A2.D4.10,reports+=3D{safe, "all_area(all_loc(file(^xen/arch/(= arm||x86)/include/generated/asm/.*$)))"} -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..57580fff5f 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -30,6 +30,20 @@ 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 + - xen/include/compat/xlat.h + - xen/arch/{arm,x86}/include/generated/asm/\* + * - 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..02d5250b08 100644 --- a/xen/arch/x86/include/asm/cpufeatures.h +++ b/xen/arch/x86/include/asm/cpufeatures.h @@ -1,5 +1,5 @@ /* - * Explicitly intended for multiple inclusion. + * SAF-8-safe: Explicitly intended for multiple inclusion. */ =20 #include 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..2c56b5939d 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 */