From nobody Sun May 19 12:13:30 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=1654896502; cv=none; d=zohomail.com; s=zohoarc; b=iaaVMlryZH0dnwpt4nzwwC1tqwajGBM71yfx+LgFdbNvioJnycREJJyEJcLAeQm3wCFPDfj27TLuNQ2UQePzX+KCw6jhIbqIEl4kBhgKRWkKlVIZh904JPcj6N+gaVntrLMg9i41HIERQI2RtyxjI6s/IvJDD1RcUOQMPeg2RCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654896502; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=8bOGNoTnUxCeWWnq09egj21vnqpWRQjEUKy2WsJsaQo=; b=eNaXGaLXoH+OHQm/1S2i2xOfnzwj0ErUubqK+ZxXTvLm6jmmy+Lo9ufh/Ib8QN7NZ1sAsEuKB7b0Yl45El8x7IsBm6rENlD31RaJFoyU3pUwvMPuQYYpCsnxgOqPeBmquZkkRg6PXVtdfAeDXKTz1cv+GeDvrfed0yJDBcMG7P8= 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 165489650242447.51615157276808; Fri, 10 Jun 2022 14:28:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.346747.572652 (Exim 4.92) (envelope-from ) id 1nzmAj-0008E8-Kj; Fri, 10 Jun 2022 21:28:01 +0000 Received: by outflank-mailman (output) from mailman id 346747.572652; Fri, 10 Jun 2022 21:28:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzmAj-0008E1-HY; Fri, 10 Jun 2022 21:28:01 +0000 Received: by outflank-mailman (input) for mailman id 346747; Fri, 10 Jun 2022 21:28:00 +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 1nzmAi-0008Dv-CH for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 21:28:00 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 334508b0-e904-11ec-8901-93a377f238d6; Fri, 10 Jun 2022 23:27:59 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BDE50B83765; Fri, 10 Jun 2022 21:27:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD2D9C34114; Fri, 10 Jun 2022 21:27:56 +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: 334508b0-e904-11ec-8901-93a377f238d6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654896477; bh=KBP82+EJ08ywiXHELyDwBuHDDTpTUfvp7+EqgZWDwuE=; h=From:To:Cc:Subject:Date:From; b=V9pX9DwVjbvtYEz06hJ4GIQaq0IVH/unouwpz8f4YnuYJscUR510Wn5BndKvBABGB CDHDOLy8tSJ13msOeaxsIpK7X5d7cWK2z05MEqtzTg5xHVWq6qWOoiE7ZcGaLYc5Cp uZClXCJFWWiCYyT6tehZnf5cMSHYivtHYz8Bt56JDUJZHkrRVMx8a/HlbLH1yEV1XH wbCsYwNpLmM1RuTdohEe7ILyfPfZ8VjIxTN3HydDmY/4m1AibkCCd5JTuvpQncdVwV ETQIetSIXu0QA6pBoUAHsc7JwWGpcVRwG02+BVDTbtr7e8Pc8oLAxOonwYv6PtNwjr SZGdHdUO5F9Tw== From: Stefano Stabellini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, George.Dunlap@citrix.com, roger.pau@citrix.com, Artem_Mygaiev@epam.com, Andrew.Cooper3@citrix.com, julien@xen.org, Bertrand.Marquis@arm.com, jbeulich@suse.com, Stefano Stabellini , Bertrand Marquis , Julien Grall Subject: [PATCH v2] add more MISRA C rules to docs/misra/rules.rst Date: Fri, 10 Jun 2022 14:27:55 -0700 Message-Id: <20220610212755.1051640-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1654896503697100001 Add the new MISRA C rules agreed by the MISRA C working group to docs/misra/rules.rst. Signed-off-by: Stefano Stabellini Reviewed-by: Bertrand Marquis Acked-by: Julien Grall Acked-by: Roger Pau Monn=C3=A9 --- Given the minimal/trivial changes I kept the acked/reviewed-by. Changes in v2: - use max_t/min_t instead of MAX/MIN in the Rule 5.3 example - improve wording for the note of Rule 5.3 --- docs/misra/rules.rst | 90 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index 6ccff07765..c0bdc75987 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -89,6 +89,29 @@ existing codebase are work-in-progress. (xen/include/public/) are allowed to retain longer identifiers for backward compatibility. =20 + * - `Rule 5.2 `_ + - Required + - Identifiers declared in the same scope and name space shall be + distinct + - The Xen characters limit for identifiers is 40. Public headers + (xen/include/public/) are allowed to retain longer identifiers + for backward compatibility. + + * - `Rule 5.3 `_ + - Required + - An identifier declared in an inner scope shall not hide an + identifier declared in an outer scope + - Using macros as macro parameters at invocation time is allowed + even if both macros use identically named local variables, e.g. + max_t(var0, min_t(var1, var2)) + + * - `Rule 5.4 `_ + - Required + - Macro identifiers shall be distinct + - The Xen characters limit for macro identifiers is 40. Public + headers (xen/include/public/) are allowed to retain longer + identifiers for backward compatibility. + * - `Rule 6.2 `_ - Required - Single-bit named bit fields shall not be of a signed type @@ -123,8 +146,75 @@ existing codebase are work-in-progress. declarations of objects and functions that have internal linkage - =20 + * - `Rule 8.10 `_ + - Required + - An inline function shall be declared with the static storage class + - gnu_inline (without static) is allowed. + * - `Rule 8.12 `_ - Required - Within an enumerator list the value of an implicitly-specified enumeration constant shall be unique - + + * - `Rule 9.1 `_ + - Mandatory + - The value of an object with automatic storage duration shall not + be read before it has been set + - Rule clarification: do not use variables before they are + initialized. An explicit initializer is not necessarily required. + Try reducing the scope of the variable. If an explicit + initializer is added, consider initializing the variable to a + poison value. + + * - `Rule 9.2 `_ + - Required + - The initializer for an aggregate or union shall be enclosed in + braces + - + + * - `Rule 13.6 `_ + - Mandatory + - The operand of the sizeof operator shall not contain any + expression which has potential side effects + - + + * - `Rule 14.1 `_ + - Required + - A loop counter shall not have essentially floating type + - + + * - `Rule 16.7 `_ + - Required + - A switch-expression shall not have essentially Boolean type + - + + * - `Rule 17.3 `_ + - Mandatory + - A function shall not be declared implicitly + - + + * - `Rule 17.4 `_ + - Mandatory + - All exit paths from a function with non-void return type shall + have an explicit return statement with an expression + - + + * - `Rule 20.7 `_ + - Required + - Expressions resulting from the expansion of macro parameters + shall be enclosed in parentheses + - + + * - `Rule 20.13 `_ + - Required + - A line whose first token is # shall be a valid preprocessing + directive + - + + * - `Rule 20.14 `_ + - Required + - All #else #elif and #endif preprocessor directives shall reside + in the same file as the #if #ifdef or #ifndef directive to which + they are related + - --=20 2.25.1