[PATCH RFC 5/5] x86/shadow: Deviate multi.h as being included multiple times

Andrew Cooper posted 5 patches 1 day, 9 hours ago
[PATCH RFC 5/5] x86/shadow: Deviate multi.h as being included multiple times
Posted by Andrew Cooper 1 day, 9 hours ago
This resolves the Eclair complaint about a MISRA D4.10 violation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: consulting@bugseng.com <consulting@bugseng.com>
CC: Nicola Vetrini <nicola.vetrini@bugseng.com>

RFC - this doesn't actually squash the violation, despite being the requisite
magic string.  I suspect the Eclair config needs tweaking to allow the magic
anchor string to be after the SDPX tag.
---
 xen/arch/x86/mm/shadow/multi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/mm/shadow/multi.h b/xen/arch/x86/mm/shadow/multi.h
index fc86d7a8d9cd..b4a6cf1362a6 100644
--- a/xen/arch/x86/mm/shadow/multi.h
+++ b/xen/arch/x86/mm/shadow/multi.h
@@ -2,6 +2,8 @@
 /******************************************************************************
  * arch/x86/mm/shadow/multi.h
  *
+ * This file is intended to be included multiple times.
+ *
  * Shadow declarations which will be multiply compiled.
  * Parts of this code are Copyright (c) 2006 by XenSource Inc.
  * Parts of this code are Copyright (c) 2006 by Michael A Fetterman
-- 
2.39.5


Re: [PATCH RFC 5/5] x86/shadow: Deviate multi.h as being included multiple times
Posted by Nicola Vetrini 1 day, 1 hour ago
On 2025-12-12 23:20, Andrew Cooper wrote:
> This resolves the Eclair complaint about a MISRA D4.10 violation.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: consulting@bugseng.com <consulting@bugseng.com>
> CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
> 
> RFC - this doesn't actually squash the violation, despite being the 
> requisite
> magic string.  I suspect the Eclair config needs tweaking to allow the 
> magic
> anchor string to be after the SDPX tag.
> ---

I think it's just a matter of positioning. The location of the violation 
is at line 11 (the first non-comment statement of the file, and the 
string is matched in a range of -4 lines from that point:

-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is 
intended to be included multiple times\\. \\*/$, begin-4))"}

so I think moving it just below the copyright lines or increasing the 
range should do the trick.

>  xen/arch/x86/mm/shadow/multi.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/xen/arch/x86/mm/shadow/multi.h 
> b/xen/arch/x86/mm/shadow/multi.h
> index fc86d7a8d9cd..b4a6cf1362a6 100644
> --- a/xen/arch/x86/mm/shadow/multi.h
> +++ b/xen/arch/x86/mm/shadow/multi.h
> @@ -2,6 +2,8 @@
>  
> /******************************************************************************
>   * arch/x86/mm/shadow/multi.h
>   *
> + * This file is intended to be included multiple times.
> + *
>   * Shadow declarations which will be multiply compiled.
>   * Parts of this code are Copyright (c) 2006 by XenSource Inc.
>   * Parts of this code are Copyright (c) 2006 by Michael A Fetterman

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253