[PATCH] docs/misra: add Rules 8.2, 8.3, 8.14

Stefano Stabellini posted 1 patch 10 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230621012618.2661337-1-sstabellini@kernel.org
docs/misra/rules.rst | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
[PATCH] docs/misra: add Rules 8.2, 8.3, 8.14
Posted by Stefano Stabellini 10 months, 1 week ago
From: Stefano Stabellini <stefano.stabellini@amd.com>

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

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 11b9c42b70..9caf43968c 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
      - Types shall be explicitly specified
      -
 
+   * - `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
+     -
+
+   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
+     - Required
+     - All declarations of an object or function shall use the same
+       names and type qualifiers
+     -
+
    * - `Rule 8.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_04.c>`_
      - Required
      - A compatible declaration shall be visible when an object or
@@ -248,6 +259,11 @@ maintainers if you want to suggest a change.
        enumeration constant shall be unique
      -
 
+   * - `Rule 8.14 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_14.c>`_
+     - Required
+     - The restrict type qualifier shall not be used
+     -
+
    * - `Rule 9.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_01.c>`_
      - Mandatory
      - The value of an object with automatic storage duration shall not
-- 
2.25.1
Re: [PATCH] docs/misra: add Rules 8.2, 8.3, 8.14
Posted by Bertrand Marquis 10 months ago
Hi Stefano,

> On 21 Jun 2023, at 03:26, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

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

Cheers
Bertrand

> ---
> docs/misra/rules.rst | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 11b9c42b70..9caf43968c 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
>      - Types shall be explicitly specified
>      -
> 
> +   * - `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
> +     -
> +
> +   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
> +     - Required
> +     - All declarations of an object or function shall use the same
> +       names and type qualifiers
> +     -
> +
>    * - `Rule 8.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_04.c>`_
>      - Required
>      - A compatible declaration shall be visible when an object or
> @@ -248,6 +259,11 @@ maintainers if you want to suggest a change.
>        enumeration constant shall be unique
>      -
> 
> +   * - `Rule 8.14 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_14.c>`_
> +     - Required
> +     - The restrict type qualifier shall not be used
> +     -
> +
>    * - `Rule 9.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_01.c>`_
>      - Mandatory
>      - The value of an object with automatic storage duration shall not
> -- 
> 2.25.1
> 
Re: [PATCH] docs/misra: add Rules 8.2, 8.3, 8.14
Posted by Jan Beulich 10 months, 1 week ago
On 21.06.2023 03:26, Stefano Stabellini wrote:
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
>       - Types shall be explicitly specified
>       -
>  
> +   * - `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
> +     -
> +
> +   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
> +     - Required
> +     - All declarations of an object or function shall use the same
> +       names and type qualifiers
> +     -

I think we want to deal with uses of const when not qualifying a pointed-to
type: One approach is to simply say we don't use const like this (and the
few uses there are should then go away). The other, if we deem this a
valuable feature, would be to make a project-wide exception for this case,
as having such const in declarations is meaningless and hence at the risk
of being confusing or hampering readability.

Jan
Re: [PATCH] docs/misra: add Rules 8.2, 8.3, 8.14
Posted by Stefano Stabellini 10 months, 1 week ago
On Wed, 21 Jun 2023, Jan Beulich wrote:
> On 21.06.2023 03:26, Stefano Stabellini wrote:
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
> >       - Types shall be explicitly specified
> >       -
> >  
> > +   * - `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
> > +     -
> > +
> > +   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
> > +     - Required
> > +     - All declarations of an object or function shall use the same
> > +       names and type qualifiers
> > +     -
> 
> I think we want to deal with uses of const when not qualifying a pointed-to
> type: One approach is to simply say we don't use const like this (and the
> few uses there are should then go away). The other, if we deem this a
> valuable feature, would be to make a project-wide exception for this case,
> as having such const in declarations is meaningless and hence at the risk
> of being confusing or hampering readability.

I think they should go away (the first option you wrote).

If you are OK with it, I could add a note here, such as:

"The rule also applies to differences in const-ness."
Re: [PATCH] docs/misra: add Rules 8.2, 8.3, 8.14
Posted by Jan Beulich 10 months, 1 week ago
On 21.06.2023 23:38, Stefano Stabellini wrote:
> On Wed, 21 Jun 2023, Jan Beulich wrote:
>> On 21.06.2023 03:26, Stefano Stabellini wrote:
>>> --- a/docs/misra/rules.rst
>>> +++ b/docs/misra/rules.rst
>>> @@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
>>>       - Types shall be explicitly specified
>>>       -
>>>  
>>> +   * - `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
>>> +     -
>>> +
>>> +   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
>>> +     - Required
>>> +     - All declarations of an object or function shall use the same
>>> +       names and type qualifiers
>>> +     -
>>
>> I think we want to deal with uses of const when not qualifying a pointed-to
>> type: One approach is to simply say we don't use const like this (and the
>> few uses there are should then go away). The other, if we deem this a
>> valuable feature, would be to make a project-wide exception for this case,
>> as having such const in declarations is meaningless and hence at the risk
>> of being confusing or hampering readability.
> 
> I think they should go away (the first option you wrote).
> 
> If you are OK with it, I could add a note here, such as:
> 
> "The rule also applies to differences in const-ness."

I don't think that's necessary. A remark would be necessary if we meant to
make a particular exception. I'm not sure whether we would record the
agreed upon course of action here (i.e. as you say, drop such const).

Jan