diff mbox series

[XEN,1/2] docs/misra: add Terms & Definitions section to rules.rst

Message ID 05d9d4b4319f28d602b7366f2964c451a3a50ce3.1714727807.git.federico.serafini@bugseng.com (mailing list archive)
State New
Headers show
Series misra: deviations of Rule 16.4 | expand

Commit Message

Federico Serafini May 3, 2024, 9:58 a.m. UTC
Add a section for terms and definitions used by MISRA but expressed
in terms of the C specification.

Add a definition of "switch clause" to the newly-introduced section.

Link the first use of the term "switch clause" in the document to its
definition.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
Jan you were not completely satisfied by the definition but I didn't find
a better one.
---
 docs/misra/rules.rst | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini May 3, 2024, 11:08 p.m. UTC | #1
On Fri, 3 May 2024, Federico Serafini wrote:
> Add a section for terms and definitions used by MISRA but expressed
> in terms of the C specification.
> 
> Add a definition of "switch clause" to the newly-introduced section.
> 
> Link the first use of the term "switch clause" in the document to its
> definition.
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> Jan you were not completely satisfied by the definition but I didn't find
> a better one.
> ---
>  docs/misra/rules.rst | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index b7b447e152..d3b70fdf04 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -489,8 +489,7 @@ maintainers if you want to suggest a change.
>  
>     * - `Rule 16.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_03.c>`_
>       - Required
> -     - An unconditional break statement shall terminate every
> -       switch-clause
> +     - An unconditional break statement shall terminate every switch-clause_
>       - In addition to break, also other unconditional flow control statements
>         such as continue, return, goto are allowed.
>  
> @@ -712,3 +711,14 @@ maintainers if you want to suggest a change.
>       - The value of a pointer to a FILE shall not be used after the associated
>         stream has been closed
>       -
> +
> +Terms & Definitions
> +-------------------
> +
> +.. _switch-clause:
> +
> +A *switch clause* can be defined as:
> +"the non-empty list of statements which follows a non-empty list of
> +case/default labels".
> +A formal definition is available within the amplification of MISRA C:2012
> +Rule 16.1.
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index b7b447e152..d3b70fdf04 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -489,8 +489,7 @@  maintainers if you want to suggest a change.
 
    * - `Rule 16.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_03.c>`_
      - Required
-     - An unconditional break statement shall terminate every
-       switch-clause
+     - An unconditional break statement shall terminate every switch-clause_
      - In addition to break, also other unconditional flow control statements
        such as continue, return, goto are allowed.
 
@@ -712,3 +711,14 @@  maintainers if you want to suggest a change.
      - The value of a pointer to a FILE shall not be used after the associated
        stream has been closed
      -
+
+Terms & Definitions
+-------------------
+
+.. _switch-clause:
+
+A *switch clause* can be defined as:
+"the non-empty list of statements which follows a non-empty list of
+case/default labels".
+A formal definition is available within the amplification of MISRA C:2012
+Rule 16.1.