code prover annotation for false positives

5 views (last 30 days)
Bas Wielens
Bas Wielens on 1 Feb 2018
Answered: Lucas Lebert on 17 Apr 2018
Hello,
we are using code prover for static analysis of our code. Some findings are false positives and I would like to exclude them for future runs. Code prover seem to have this possibility over annotations in our code. However, these do not work. I have tried:
  • /* polyspace<MISRA-C3:5.4:Not a defect:No action planned> "Comment" */
  • /* polyspace +1 MISRA-C3:5.4 [Justified] "Comment" */
None of them work, findings are still visible in the results.
What would be the correct syntax?
Thanks, Bas

Answers (1)

Lucas Lebert
Lucas Lebert on 17 Apr 2018

Hi, Bas!

If you justify the defects in the code, Polyspace automatically sets the review settings of the defect in the results accordingly. By setting the severity to "Not a defect" as you did in your example, the results should match that.

You mentioned, that the defects are still visible. Indeed it is not possible to delete the defect completely from the results, it is only possible to justify the defect. It will still be visible there, but with the severity, status and the comment of your justification in the code.

With that being said another common mistake is that the justification in the code is not in the same line as the defect. You could justify the same defect in multiple lines of code by using the syntax /* polyspace:begin and /* polyspace:end, as described here: Review Comments

Have a great day! ~Lucas

Community Treasure Hunt

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

Start Hunting!