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

MISRA C Rule 5.3 violation - shadowing in mctelem.c



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)



 


Rackspace

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