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

Re: [PATCH 2/5] xen/common: vm_event: Fix MISRA C 2012 Rule 8.7 violation



Hi Jan,

On 6/27/22 11:43, Jan Beulich wrote:
On 27.06.2022 09:54, xenia wrote:
On 6/27/22 10:11, Jan Beulich wrote:
On 26.06.2022 23:11, Xenia Ragiadakou wrote:
The function vm_event_wake() is referenced only in vm_event.c.
Change the linkage of the function from external to internal by adding
the storage-class specifier static to the function definition.

This patch aims to resolve indirectly a MISRA C 2012 Rule 8.4 violation warning.
Actually also for patch 1 - this is slightly confusing, as the title
talks about 8.7. At first I suspected a typo. May I suggest to add
"also" (which I think could be easily done while committing)?

This is actually a violation of MISRA C 2012 Rule 8.7 (Advisory), which
states that functions referenced in only one translation unit should not
be defined with external linkage.
This violation triggers a MISRA C 2012 Rule 8.4 violation warning,
because the function is defined with external linkage without a visible
declaration at the point of definition.
I thought that this does not make it a violation of MISRA C 2012 Rule 8.4.
I think this is a violation of both rules. It would be a violation of
only 8.7 if the function had a declaration, but still wasn't used
outside its defining CU.

So you are suggesting to change the line
"This patch aims to resolve indirectly a MISRA C 2012 Rule 8.4 violation warning."
to
"Also, this patch aims to resolve indirectly a MISRA C 2012 Rule 8.4 violation warning."

I will wait one more day in case there is some input for the last patch, and I will send a v2 with the above changed.

Xenia




 


Rackspace

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