From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D705AC27C53 for ; Wed, 19 Jun 2024 13:24:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.743809.1150789 (Exim 4.92) (envelope-from ) id 1sJvI3-0000lJ-CC; Wed, 19 Jun 2024 13:23:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 743809.1150789; Wed, 19 Jun 2024 13:23:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJvI3-0000lC-9I; Wed, 19 Jun 2024 13:23:55 +0000 Received: by outflank-mailman (input) for mailman id 743809; Wed, 19 Jun 2024 13:23:53 +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 1sJvI1-0000l6-8w for xen-devel@lists.xenproject.org; Wed, 19 Jun 2024 13:23:53 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2aa99688-2e3f-11ef-b4bb-af5377834399; Wed, 19 Jun 2024 15:23:50 +0200 (CEST) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id 632A64EE0738; Wed, 19 Jun 2024 15:23:50 +0200 (CEST) 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: 2aa99688-2e3f-11ef-b4bb-af5377834399 MIME-Version: 1.0 Date: Wed, 19 Jun 2024 15:23:50 +0200 From: Nicola Vetrini To: Xen Devel Cc: Jbeulich , Andrew Cooper3 , Roger Pau , Consulting Subject: MISRA C Rule 5.3 violation - shadowing in mctelem.c Message-ID: X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Hi all, I was looking at the shadowing due to the struct identifier and the local variables "mctctl" in x86/cpu/mcheck/mctelem.c (see [1], the second report). This kind of shadowing seems very intentional, and the initial naive approach I devised was to simply rename the local variables. This, however, results in build breakages, as sometimes the shadowed name seems to be used for accessing the global struct (unless I'm missing something), and as a result changing the name of the locals is not possible, at least not without further modifications to this file, which aren't obvious to me. It would be really helpful if you could point me to either: - avoid the shadowing in some way that does not occur to me at the moment; - deviate this file, as many similar files in x86/cpu are already deviated. What's your opinion on this? Thanks, Nicola [1] https://saas.eclairit.com:3787/fs/var/local/eclair/XEN.ecdf/ECLAIR_normal/staging/X86_64-BUGSENG/latest/PROJECT.ecd;/by_service/MC3R1.R5.3.html -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)