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

Re: [XEN PATCH 3/7] xen/arm: address MISRA C:2012 Rule 2.1



On 2023-12-11 15:14, Julien Grall wrote:
On 11/12/2023 13:06, Michal Orzel wrote:


On 11/12/2023 13:29, Julien Grall wrote:


Hi,

On 11/12/2023 10:30, Nicola Vetrini wrote:
The "return 1;" statements at the end of some cases in the switch
of function 'vgic_v3_its_mmio_write' in 'vcig-v3-its.c' cause the
unreachability of the "return 1;" statement after the switch, thus
violating MISRA C:2012 Rule 2.1:
"A project shall not contain unreachable code".

The same is true for the switch in 'arch_memory_op' from
'xen/arch/arm/mm.c'.

For both cases, I actually much prefer the "return" version in the
cases. In particular for the vGIC emulation the switch is quite large
and it would not be trivial to know what happens after the break.
Because of this...


IOW, I would much prefer if we remove the "return ..." outside of the
switch.
wouldn't it be better to add ASSERT_UNREACHABLE() before this return instead of removing it?
This is what we have in e.g. vpl011 and it prevents mistakes.

I am ok with that. But I am not sure if this would make ECLAIR unhappy.

Cheers,

Should be okay. I'll test and report back

--
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®.