On 09.09.2023 01:03, Stefano Stabellini wrote:
> From: Stefano Stabellini <stefano.stabell...@amd.com>
> 
> During the discussions that led to the acceptance of Rule 2.1, we
> decided on a few exceptions that were not properly recorded in
> rules.rst. Add them now.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabell...@amd.com>
> Acked-by: Jan Beulich <jbeul...@suse.com>
> ---
> Nicola, does this work with ECLAIR?
> 
> I am referring to the locations of the SAF-2-safe tag on top of
> call_psci_system_off, BUG, etc.
> 
> Changes in v3:
> - added SAF-2-safe to safe.json
> - added a few SAF-2-safe examples
> ---
>  docs/misra/rules.rst    | 13 ++++++++++++-
>  docs/misra/safe.json    |  8 ++++++++
>  xen/arch/arm/psci.c     |  1 +
>  xen/arch/x86/shutdown.c |  1 +
>  xen/include/xen/bug.h   |  2 ++
>  5 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 34916e266a..82de4c645d 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -107,7 +107,18 @@ maintainers if you want to suggest a change.
>     * - `Rule 2.1 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_01_1.c>`_
>       - Required
>       - A project shall not contain unreachable code
> -     -
> +     - The following are allowed:
> +         - Invariantly constant conditions, e.g. if(IS_ENABLED(CONFIG_HVM)) 
> { S; }
> +         - Switch with a controlling value statically determined not to
> +           match one or more case statements

I (continue to) consider this as too lax. I don't think we want to permit
something like

void test(uint8_t val)
{
    switch ( val )
    {
    case 0x100:
        ...

Imo like in the earlier bullet point I think this wants limiting to
compile-time constant values, at least initially.

Jan

Reply via email to