diff mbox series

[v3] docs/misra: add 14.3

Message ID 20230908202723.1641469-1-sstabellini@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v3] docs/misra: add 14.3 | expand

Commit Message

Stefano Stabellini Sept. 8, 2023, 8:27 p.m. UTC
From: Stefano Stabellini <stefano.stabellini@amd.com>

Add 14.3, with project-wide deviations.

Also take the opportunity to clarify that parameters of function pointer
types are expected to have names (Rule 8.2).

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
Changes in v3:
- add ,
- add switch(sizeof(...)) and switch(offsetof(...))
---
 docs/misra/rules.rst | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Jan Beulich Sept. 27, 2023, 7:07 a.m. UTC | #1
On 08.09.2023 22:27, Stefano Stabellini wrote:
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Add 14.3, with project-wide deviations.
> 
> Also take the opportunity to clarify that parameters of function pointer
> types are expected to have names (Rule 8.2).
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

I'm not overly happy with ...

> @@ -385,6 +386,18 @@ maintainers if you want to suggest a change.
>       - A loop counter shall not have essentially floating type
>       -
>  
> +   * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_
> +     - Required
> +     - Controlling expressions shall not be invariant
> +     - Due to the extensive usage of IS_ENABLED, sizeof compile-time
> +       checks, and other constructs that are detected as errors by MISRA
> +       C scanners, managing the configuration of a MISRA C scanner for
> +       this rule would be unmanageable. Thus, this rule is adopted with
> +       a project-wide deviation on if, ?:, switch(sizeof(...)), and
> +       switch(offsetof(...)) statements.
> +
> +       while(0) and while(1) and alike are allowed.

... the final result, but seeing that you didn't get any ack in almost
3 weeks:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Bertrand Marquis Sept. 27, 2023, 8:10 a.m. UTC | #2
Hi Stefano,

> On 8 Sep 2023, at 22:27, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Add 14.3, with project-wide deviations.
> 
> Also take the opportunity to clarify that parameters of function pointer
> types are expected to have names (Rule 8.2).
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

I am still not quite sure if we should accept a rule if we are deviating
on so much cases but as we can revisit anyway:

Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> Changes in v3:
> - add ,
> - add switch(sizeof(...)) and switch(offsetof(...))
> ---
> docs/misra/rules.rst | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 34916e266a..ac76e20a9c 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -234,7 +234,8 @@ maintainers if you want to suggest a change.
>    * - `Rule 8.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_02.c>`_
>      - Required
>      - Function types shall be in prototype form with named parameters
> -     -
> +     - Clarification: both function and function pointers types shall
> +       have named parameters.
> 
>    * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
>      - Required
> @@ -385,6 +386,18 @@ maintainers if you want to suggest a change.
>      - A loop counter shall not have essentially floating type
>      -
> 
> +   * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_
> +     - Required
> +     - Controlling expressions shall not be invariant
> +     - Due to the extensive usage of IS_ENABLED, sizeof compile-time
> +       checks, and other constructs that are detected as errors by MISRA
> +       C scanners, managing the configuration of a MISRA C scanner for
> +       this rule would be unmanageable. Thus, this rule is adopted with
> +       a project-wide deviation on if, ?:, switch(sizeof(...)), and
> +       switch(offsetof(...)) statements.
> +
> +       while(0) and while(1) and alike are allowed.
> +
>    * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
>      - Required
>      - A switch-expression shall not have essentially Boolean type
> -- 
> 2.25.1
>
Stefano Stabellini Sept. 27, 2023, 11:52 p.m. UTC | #3
Hi Henry,

This patch is now acked. Should it go in 4.18?

In terms of risk of breaking, it is zero as nothing builds or runs based
on this document.

At the same time, the benefit is also low because the main value of this
document is for future coding changes that would be too late now for
4.18. So the benefits of committing it now are ease of keeping track of
the change and positive PR when we make the 4.18 release and we talk
about the total number of MISRA C rules we adopted.



