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

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


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 30 Aug 2023 09:44:22 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GYB+6+5zq3YnrihdJOMQ3ftbpSfoOGQXqm73uRINo3E=; b=gd4Uvw/A9da5QVNrtdqKO2jVVfVEJNE+duq1E3iW5Na/ZOr27gMPp7ltIxwh3/uhgchx4FfDPWzuJ0QrDNOkdETx3sO7HiArJ8JyrVPbttsCzKsYiiGYQrrRPBHU+2ofEroa7Zywd51Ytxgcc/2ctYbzAqVeg+YpSN+4Gh2ihNCJcpLJqGZ0jbr/cgcdGyNiym8qLgqCJ/zENKtBlvpD3nlK5eaOe6Wo8TLoQ6Y6gAP+vdFesBxn+hbfI0tR18b33kmXiSPAx6XJLAe+HF+zGMnP8W5lPoItMhYeNv9AP00cVEBpKPkR7bPcKVnpJoS6zsnzw+XyQ69hKb16LV/2ow==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XrCKDHfDes07XkUo+NSSzT3bjs4AcAZRWslKm6WHs514uXN7vu3O0Mqk8DS/BJkxo7LL5sDvwHwWGtmxkvdYbbZiAl+THUZe7Xl8nAI8ilfGxivU44VtXKNQ3I0rdq3u2mo6VYX5Gf5L0KbC0XbxtF7dHZB8Or/dMhKt9t3DkSq/y3b6IvWLcoPdjq9igbNgkbIBv5g+Kf8LANX3hY+jWy3CGg9afTmNiUje0+XtEYoqhjNU98i5WCx80HdUy6X/D8vI4a21NI7yVLnRHxAQKFsQBdZxScCGqEgeqXufJd2+0oNF7nTyRM3RVTGPSdTyfw4KDVrtJxvKw05TMT8qQw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, julien@xxxxxxx, george.dunlap@xxxxxxxxxx, bertrand.marquis@xxxxxxx, nicola.vetrini@xxxxxxxxxxx, roberto.bagnara@xxxxxxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 30 Aug 2023 07:44:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

> @@ -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.

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®.