[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: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 30 Aug 2023 07:54:50 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=yE0WOh+eiOva+bxYzrghnNv6MhootGY+gf5i0PGeYd0=; b=eTp4Vt405r7uQjP5nuu0rSREOKji0gCihrVNJkvo6CPbGEMJRW67C4RdtYTSd6EzaxJnhLIsSrMj5maAjVzi90kht9D8q6XcmRMUxP9ha5C131IKgHHwiYy8z6Ll/igwXddDGaojo7K1NQoCi7kfdUOUf+PqJ8a/3U5P9TDynFzWVoZiU0ukA7YEFCUC832icfKI5a6J8WO9nuZV/30MjF6bp+rw1T1vSSCsxsdS9/wj50wa5a9dItT9vFajxOR8gOrQ36REYVQ1zV9vOGowwo68dVmb622poG5fLY0fz7xYmaDVcfUxqsD8JJNFSjxQ/MV1SZ1oNudo943ReJHXtQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MQbgHH2BMR6WJALAadvtl8T/vUCNj5VgJAjARlcMhE3/8NV/gXN66Ue6K21cdPDY04QItDMBIfK4enX182uA/cfvcv1Bv9LCSzYHf9h/e+IYwc0Dr8yvUiCqOVSWgwpcbUbt1LDMVa+qKYHP0a+nt8GD4tP6PHZ/VpPY0D87hUkuBDd2E7AQvWm7Sw9C5MNp54ync+0ZwFrpQdDk1nfXJMzu2CYqAisK0matoySxKPCRb22prRJecftmTpyABpF/gX/U0aAvJJ8jCAF5OIL+32u6+el2tpXkl70IW0p/a7NjEfE7YQTuNDaHjx0xuPiDXRihiH/Y7cs91gqGGVyoZA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "nicola.vetrini@xxxxxxxxxxx" <nicola.vetrini@xxxxxxxxxxx>, "roberto.bagnara@xxxxxxxxxxx" <roberto.bagnara@xxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Delivery-date: Wed, 30 Aug 2023 07:55:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZ2t1QaiF4viv/Cke+tZQgief+irACeLmA
  • Thread-topic: [PATCH] docs/misra: add 14.3 and 14.4

Hi Stefano,

> On 30 Aug 2023, at 02:59, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> 
> 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.stabellini@xxxxxxx>
> ---
> 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 ...

> 
>    * - `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.

> +
> +   * - `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

I am a bit wondering here what is remaining after this deviation.

> +
>    * - `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
> -- 
> 2.25.1
> 

Cheers
Bertrand





 


Rackspace

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