On Fri, 8 Sep 2023, Stefano Stabellini wrote:
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Add 14.3, with project-wide deviations.
> 
> Also take the opportunity to clarify that parameters of function pointer
> types are expected to have names (Rule 8.2).
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> ---
> Changes in v3:
> - add ,
> - add switch(sizeof(...)) and switch(offsetof(...))
> ---
>  docs/misra/rules.rst | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 34916e266a..ac76e20a9c 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -234,7 +234,8 @@ maintainers if you want to suggest a change.
>     * - `Rule 8.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_02.c>`_
>       - Required
>       - Function types shall be in prototype form with named parameters
> -     -
> +     - Clarification: both function and function pointers types shall
> +       have named parameters.
>  
>     * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
>       - Required
> @@ -385,6 +386,18 @@ maintainers if you want to suggest a change.
>       - A loop counter shall not have essentially floating type
>       -
>  
> +   * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_
> +     - Required
> +     - Controlling expressions shall not be invariant
> +     - Due to the extensive usage of IS_ENABLED, sizeof compile-time
> +       checks, and other constructs that are detected as errors by MISRA
> +       C scanners, managing the configuration of a MISRA C scanner for
> +       this rule would be unmanageable. Thus, this rule is adopted with
> +       a project-wide deviation on if, ?:, switch(sizeof(...)), and
> +       switch(offsetof(...)) statements.
> +
> +       while(0) and while(1) and alike are allowed.
> +
>     * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
>       - Required
>       - A switch-expression shall not have essentially Boolean type
> -- 
> 2.25.1
>
Stefano Stabellini Sept. 27, 2023, 11:53 p.m. UTC | #4
Actually adding Henry

On Wed, 27 Sep 2023, Stefano Stabellini wrote:
> Hi Henry,
> 
> This patch is now acked. Should it go in 4.18?
> 
> In terms of risk of breaking, it is zero as nothing builds or runs based
> on this document.
> 
> At the same time, the benefit is also low because the main value of this
> document is for future coding changes that would be too late now for
> 4.18. So the benefits of committing it now are ease of keeping track of
> the change and positive PR when we make the 4.18 release and we talk
> about the total number of MISRA C rules we adopted.
> 
> 
> 
> On Fri, 8 Sep 2023, Stefano Stabellini wrote:
> > From: Stefano Stabellini <stefano.stabellini@amd.com>
> > 
> > Add 14.3, with project-wide deviations.
> > 
> > Also take the opportunity to clarify that parameters of function pointer
> > types are expected to have names (Rule 8.2).
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> > ---
> > Changes in v3:
> > - add ,
> > - add switch(sizeof(...)) and switch(offsetof(...))
> > ---
> >  docs/misra/rules.rst | 15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> > index 34916e266a..ac76e20a9c 100644
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -234,7 +234,8 @@ maintainers if you want to suggest a change.
> >     * - `Rule 8.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_02.c>`_
> >       - Required
> >       - Function types shall be in prototype form with named parameters
> > -     -
> > +     - Clarification: both function and function pointers types shall
> > +       have named parameters.
> >  
> >     * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
> >       - Required
> > @@ -385,6 +386,18 @@ maintainers if you want to suggest a change.
> >       - A loop counter shall not have essentially floating type
> >       -
> >  
> > +   * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_
> > +     - Required
> > +     - Controlling expressions shall not be invariant
> > +     - Due to the extensive usage of IS_ENABLED, sizeof compile-time
> > +       checks, and other constructs that are detected as errors by MISRA
> > +       C scanners, managing the configuration of a MISRA C scanner for
> > +       this rule would be unmanageable. Thus, this rule is adopted with
> > +       a project-wide deviation on if, ?:, switch(sizeof(...)), and
> > +       switch(offsetof(...)) statements.
> > +
> > +       while(0) and while(1) and alike are allowed.
> > +
> >     * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
> >       - Required
> >       - A switch-expression shall not have essentially Boolean type
> > -- 
> > 2.25.1
> > 
>
Henry Wang Sept. 27, 2023, 11:56 p.m. UTC | #5
Hi Stefano,

