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 |
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 --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)
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(+)