[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] docs/misra: add 14.3 and 14.4



On Wed, 30 Aug 2023, Jan Beulich wrote:
> On 30.08.2023 02:59, Stefano Stabellini wrote:
> > --- 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.
> 
> This isn't an exception; do we really need to state such? I would have
> expected something to appear here only if we intended to deviate certain
> constructs.

Yes, it is not an exception. However, as there was genuine confusion in
the community about whether the rule should apply or not to function
pointer types I think it would be good to clarify. To avoid any doubts
in the future. My preference is to keep this as clarification.



> > @@ -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.
> 
> The sizeof() aspect mentioned particularly applies to switch() as well.
> Furthermore ?: is really only shorthand for simple if(), so I don't see
> treating it different from if() as helpful.

I'll answer in another email.



> That said, I'd be a little hesitant to give an ack here anyway. If you'd
> split 14.3 and 14.4, I'd be happy to ack 14.4's addition.
> 
> Jan
> 
> > +   * - `Rule 14.4 
> > <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_04.c>`_
> > +     - Required
> > +     - The controlling expression of an if statement and the controlling
> > +       expression of an iteration-statement shall have essentially
> > +       Boolean type
> > +     - Implicit conversions of integers, pointers, and chars to boolean
> > +       are allowed
> > +
> >     * - `Rule 16.7 
> > <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
> >       - Required
> >       - A switch-expression shall not have essentially Boolean type
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.