Why is there a violation on MISRA-C:2012 Rule 8.7 with Polyspace Bug Finder R2021a?

7 views (last 30 days)
I am trying to run a project in Polyspace Bug Finder R2021a. However, MISRA-C:2012 Rule 8.7 is being raised as a violation. Here is a code example where this rule violation is being flagged:
// in file.h
void FlushDataCache(void);
// in file.c
void FlushDataCache(void)
{
  instruction
}
In the code above, the function should have internal linkage but if I put the 'static' keyword in my code, I receive an internal/external conflict. Is this a false positive or a valid error?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 Oct 2023
The MISRA-C:2012 8.7 violation on "FlushDataCache" is a true positive in Polyspace Bug Finder R2021a.
To work around this issue, please add the 'static' keyword as you have mentioned, and remove the external declaration in your code.
For further information on how to debug this particular rule violation, please refer to the following Polyspace Bug Finder R2021a documentation page:
 

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!