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

Re: [PATCH v2] docs/misra: add rules 10.1 10.2 10.3 10.4


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 30 Aug 2023 07:47:38 +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=vDEr1Jxw+JaRbik7MchJ2c3IT5s7A0oo/MOX89vzJyk=; b=j4ml4OHk9SkO33RnVw8ycAc2ggQe00CyWn0Td8ZqqvVEBR7W61uXmceTs5daAlF0+dOny9HkEr3smPbgmdb/PNoFaps38++zhm3WCUvRbUxrMQwZBiw+2fyPx2V7nd9rf9sOhdxmFbp7PlRQSJOgXcvTNXuXuoJvfe9dStdhUeU6gImHJ4aT8GHyN2dZ7/vAWNGneHrFwY18j1aQ+wQc3yKrBEmpdXyGHSr4i6Q2Wv1fLxVavZ6y+O1f5Gvo75lBmRyx4VAEZ9o9cQZlJlRjlxFo42dX/j5+FzS0nQdqAP0el60K+FeSnyU2z5tjoD4sYwTgrtPJxheCZV9AQQn50g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I+j+SgME8IAkTQ7RI3hTiPfQaDFxzufR3h1tfTy8V1RR2tG27ad5sdrDXVWZ96SIyaJBWqSr74F/gmDwQshXnxQPX8dQe9OQmaeEuUL524POO+FmtNQRtXZqE+eUpgchJLkcigR5M0MixPtRnDNPkG1NobuDK+nUilpx5BJj4Y1809ronJLeGTjy4Ex4nEkbVxVybJjxJBZ5xomt/yOuKVEIPPT3IGqdjn8f0iYHUUDRsFomXPrt2Sp2mCHiJDAJM5M7C/zlXIqaUAXueeBjuyrgvhv3cNZl/7+DpZwM/g+vDVPc8YBZdiIiww96oyw0jSzaklRJr3X7O/fE/paClg==
  • 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 Cooper <andrew.cooper3@xxxxxxxxxx>, "roger.pau@xxxxxxxxxx" <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:48:08 +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: AQHZ15302aQv2TiBlUOrKbURllq98bACfTWA
  • Thread-topic: [PATCH v2] docs/misra: add rules 10.1 10.2 10.3 10.4

Hi Stefano,

> On 25 Aug 2023, at 23:48, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> 
> 10.1 with several caveats, described in the notes.
> 10.3 and 10.4 as "aspirational" guidelines, as clarified in the notes.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> v2:
> - typo fix
> - Implicit conversions to boolean for conditionals and logical operators
> - make -C xen
> ---
> docs/misra/rules.rst | 53 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index db30632b93..34916e266a 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -310,6 +310,59 @@ maintainers if you want to suggest a change.
>      - An element of an object shall not be initialized more than once
>      -
> 
> +   * - `Rule 10.1 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_10_01.c>`_
> +     - Required
> +     - Operands shall not be of an inappropriate essential type
> +     - The following are allowed:
> +         - Value-preserving conversions of integer constants
> +         - Bitwise and, or, xor, one's complement, bitwise and assignment,
> +           bitwise or assignment, bitwise xor assignment (bitwise and, or, 
> xor
> +           are safe on non-negative integers; also Xen assumes two's 
> complement
> +           representation)
> +         - Left shift, right shift, left shift assignment, right shift
> +           assignment (see C-language-toolchain.rst for uses of
> +           compilers' extensions)
> +         - Implicit conversions to boolean for conditionals (?: if while
> +           for) and logical operators (! || &&)
> +
> +   * - `Rule 10.2 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_10_02.c>`_
> +     - Required
> +     - Expressions of essentially character type shall not be used
> +       inappropriately in addition and subtraction operations
> +     -
> +
> +   * - `Rule 10.3 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_10_03.c>`_
> +     - Required
> +     - The value of an expression shall not be assigned to an object
> +       with a narrower essential type or of a different essential type
> +       category
> +     - Please beware that this rule has many violations in the Xen
> +       codebase today, and its adoption is aspirational. However, when
> +       submitting new patches please try to decrease the number of
> +       violations when possible.
> +
> +       gcc has a helpful warning that can help you spot and remove
> +       violations of this kind: conversion. For instance, you can use
> +       it as follows:
> +
> +       CFLAGS="-Wconversion -Wno-error=sign-conversion 
> -Wno-error=conversion" make -C xen
> +
> +   * - `Rule 10.4 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_10_04.c>`_
> +     - Required
> +     - Both operands of an operator in which the usual arithmetic
> +       conversions are performed shall have the same essential type
> +       category
> +     - Please beware that this rule has many violations in the Xen
> +       codebase today, and its adoption is aspirational. However, when
> +       submitting new patches please try to decrease the number of
> +       violations when possible.
> +
> +       gcc has a helpful warning that can help you spot and remove
> +       violations of this kind: arith-conversion. For instance, you
> +       can use it as follows:
> +
> +       CFLAGS="-Warith-conversion -Wno-error=arith-conversion" make -C xen
> +
>    * - `Rule 12.5 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_12_05.c>`_
>      - Mandatory
>      - The sizeof operator shall not have an operand which is a function
> -- 
> 2.25.1
> 




 


Rackspace

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