[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





On 24/07/23 10:07, Jan Beulich wrote:
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.


Yes, I'll fix this.

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.


Temporarily the second option seems the best, since further refactorings can be discussed properly later. I chose 'config' because it seemed to carry the same information as in the original source, but I'm open to other names such as "file" (though I'll test this before submitting a v2 to avoid unintentionally adding violations).

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



 


Rackspace

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