From nobody Sat Nov 23 04:30:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1710289745; cv=none; d=zohomail.com; s=zohoarc; b=Oix7B1NJRCpIZQgjtU+/VO+av4xd5DFS/ReKq/cqX/v3fO/OiNm8f9nPhxlecqIhyPHfqDoQr0DbCWEwpACC4bmylmRav+x3ap8Xu9ZmqwCvOj70MIgoxEyPKtZcm90S0+p0WeDgdyNMrbL59GBXACTdW/k/halVisxYKySIKys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710289745; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kYOrdEQeUI9VUgHYRlk66BHO4khkO4lungOIS9fOOXI=; b=Ohh7QLk/Z3NimHqf1CmsFRWAJAFXail1XEtr8GVlbHOKBRO59eG/0cNGhm+/zk8RBgsrO5RU5AzOQNq9DzToxTPEuMTIWzlYMcMkbw4NAAxzIRaMe3WyFpKRdW9rC2uAe3fFFFb3yRo+AZ8sIt8+t+9oSIWcD+bB8IBLQKjOTgY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1710289745127171.22491251062297; Tue, 12 Mar 2024 17:29:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.692231.1079147 (Exim 4.92) (envelope-from ) id 1rkCU4-0005Si-Oj; Wed, 13 Mar 2024 00:28:40 +0000 Received: by outflank-mailman (output) from mailman id 692231.1079147; Wed, 13 Mar 2024 00:28:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rkCU4-0005Sb-M5; Wed, 13 Mar 2024 00:28:40 +0000 Received: by outflank-mailman (input) for mailman id 692231; Wed, 13 Mar 2024 00:28:39 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rkCU2-0005SV-Qj for xen-devel@lists.xenproject.org; Wed, 13 Mar 2024 00:28:39 +0000 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a0584eec-e0d0-11ee-a1ee-f123f15fe8a2; Wed, 13 Mar 2024 01:28:36 +0100 (CET) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E422CCE172D; Wed, 13 Mar 2024 00:28:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A4C1C433C7; Wed, 13 Mar 2024 00:28:29 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a0584eec-e0d0-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710289710; bh=VETAQc7mohf8kIx42D/f98f55cEIgZLe8uhKx+/HHMk=; h=Date:From:To:cc:Subject:From; b=B0S1cAJdjnFAxW73IAjHgtdAiSeXAC8PHzmDsXfh1Nbi5/OF8kFsUrqsYg5PLQwF5 1rA7jL57OMStyzXvVeDPa5lrYe1iUH+NGtpOocXtHfgWhx9fI8fvPnD5K+KDshl6Go FF1Go2kIS+kc9aWGpCzqHAcsrTxfBLCl4jjSEnfeTOHXig3dgqBL+9VpEHRWarJr+T JWCBrd88Ao4le+c9/n6/LSKApmgk+7pvzXHE/tdpmOFpk4HPHHKnxIh9+kgPfWAMot AjYUTQrNIEQdBPgtnMyT6D+RFwDsQMBGCvAQbsADstNs8VGSrFZ0nMf/58KFyx8Wfn /xyEpOhOlMmvg== Date: Tue, 12 Mar 2024 17:28:27 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: xen-devel@lists.xenproject.org cc: andrew.cooper3@citrix.com, bertrand.marquis@arm.com, jbeulich@suse.com, julien@xen.org, michal.orzel@amd.com, roger.pau@citrix.com, sstabellini@kernel.org Subject: [PATCH] docs/misra: add Rule 16.4 Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1710289746390100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Stefano Stabellini --- I tested the rendered output and it is correct both on the gitlab UI as well as with tools like rst2html. --- docs/misra/rules.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index 1e134ccebc..5e9367f11c 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -478,6 +478,30 @@ maintainers if you want to suggest a change. - In addition to break, also other unconditional flow control stateme= nts such as continue, return, goto are allowed. =20 + * - `Rule 16.4 `_ + - 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) 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 a default label shall be added with an + in-code comment as follows:: + + /* only handle a subset of the possible cases */ + default: + break; + * - `Rule 16.2 `_ - Required - A switch label shall only be used when the most closely-enclosing --=20 2.25.1