On Thu, Jun 09, 2022 at 05:48:26PM -0700, Stefano Stabellini wrote:
> Add the new MISRA C rules agreed by the MISRA C working group to
> docs/misra/rules.rst.
>
> Signed-off-by: Stefano Stabellini <[email protected]>
>
> ---
>
> I added the rules that we agreed upon this morning together with all the
> notes we discussed, in particular:
>
> - macros as macro parameters at invocation time for Rule 5.3
> - the clarification of Rule 9.1
> - gnu_inline exception for Rule 8.10
>
>
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 6ccff07765..5c28836bc8 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -89,6 +89,28 @@ existing codebase are work-in-progress.
> (xen/include/public/) are allowed to retain longer identifiers
> for backward compatibility.
>
> + * - `Rule 5.2
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_05_02.c>`_
> + - Required
> + - Identifiers declared in the same scope and name space shall be
> + distinct
> + - The Xen characters limit for identifiers is 40. Public headers
> + (xen/include/public/) are allowed to retain longer identifiers
> + for backward compatibility.
> +
> + * - `Rule 5.3
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_05_03.c>`_
> + - Required
> + - An identifier declared in an inner scope shall not hide an
> + identifier declared in an outer scope
> + - Using macros as macro parameters at invocation time is allowed,
> + e.g. MAX(var0, MIN(var1, var2))
I think you want to use the {min,max}_t macros as examples, because
those do define local variables.
The rest LGTM:
Acked-by: Roger Pau Monné <[email protected]>
Thanks.