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

4 ビュー (過去 30 日間)
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?

採用された回答

MathWorks Support Team
MathWorks Support Team 2023 年 10 月 5 日
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:
 

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by