> On Sep 28, 2023, at 07:53, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> Actually adding Henry
> 
> On Wed, 27 Sep 2023, Stefano Stabellini wrote:
>> Hi Henry,
>> 
>> This patch is now acked. Should it go in 4.18?

Sure, a doc change should be harmless so:

Release-acked-by: Henry Wang <Henry.Wang@arm.com>

Kind regards,
Henry


>> 
>> In terms of risk of breaking, it is zero as nothing builds or runs based
>> on this document.
>> 
>> At the same time, the benefit is also low because the main value of this
>> document is for future coding changes that would be too late now for
>> 4.18. So the benefits of committing it now are ease of keeping track of
>> the change and positive PR when we make the 4.18 release and we talk
>> about the total number of MISRA C rules we adopted.
>> 
>> 
>> 
>> On Fri, 8 Sep 2023, Stefano Stabellini wrote:
>>> From: Stefano Stabellini <stefano.stabellini@amd.com>
>>> 
>>> Add 14.3, with project-wide deviations.
>>> 
>>> Also take the opportunity to clarify that parameters of function pointer
>>> types are expected to have names (Rule 8.2).
>>> 
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
>>> ---
>>> Changes in v3:
>>> - add ,
>>> - add switch(sizeof(...)) and switch(offsetof(...))
>>> ---
>>> docs/misra/rules.rst | 15 ++++++++++++++-
>>> 1 file changed, 14 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
>>> index 34916e266a..ac76e20a9c 100644
>>> --- a/docs/misra/rules.rst
>>> +++ b/docs/misra/rules.rst
>>> @@ -234,7 +234,8 @@ maintainers if you want to suggest a change.
>>>    * - `Rule 8.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_02.c>`_
>>>      - Required
>>>      - Function types shall be in prototype form with named parameters
>>> -     -
>>> +     - Clarification: both function and function pointers types shall
>>> +       have named parameters.
>>> 
>>>    * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
>>>      - Required
>>> @@ -385,6 +386,18 @@ maintainers if you want to suggest a change.
>>>      - A loop counter shall not have essentially floating type
>>>      -
>>> 
>>> +   * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_
>>> +     - Required
>>> +     - Controlling expressions shall not be invariant
>>> +     - Due to the extensive usage of IS_ENABLED, sizeof compile-time
>>> +       checks, and other constructs that are detected as errors by MISRA
>>> +       C scanners, managing the configuration of a MISRA C scanner for
>>> +       this rule would be unmanageable. Thus, this rule is adopted with
>>> +       a project-wide deviation on if, ?:, switch(sizeof(...)), and
>>> +       switch(offsetof(...)) statements.
>>> +
>>> +       while(0) and while(1) and alike are allowed.
>>> +
>>>    * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
>>>      - Required
>>>      - A switch-expression shall not have essentially Boolean type
>>> -- 
>>> 2.25.1
>>> 
>>
diff mbox series

Patch

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 34916e266a..ac76e20a9c 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -234,7 +234,8 @@  maintainers if you want to suggest a change.
    * - `Rule 8.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_02.c>`_
      - Required
      - Function types shall be in prototype form with named parameters
-     -
+     - Clarification: both function and function pointers types shall
+       have named parameters.
 
    * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
      - Required
@@ -385,6 +386,18 @@  maintainers if you want to suggest a change.
      - A loop counter shall not have essentially floating type
      -
 
+   * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_
+     - Required
+     - Controlling expressions shall not be invariant
+     - Due to the extensive usage of IS_ENABLED, sizeof compile-time
+       checks, and other constructs that are detected as errors by MISRA
+       C scanners, managing the configuration of a MISRA C scanner for
+       this rule would be unmanageable. Thus, this rule is adopted with
+       a project-wide deviation on if, ?:, switch(sizeof(...)), and
+       switch(offsetof(...)) statements.
+
+       while(0) and while(1) and alike are allowed.
+
    * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
      - Required
      - A switch-expression shall not have essentially Boolean type