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

Re: [PATCH] xen/arm: traps: fix MISRA C 2012 Rule 8.7 violation



Hi,

On 04/07/2022 09:28, Bertrand Marquis wrote:
On 4 Jul 2022, at 09:25, Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:



On 4 Jul 2022, at 09:06, Xenia Ragiadakou <burzalodowa@xxxxxxxxx> wrote:



On 7/4/22 10:58, Luca Fancellu wrote:
I am not 100% sure about this patch.
I think show_stack() should be declared the same way as show_registers().
So either both of them will be declared with external linkage or both of them
will be declared with internal linkage.

I think that those 2 should be declared with external linkage with a comment
explaining why they are. For me those are useful when developing or debugging
and I sometime call those to force dumping the status.
So I would vote to keep the external linkage.

I decided to declare both of them static because they are referenced only in
traps.c but I could have, also, add the declaration of show_stack() in
asm/processor.h header instead. Rule 8.7 is advisory.

As said I would vote for external linkage here but would be nice to have other
developers view on this.

In addition to this, if we don’t want to provide a justification for those, 
since they seems to me
code related to debugging they can be removed from “production” code in some 
way.

Rule 8.7 is advisory, so I think that formal justification of deviations is not 
necessary.

Yes that is true, in that case we would only need to document it without a 
formal justification, however
if the codebase doesn’t include them (because not in production code) I guess the 
problem doesn’t exist.

Having the production code using static and the non production using external 
linkage would be kind of weird here.
I think having them always with external linkage with a justification is the 
cleanest way.

+1 this is what I was going to answer :).

Cheers,

--
Julien Grall



 


Rackspace

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