[PATCH] xen/misra: add rules 1.4 and 2.1

Stefano Stabellini posted 1 patch 10 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230614230328.1060282-1-sstabellini@kernel.org
There is a newer version of this series
docs/misra/rules.rst | 11 +++++++++++
1 file changed, 11 insertions(+)
[PATCH] xen/misra: add rules 1.4 and 2.1
Posted by Stefano Stabellini 10 months, 3 weeks ago
From: Stefano Stabellini <stefano.stabellini@amd.com>

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 docs/misra/rules.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 41a727ca98..4179e49ac2 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -90,6 +90,17 @@ existing codebase are work-in-progress.
        behaviour
      -
 
+   * - Rule 1.4
+     - Required
+     - Emergent language features shall not be used
+     - Emergent language features, such as C11 features, should not be
+       confused with similar compiler extensions, which we use.
+
+   * - `Rule 2.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_01_1.c>`_
+     - Required
+     - A project shall not contain unreachable code
+     -
+
    * - `Rule 2.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_06.c>`_
      - Advisory
      - A function should not contain unused label declarations
-- 
2.25.1
Re: [PATCH] xen/misra: add rules 1.4 and 2.1
Posted by Michal Orzel 10 months, 3 weeks ago
Hi Stefano,

On 15/06/2023 01:03, Stefano Stabellini wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> ---
>  docs/misra/rules.rst | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 41a727ca98..4179e49ac2 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -90,6 +90,17 @@ existing codebase are work-in-progress.
>         behaviour
>       -
> 
> +   * - Rule 1.4
Just as for the previous patch:
This is incorrect as it should be surrounded by `` similar to other lines.
Otherwise it will not be taken into account by convert_misra_doc.py which converts this document into cppcheck rule list.

~Michal
Re: [PATCH] xen/misra: add rules 1.4 and 2.1
Posted by Stefano Stabellini 10 months, 3 weeks ago
On Thu, 15 Jun 2023, Michal Orzel wrote:
> Hi Stefano,
> 
> On 15/06/2023 01:03, Stefano Stabellini wrote:
> > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> > 
> > 
> > From: Stefano Stabellini <stefano.stabellini@amd.com>
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> > ---
> >  docs/misra/rules.rst | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> > index 41a727ca98..4179e49ac2 100644
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -90,6 +90,17 @@ existing codebase are work-in-progress.
> >         behaviour
> >       -
> > 
> > +   * - Rule 1.4
> Just as for the previous patch:
> This is incorrect as it should be surrounded by `` similar to other lines.
> Otherwise it will not be taken into account by convert_misra_doc.py which converts this document into cppcheck rule list.

OK. I'll add a link to the base directory like I did in the other patch
Re: [PATCH] xen/misra: add rules 1.4 and 2.1
Posted by Jan Beulich 10 months, 3 weeks ago
On 15.06.2023 01:03, Stefano Stabellini wrote:
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -90,6 +90,17 @@ existing codebase are work-in-progress.
>         behaviour
>       -
>  
> +   * - Rule 1.4
> +     - Required
> +     - Emergent language features shall not be used
> +     - Emergent language features, such as C11 features, should not be
> +       confused with similar compiler extensions, which we use.

The plans to possibly use _Generic, as mentioned during the discussion,
are (I think) making this the first case where we accept a rule with
the expectation to later break (deviate) it. I don't think I'm aware of
provisions in this regard, so by accepting the rule in the form you
suggest may well lead to people later pointing here and say "no" to any
attempt to use _Generic. IOW I think it wants clarifying in the text at
the top of the file that there is flexibility to change in how far we
mean to comply to already accepted rules.

Jan
Re: [PATCH] xen/misra: add rules 1.4 and 2.1
Posted by Stefano Stabellini 10 months, 3 weeks ago
On Thu, 15 Jun 2023, Jan Beulich wrote:
> On 15.06.2023 01:03, Stefano Stabellini wrote:
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -90,6 +90,17 @@ existing codebase are work-in-progress.
> >         behaviour
> >       -
> >  
> > +   * - Rule 1.4
> > +     - Required
> > +     - Emergent language features shall not be used
> > +     - Emergent language features, such as C11 features, should not be
> > +       confused with similar compiler extensions, which we use.
> 
> The plans to possibly use _Generic, as mentioned during the discussion,
> are (I think) making this the first case where we accept a rule with
> the expectation to later break (deviate) it. I don't think I'm aware of
> provisions in this regard, so by accepting the rule in the form you
> suggest may well lead to people later pointing here and say "no" to any
> attempt to use _Generic. IOW I think it wants clarifying in the text at
> the top of the file that there is flexibility to change in how far we
> mean to comply to already accepted rules.

I'll do both things:
- expand the comment in the Notes section of 1.4
- also add a comment at the top of the file