diff mbox series

[XEN,13/13] x86/asm: address violations of MISRA C:2012 Directive 4.10

Message ID 7af1f690e486e2872a645463b4ec9d4b07a6c23a.1693228255.git.simone.ballarin@bugseng.com (mailing list archive)
State Superseded
Headers show
Series address violations of MISRA C:2012 Directive 4.10 | expand

Commit Message

Simone Ballarin Aug. 28, 2023, 1:20 p.m. UTC
Amend generation script to address a violation of
MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order
to prevent the contents of a header file being included more than
once").

This patch adds a special comment to the beginning of the header
to make it explicit that the file is generated automatically.

The comment is recognized by ECLAIR and will cause the deviation of
the violation.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 xen/tools/compat-xlat-header.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefano Stabellini Aug. 28, 2023, 10:45 p.m. UTC | #1
On Mon, 28 Aug 2023, Simone Ballarin wrote:
> Amend generation script to address a violation of
> MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order
> to prevent the contents of a header file being included more than
> once").
> 
> This patch adds a special comment to the beginning of the header
> to make it explicit that the file is generated automatically.
> 
> The comment is recognized by ECLAIR and will cause the deviation of
> the violation.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
> ---
>  xen/tools/compat-xlat-header.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/xen/tools/compat-xlat-header.py b/xen/tools/compat-xlat-header.py
> index 2b805b23a8..9e336277ac 100644
> --- a/xen/tools/compat-xlat-header.py
> +++ b/xen/tools/compat-xlat-header.py
> @@ -406,6 +406,8 @@ def main():
>              line = line.strip()
>              header_tokens += re_tokenazier.split(line)
>  
> +    print("/* Generated file, do not edit! */")

I think it might be a good idea regardless of MISRA compliance to add
this comment.

However for MISRA compliance I think we should document somewhere other
than ECLAIR config file that "Generated file, do not edit!" is being
used as a MISRA C deviation marker.

I think we should add a special note to safe.json, or alternatively also
add the safe.json tag to the comment:

print("/* SAF-1-safe Generated file, do not edit! */")


>      with open(sys.argv[2]) as compat_list:
>          for line in compat_list:
>              words = re_tokenazier.split(line, maxsplit=1)
diff mbox series

Patch

diff --git a/xen/tools/compat-xlat-header.py b/xen/tools/compat-xlat-header.py
index 2b805b23a8..9e336277ac 100644
--- a/xen/tools/compat-xlat-header.py
+++ b/xen/tools/compat-xlat-header.py
@@ -406,6 +406,8 @@  def main():
             line = line.strip()
             header_tokens += re_tokenazier.split(line)
 
+    print("/* Generated file, do not edit! */")
+
     with open(sys.argv[2]) as compat_list:
         for line in compat_list:
             words = re_tokenazier.split(line, maxsplit=1)