- NUMBER_SIGNIFICANT_CHARACTER_EXTERNAL_IDENTIFIER: Number of characters to compare for external identifiers. External identifiers are ones declared with global scope or storage class extern.
- NUMBER_SIGNIFICANT_CHARACTER_INTERNAL_IDENTIFIER: Number of characters to compare for internal identifiers.
MISRA Rules 5.1/5.2 with Polyspace Bug Finder 2017a
1 view (last 30 days)
Show older comments
Dear Polyspace Support,
We encounter some issue during the check of the MISRA rules 5.1 and 5.2. Because Polyspace with our configuration highlight a lot of false error.
It detect that two variable have the same identifier if no character differ before the 31 first character.
But our compiler support name superior to 31 character and so we would expect that by selectionning our compiler into the configuration those failure would disappear but is not the case.
So is there a possibility to allow polyspace to do not consider the 31 character restriction during its check ?
Thank you in advance.
0 Comments
Answers (1)
Ashfaqul Siraji
on 6 Aug 2021
Hello
I understand that you want to modify your polyspace run so that MISRA C:2012 rules 5.1 and 5.2 is not triggered when the first 31 characters are identical. You mention that your compiler supports more than 31 characters. I am assuming you are using C version C99. If you specify -lang as C99, then a violation of 5.2 would be raised when the first 63 characters are identical.
Starting in R2021a, you can control when Polyspace raises violations of 5.1 and 5.2 by using the option -code-behavior-specifications. As an argument to the option, use an XML file with this entry:
<global_scope>
<parameter name="NUMBER_SIGNIFICANT_CHARACTER_EXTERNAL_IDENTIFIER" value="n7"/>
<parameter name="NUMBER_SIGNIFICANT_CHARACTER_INTERNAL_IDENTIFIER" value="n8"/>
</global_scope>
Use the entries n7 and n8 to specify how many characters must be compared to determine if two identifiers as identical.
Updating to Latest version of Polyspace should solve this issue
0 Comments
See Also
Categories
Find more on MISRA C++:2008 Rules in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!