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

Re: [PATCH v2] docs/misra: add Rule 16.4


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Tue, 16 Apr 2024 07:40:47 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; 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=twPOSnz33WfoUNjaUm5Y3NBAh2FI0C4OOJNo270PS78=; b=BEJrrJZksOI+pIbwOUSfbkXXqChPXRhYWuD3TTiM+lCI/mYkvtSDZNco1REQru45o7DOjR2RWbocEI3rtjdO4S8vWY0JkfR7esc9leXiMd6v3QNKHwjFTimN7uBabcLQMiyuMXkURzLxr0LJq8sDvvO086gzecpwfptt+HzO770hdvuSEP5tuhmZaBE8VkgaDRUPZWwG9VbLJtTjeWASXjCeXmIX6YRawig7DZL0YUmi5b5RsIW3K3AnBV04CtlcLWtbwmvB/2JRrc86kDdvn6QjX3Qj0oCLV66PRKwSKOCA0jWTFX/PHSQafRkRvenwzOTZAhcJZs8MPa2iu1h/KA==
  • 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=twPOSnz33WfoUNjaUm5Y3NBAh2FI0C4OOJNo270PS78=; b=dH+zSv7dR5GuO4jGJtfOm2h5xxfR7lUuwvLgzx6sigvXM8pjvugxB9zHbdJMsBVGaHbGXhS/Bisgr5dSd6BBNSsTs9GiiJQHkRnLCLkLsVXmF91ePmXAKqBi49Ehtpu0mCe4+lprGjQnRcCCYYYmUGKSWvWf0MSsgYBRkRbWa5Bi/dbsIhM1E+oB6MfLlTuWSqwZbnsr2xxKeh2/7L19fqKVQDhch17sGt2jYIAz5hrq/rfUff/LXX42G8LvlUZKn64Xhs/bmNgt8baqI7WYN8lTBApyw8gYpvAefaVxGj9NZPYX2g9bqMsW3DQk2voAj2a5Ig6xtl+iW6gu1SHVhA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=F03m9RM08ixO3DIdlid5EQVjQP2tFKv26xKJVCV2YMt6aEB80vuqKWkvolgQjzgV5XGxbBd+8RALVwhiG0xhWQqBLWI90xHkRedbOtT/BeE3URJurfbhl45dS6wu4tbBIA/1OMlaKiqD4cV+K7Q06+SMHpbHWeO9quA6ZOEIJ2Bos2+SwYcAonfGNbvtw6QIEdvoda7ZClMMF6tX6C19yAK2CsyigT+bdrn7EcroKJ+MMgMoxQqWlZufeXtVnb26Q6WIjelpbmEXewISuJTbcBm0hVaSPiwyKUiY11guomLRCTSmk59BvlqYdBQUKHTLEw1xdxqXrTbS5K+XE1saeg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hor3IUW0wbxakD6chZyN2j/kQahiCnWrhcXYazbHiM7hGdAiCMxgb6ktp7gk0BDsBMbyeTtNcj4qiIhuWm5BqALAr6jIAl3rX1lZTGPA7m/CMymlq8W+FQcZIv92fpLS/0CPjWsJlZLcipwZj834Y5hr8CjINytZvKenGGBRSrCN4/Al1cULFEX1MD1Ej8EWFcFmPe+I8g+E055nXN3bZYHrSg9OsYJ8j/oWKovfgIdiAyCz43CqlBPJwQaSVIA+madm2eGb0lnIlC8M+us7dFgfiYMG7nP0wHn9sZg1XHjVUIEo5qfoSbkqHoeUMXf5puFD+E1ban+m88lv3uLFuw==
  • 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>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "michal.orzel@xxxxxxx" <michal.orzel@xxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 16 Apr 2024 07:41:07 +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: AQHadlmlNrY7a9bx20+E4BcPM1KboLFqtgoA
  • Thread-topic: [PATCH v2] docs/misra: add Rule 16.4

Hi Stefano,

> On 14 Mar 2024, at 22:50, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>

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

Cheers
Bertrand

> ---
> Changes in v2:
> - mention -Werror
> - change the position of the in-code comment in the example
> - use "notifier pattern" in the example
> - clarify it is only an example
> ---
> docs/misra/rules.rst | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 1e134ccebc..5c84091e45 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -478,6 +478,31 @@ maintainers if you want to suggest a change.
>      - In addition to break, also other unconditional flow control statements
>        such as continue, return, goto are allowed.
> 
> +   * - `Rule 16.4 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_04.c>`_
> +     - Required
> +     - Every switch statement shall have a default label
> +     - Switch statements with enums as controlling expression don't need
> +       a default label as gcc -Wall enables -Wswitch which warns (and
> +       breaks the build as we use -Werror) if one of the enum labels is
> +       missing from the switch.
> +
> +       Switch statements with integer types as controlling expression
> +       should have a default label:
> +
> +       - if the switch is expected to handle all possible cases
> +         explicitly, then a default label shall be added to handle
> +         unexpected error conditions, using BUG(), ASSERT(), WARN(),
> +         domain_crash(), or other appropriate methods;
> +
> +       - if the switch is expected to handle a subset of all possible
> +         cases, then an empty default label shall be added with an
> +         in-code comment on top of the default label with a reason and
> +         when possible a more detailed explanation. Example::
> +
> +             default:
> +                 /* Notifier pattern */
> +                 break;
> +
>    * - `Rule 16.2 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_02.c>`_
>      - Required
>      - A switch label shall only be used when the most closely-enclosing
> -- 
> 2.25.1
> 




 


Rackspace

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