From nobody Thu Nov 28 15:39:18 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; 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=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16696446756331018.7411639137975; Mon, 28 Nov 2022 06:11:15 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.448934.705531 (Exim 4.92) (envelope-from ) id 1ozeqB-0006Ko-Gs; Mon, 28 Nov 2022 14:10:35 +0000 Received: by outflank-mailman (output) from mailman id 448934.705531; Mon, 28 Nov 2022 14:10:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ozeqB-0006Kd-Bo; Mon, 28 Nov 2022 14:10:35 +0000 Received: by outflank-mailman (input) for mailman id 448934; Mon, 28 Nov 2022 14:10:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ozeq9-0005sM-Hc for xen-devel@lists.xenproject.org; Mon, 28 Nov 2022 14:10:33 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 6bb6a92b-6f26-11ed-91b6-6bf2151ebd3b; Mon, 28 Nov 2022 15:10:32 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A07CB1424; Mon, 28 Nov 2022 06:10:38 -0800 (PST) Received: from e125770.cambridge.arm.com (e125770.cambridge.arm.com [10.1.195.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D5FC63F73D; Mon, 28 Nov 2022 06:10:30 -0800 (PST) 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: 6bb6a92b-6f26-11ed-91b6-6bf2151ebd3b From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH 3/4] tools/misra: fix skipped rule numbers Date: Mon, 28 Nov 2022 14:10:05 +0000 Message-Id: <20221128141006.8719-4-luca.fancellu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221128141006.8719-1-luca.fancellu@arm.com> References: <20221128141006.8719-1-luca.fancellu@arm.com> X-ZM-MESSAGEID: 1669644797017100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently the script convert_misra_doc.py is using a loop through range(1,22) to enumerate rules that needs to be skipped, however range function does not include the stop counter in the enumeration ending up into list rules until 21.21 instead of including rule 22. Fix the issue using a dictionary that list the rules in misra c2012. Fixes: 57caa5375321 ("xen: Add MISRA support to cppcheck make rule") Signed-off-by: Luca Fancellu Reviewed-by: Stefano Stabellini --- xen/tools/convert_misra_doc.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/xen/tools/convert_misra_doc.py b/xen/tools/convert_misra_doc.py index caa4487f645f..13074d8a2e91 100755 --- a/xen/tools/convert_misra_doc.py +++ b/xen/tools/convert_misra_doc.py @@ -14,6 +14,34 @@ Usage: =20 import sys, getopt, re =20 +# MISRA rule are identified by two numbers, e.g. Rule 1.2, the main rule n= umber +# and a sub-number. This dictionary contains the number of the MISRA rule = as key +# and the maximum sub-number for that rule as value. +misra_c2012_rules =3D { + 1:4, + 2:7, + 3:2, + 4:2, + 5:9, + 6:2, + 7:4, + 8:14, + 9:5, + 10:8, + 11:9, + 12:5, + 13:6, + 14:4, + 15:7, + 16:7, + 17:8, + 18:8, + 19:2, + 20:14, + 21:21, + 22:10 +} + def main(argv): infile =3D '' outfile =3D '' @@ -142,8 +170,8 @@ def main(argv): skip_list =3D [] =20 # Search for missing rules and add a dummy text with the rule number - for i in list(range(1,22)): - for j in list(range(1,22)): + for i in misra_c2012_rules: + for j in list(range(1,misra_c2012_rules[i]+1)): if str(i) + '.' + str(j) not in rule_list: outstr.write('Rule ' + str(i) + '.' + str(j) + '\n') outstr.write('No description for rule ' + str(i) + '.' + s= tr(j) --=20 2.17.1