On Wed, 30 Aug 2023, Bertrand Marquis wrote:
> Hi Stefano,
> 
> > On 30 Aug 2023, at 02:59, Stefano Stabellini <sstabell...@kernel.org> wrote:
> > 
> > From: Stefano Stabellini <stefano.stabell...@amd.com>
> > 
> > Add 14.3, with a project-wide deviations on if statements.
> > Add 14.4, clarifying that implicit conversions of integers, chars and
> > pointers to bool are allowed.
> > 
> > Also take the opportunity to clarify that parameters of function pointer
> > types are expected to have names (Rule 8.2).
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabell...@amd.com>
> > ---
> > docs/misra/rules.rst | 20 +++++++++++++++++++-
> > 1 file changed, 19 insertions(+), 1 deletion(-)
> > 
> > diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> > index db30632b93..6cde4feeae 100644
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -234,7 +234,7 @@ maintainers if you want to suggest a change.
> >    * - `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
> > -     -
> > +     - Function pointer types shall have named parameters too.
> 
> 
> I would just modify to Function and Function pointers types shall be ...

Sure, I can do that.


> > 
> >    * - `Rule 8.3 
> > <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
> >      - Required
> > @@ -332,6 +332,24 @@ maintainers if you want to suggest a change.
> >      - A loop counter shall not have essentially floating type
> >      -
> > 
> > +   * - `Rule 14.3 
> > <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_
> > +     - Required
> > +     - Controlling expressions shall not be invariant
> > +     - Due to the extensive usage of IS_ENABLED, sizeof compile-time
> > +       checks, and other constructs that are detected as errors by MISRA
> > +       C scanners, managing the configuration of a MISRA C scanner for
> > +       this rule would be unmanageable. Thus, this rule is adopted with
> > +       a project-wide deviation on 'if' statements. The rule only
> > +       applies to while, for, do ... while, ?:, and switch statements.
> 
> Didn't we also said that we would accept while(0) and while(1) ?
> Also i agree with Jan, ? is really the same as if so we should not treat it 
> differently.

I took the list of things the rule applies to from the text of the rule
itself. However, I think you are right about the ?: and it should be
deviated together with if. I can also add while(0) and while(1).

Reply via email to