Azzera filtri
Azzera filtri

MISRA Rules 5.1/5.2 with Polyspace Bug Finder 2017a

6 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Ashfaqul Siraji
Ashfaqul Siraji il 6 Ago 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.
  • 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.
Updating to Latest version of Polyspace should solve this issue

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by