From nobody Tue Feb 10 01:50:12 2026 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 1698758626017773.9737493295988; Tue, 31 Oct 2023 06:23:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.625714.975272 (Exim 4.92) (envelope-from ) id 1qxoiJ-0003yV-Bi; Tue, 31 Oct 2023 13:23:23 +0000 Received: by outflank-mailman (output) from mailman id 625714.975272; Tue, 31 Oct 2023 13:23:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qxoiJ-0003wE-6F; Tue, 31 Oct 2023 13:23:23 +0000 Received: by outflank-mailman (input) for mailman id 625714; Tue, 31 Oct 2023 13:23:22 +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 1qxoiI-0003rs-95 for xen-devel@lists.xenproject.org; Tue, 31 Oct 2023 13:23:22 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id a8173501-77f0-11ee-9b0e-b553b5be7939; Tue, 31 Oct 2023 14:23:19 +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 6EA2DDA7; Tue, 31 Oct 2023 06:24:00 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 428CF3F738; Tue, 31 Oct 2023 06:23:18 -0700 (PDT) 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: a8173501-77f0-11ee-9b0e-b553b5be7939 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini Subject: [RFC PATCH v2 1/8] cppcheck: rework exclusion_file_list.py code Date: Tue, 31 Oct 2023 13:22:57 +0000 Message-Id: <20231031132304.2573924-2-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231031132304.2573924-1-luca.fancellu@arm.com> References: <20231031132304.2573924-1-luca.fancellu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1698758626603100001 Content-Type: text/plain; charset="utf-8" Rework the exclusion_file_list.py code to have the function load_exclusion_file_list() detached from the xen-analysis.py tool, in a way so that other modules can use the function. The xen-analysis tool and in particular its module cppcheck_analysis.py will use a new function cppcheck_exclusion_file_list(). No functional changes are intended. Signed-off-by: Luca Fancellu Reviewed-by: Stefano Stabellini --- xen/scripts/xen_analysis/cppcheck_analysis.py | 6 ++-- .../xen_analysis/exclusion_file_list.py | 31 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xe= n_analysis/cppcheck_analysis.py index 8dc45e653b79..e54848aa5339 100644 --- a/xen/scripts/xen_analysis/cppcheck_analysis.py +++ b/xen/scripts/xen_analysis/cppcheck_analysis.py @@ -2,7 +2,8 @@ =20 import os, re, shutil from . import settings, utils, cppcheck_report_utils, exclusion_file_list -from .exclusion_file_list import ExclusionFileListError +from .exclusion_file_list import (ExclusionFileListError, + cppcheck_exclusion_file_list) =20 class GetMakeVarsPhaseError(Exception): pass @@ -54,8 +55,7 @@ def __generate_suppression_list(out_file): try: exclusion_file =3D \ "{}/docs/misra/exclude-list.json".format(settings.repo= _dir) - exclusion_list =3D \ - exclusion_file_list.load_exclusion_file_list(exclusion= _file) + exclusion_list =3D cppcheck_exclusion_file_list(exclusion_= file) except ExclusionFileListError as e: raise CppcheckDepsPhaseError( "Issue with reading file {}: {}".format(exclusion_file= , e) diff --git a/xen/scripts/xen_analysis/exclusion_file_list.py b/xen/scripts/= xen_analysis/exclusion_file_list.py index 871e480586bb..79ebd34f55ec 100644 --- a/xen/scripts/xen_analysis/exclusion_file_list.py +++ b/xen/scripts/xen_analysis/exclusion_file_list.py @@ -7,16 +7,24 @@ class ExclusionFileListError(Exception): pass =20 =20 -def __cppcheck_path_exclude_syntax(path): - # Prepending * to the relative path to match every path where the Xen - # codebase could be - path =3D "*" + path +def cppcheck_exclusion_file_list(input_file): + ret =3D [] + excl_list =3D load_exclusion_file_list(input_file) + + for entry in excl_list: + # Prepending * to the relative path to match every path where the = Xen + # codebase could be + ret.append("*" + entry[0]) =20 - return path + return ret =20 =20 -# Reads the exclusion file list and returns a list of relative path to be -# excluded. +# Reads the exclusion file list and returns an array containing a set wher= e the +# first entry is what was listed in the exclusion list file, and the second +# entry is the absolute path of the first entry. +# If the first entry contained a wildcard '*', the second entry will have = an +# array of the solved absolute path for that entry. +# Returns [('path',[path,path,...]), ('path',[path,path,...]), ...] def load_exclusion_file_list(input_file): ret =3D [] try: @@ -58,13 +66,6 @@ def load_exclusion_file_list(input_file): .format(path, filepath_object) ) =20 - if settings.analysis_tool =3D=3D "cppcheck": - path =3D __cppcheck_path_exclude_syntax(path) - else: - raise ExclusionFileListError( - "Unimplemented for {}!".format(settings.analysis_tool) - ) - - ret.append(path) + ret.append((path, check_path)) =20 return ret --=20 2.34.1