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

Re: Top MISRA violations





On 23/04/2020 01:52, Stefano Stabellini wrote:
On Wed, 22 Apr 2020, Julien Grall wrote:
# Rule 8.4

A compatible declaration shall be visible when an object or function
with external linkage is defined.

Example:

extern int16_t count;
int16_t count = 1; /* compliant */

extern int16_t count = 1; /* non-compliant */


## Analysis & Potential Solution

This is not a rule I would expect Xen to be violating.

I am afraid Xen is violating this one in quite a few places. A good
example is functions called from assembly such as start_xen().
We also have a few places where the #include declaring the prototypes
are not present before the implementation.

-Wall doesn't include -Wmissing-prototypes, I did attempt it a few
years ago to add it but only part of the work made upstream so the
flag was never added.

That is a good pointer, thank you. I can try to have a look at what
happens when adding -Wmissing-prototypes to the build.

 From my understanding, I don't think the functions called from assembly
would count as violations, but the others would.

I don't think the violation is on the callee side. It is on the caller side because we are defining an external function (or variable) without an external prototype.

So whether the function is called from assembly (or C) would not matter here.

Cheers,

--
Julien Grall



 


Rackspace

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