[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH] efi: mechanical renaming to address MISRA C:2012 Rule 5.3


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Jul 2023 10:07:11 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hjq2VSD2h9kYXAzD8CziPuoIQGKiMFT5SRWyLFznJUk=; b=ZhoncAcSatT5ujTPbnMh3ZfjMelm695JrId/mREHm1l/tZk8qgd6nVmlWTeu9rB1fDh8wl5kuqZgiIT03y02al52y30t+Bl6f4icOKFBaHKjii6b2aSagfNS1gozl4T/rIOQMFMM5wMQV15Lgdg/axYQdoYToBofrUTA7xIXHQnaormPS7VpV/jTTARz1lxDR9hiTDdWkMwgDTwYBzXmKvULW+kFoQ6p9h45adwqbvi/8n+iPF0bD7y892EtcSpmeCaTIExJs43urzf/AmzM8QTqLpXtj0Xs5/id6P2by+y0QXGrJAmZuSzPYXoz8ZW/UB4IXb6p8194cmQOBaFyyg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4XSLXcfag/S7nKc2pemT7zBhapZvzToGC0T+aDY9Mpzb85b5sG5HGzt5VQO4KspObMoJy5LbLUQwhghsXApQYa8DBXS7mmqQv3/sICX1LFGQ8sDyy+SQT0Pba9vGbIcCiRc+XY0GSlAESenJQxHQAZ5pKkd+mdGFFH342s3oa5QbdCnol0bT14SOsKBL/aF0lhQR01UG4qpWFYfsIjqtDlsC9L5vy3hqdR3VX05ZmEZ3mtdVplxAEN790RzNDzGjXnY4nv3jL/2HBrBkCKh5e5nJKVkDPfINVdKrm0tEjP3vzeJ/0YAcie376vsN+fUwXnoeGn6FarnEb3gL1rBHg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 24 Jul 2023 08:07:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.07.2023 17:26, Nicola Vetrini wrote:
> Rule 5.3 has the following headline:
> "An identifier declared in an inner scope shall not hide an
> identifier declared in an outer scope"
> 
> The function parameters renamed in this patch are hiding a variable defined
> in an enclosing scope or a function identifier.

I think this sentence should be limited to the part which actually applies.

> The following rename is made:
> - s/cfg/config/
> to distinguish from the variable 'cfg', which is hidden by the parameter 
> inside
> the modified functions.

Hmm. I have to admit that I don't like this. The two functions in question
always have "&cfg" passed to them. So using the same name is, well, kind of
intentional. If we really need to change the code, I guess we may want to
consider dropping the parameter and always-same arguments (albeit the
choice to have this parameter was also intentional).

Another route would be to truly generalize the parameters by naming them
"file", like other functions have it.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.