Fix Errors Applying Custom Annotation Format for Polyspace Results
Issue
When you use the option -xml-annotations-description
to apply custom annotations to your
Polyspace® results, some custom annotations are not applied and you see warnings in
the console output or the desktop interface Output Summary.
Possible Solutions
Custom Annotation Not Found in Mapping
If you define a custom annotation syntax but you do not map it to the Polyspace annotation syntax, Polyspace detects the custom annotation but does not apply it to the analysis results. You see a warning similar to this warning in the console output or the Polyspace desktop interface Output Summary.
Verifying sources ... Verifying zero_div.c (1/1) Warning: rule :50 from exampleCustomAnnotation not found in the mapping (XML file). Skipping the annotation
Solution. Check the <Mapping/>
section of the XML file that you
pass to the -xml-annotations-description
option. If the rule
listed in the warning is not mapped to a Polyspace rule, add the appropriate entry to map the rule. For instance, to
map rule 50 from the preceding warning to Polyspace coding rule MISRA C™: 2012 Rule 8.4, add this entry in the
<Mapping/>
section:
<Result_Name_Mapping Rule_Identifier="50" Family="MISRA-C3" Result_Name="8.4"/>
Polyspace Annotations Do Not Apply to Current Code
If you define a custom annotation syntax and you map it to the Polyspace annotation syntax, Polyspace might not apply some custom annotations to your source code. You see a warning similar to this warning in the console output or the Polyspace desktop interface Output Summary.
Warning: These Polyspace annotations do not apply to the current code: | In file D:\Polyspace\Examples\zero_div.c line 7, annotation MISRA-C3:8.4 with text "Justified by annotation in source" | In file D:\Polyspace\Examples\zero_div.c line 20, annotation MISRA-C3:8.4 with text "Justified by annotation in source" | Possible reasons: | - Issue not detected with selected configuration options. | - Issue is fixed. | - Annotation syntax is incorrect
Solution. Check for these possible causes:
The issue that the annotation addresses has been fixed in the source code. Polyspace detects the custom annotation but ignores it.
The issue that the annotation addresses was not detected by Polyspace with the analysis options that you specified. For example, if the custom annotation addresses a MISRA C: 2012 coding standard violation but Polyspace did not check for violations of this coding standard because option
Check MISRA C:2012 (-misra3)
is not specified.The issue that the annotation addresses was detected but Polyspace could not match the custom annotation to a corresponding Polyspace annotation. This indicates a syntax error in the
<Mapping/>
section of the XML file that you pass to the-xml-annotations-description
option.