diff mbox series

[v2] docs/misra: add R17.2 and R18.2

Message ID alpine.DEB.2.22.394.2409181322070.1417852@ubuntu-linux-20-04-desktop (mailing list archive)
State New
Headers show
Series [v2] docs/misra: add R17.2 and R18.2 | expand

Commit Message

Stefano Stabellini Sept. 18, 2024, 8:23 p.m. UTC
The Xen community is already informally following both rules. Let's make
it explicit. Both rules have zero violations, only cautions. While we
want to go down to zero cautions in time, adding both rules to rules.rst
enables us to immediately make both rules gating in the ECLAIR job part
of gitlab-ci.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
Changes in v2:
- improve the note of 17.2

Comments

Bertrand Marquis Sept. 19, 2024, 11:53 a.m. UTC | #1
Hi Stefano,

> On 18 Sep 2024, at 22:23, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> The Xen community is already informally following both rules. Let's make
> it explicit. Both rules have zero violations, only cautions. While we
> want to go down to zero cautions in time, adding both rules to rules.rst
> enables us to immediately make both rules gating in the ECLAIR job part
> of gitlab-ci.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

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

Cheers
Bertrand

> ---
> Changes in v2:
> - improve the note of 17.2
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index e99cb81089..4a144da8d6 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -561,6 +561,13 @@ maintainers if you want to suggest a change.
>      - The features of <stdarg.h> shall not be used
>      -
> 
> +   * - `Rule 17.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_02.c>`_
> +     - Required
> +     - Functions shall not call themselves, either directly or indirectly
> +     - Limited forms of recursion are allowed if the recursion is bound
> +       (there is an upper limit and the upper limit is enforced.) The
> +       bounding should be explained in a comment or in a deviation.
> +
>    * - `Rule 17.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_03.c>`_
>      - Mandatory
>      - A function shall not be declared implicitly
> @@ -593,6 +600,12 @@ maintainers if you want to suggest a change.
>        submitting new patches please try to decrease the number of
>        violations when possible.
> 
> +   * - `Rule 18.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_01.c>`_
> +     - Required
> +     - A pointer resulting from arithmetic on a pointer operand shall
> +       address an element of the same array as that pointer operand
> +     -
> +
>    * - `Rule 18.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_02.c>`_
>      - Required
>      - Subtraction between pointers shall only be applied to pointers
Jan Beulich Sept. 23, 2024, 10:03 a.m. UTC | #2
On 18.09.2024 22:23, Stefano Stabellini wrote:
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -561,6 +561,13 @@ maintainers if you want to suggest a change.
>       - The features of <stdarg.h> shall not be used
>       -
>  
> +   * - `Rule 17.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_02.c>`_
> +     - Required
> +     - Functions shall not call themselves, either directly or indirectly
> +     - Limited forms of recursion are allowed if the recursion is bound

Nit: Doesn't this want to be "bounded"?

Jan
Andrew Cooper Sept. 23, 2024, 10:08 a.m. UTC | #3
On 23/09/2024 11:03 am, Jan Beulich wrote:
> On 18.09.2024 22:23, Stefano Stabellini wrote:
>> --- a/docs/misra/rules.rst
>> +++ b/docs/misra/rules.rst
>> @@ -561,6 +561,13 @@ maintainers if you want to suggest a change.
>>       - The features of <stdarg.h> shall not be used
>>       -
>>  
>> +   * - `Rule 17.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_02.c>`_
>> +     - Required
>> +     - Functions shall not call themselves, either directly or indirectly
>> +     - Limited forms of recursion are allowed if the recursion is bound
> Nit: Doesn't this want to be "bounded"?

Yes, it does.

Everything else looks ok, grammar wise.

~Andrew
diff mbox series

Patch

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index e99cb81089..4a144da8d6 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -561,6 +561,13 @@  maintainers if you want to suggest a change.
      - The features of <stdarg.h> shall not be used
      -
 
+   * - `Rule 17.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_02.c>`_
+     - Required
+     - Functions shall not call themselves, either directly or indirectly
+     - Limited forms of recursion are allowed if the recursion is bound
+       (there is an upper limit and the upper limit is enforced.) The
+       bounding should be explained in a comment or in a deviation.
+
    * - `Rule 17.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_03.c>`_
      - Mandatory
      - A function shall not be declared implicitly
@@ -593,6 +600,12 @@  maintainers if you want to suggest a change.
        submitting new patches please try to decrease the number of
        violations when possible.
 
+   * - `Rule 18.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_01.c>`_
+     - Required
+     - A pointer resulting from arithmetic on a pointer operand shall
+       address an element of the same array as that pointer operand
+     -
+
    * - `Rule 18.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_02.c>`_
      - Required
      - Subtraction between pointers shall only be applied to pointers