Polyspace codeprover doesnt give a warning for MISRA violation(MISRA C:2012, 19.2 - The union keyword should not be used)

10 visualizzazioni (ultimi 30 giorni)
We are enabling MISRA C:2012-all in polyspace code prover. We have unions declared in header files and created objects for that in source file. But when we ran the code prover we didnt see any warning for union(violation of MISRA C:2012, 19.2). What could be the possible reason? We know that some of the rules are not supported by code prover but this rule is not part of that.

Risposta accettata

Anirban
Anirban il 24 Gen 2022
Modificato: Anirban il 24 Gen 2022
There could be many reasons related to the coding rules checking setup, but one possible reason is that your headers are in a completely separate location from your sources. By default, the coding rules checking flags violations only in sources and headers in source folders and subfolders. The reason is that, headers in other folders are typically third-party headers (like compiler headers and so on) and are outside the user's control. Even if a violation occurs, there is not much the user can do about it.
To see results in all headers, use the option -generate-results-for all-headers . If that was the problem, the coding rule violation should appear now.
For information on:
Note: It is recommended to use Polyspace Bug Finder for all coding rules checking. Polyspace Bug Finder has full coverage for MISRA C:2012. In fact, support for coding rules checking will be removed from Polyspace Code Prover in the future. See Polyspace Code Prover release notes. For help with transitioning, see Migrate Code Prover Workflows for Coding Standards Checking and Code Metrics to Bug Finder. (But the default analysis scope of Bug Finder is same as Code Prover when it comes to coding rules checking. So, you will still have to use the option -generate-results-for all-headers if you want results in all headers.)
  2 Commenti
Nideesh Madhu
Nideesh Madhu il 25 Gen 2022
Thanks for your feedback. I have enabled the option -generate-results-for all-headers. So warnings started coming for header files as well.
I still have question on union objects created on a source file. Polyspace is not giving any warning for that but when we used some other static analysis tool(QAC with Misra2012) we got a warning saying 'An object of union type has been defined' and is mapped to MISRA C 2012: Rule 19.2 .
I have noticed some other differences also similar to this when i compared the Polyspace result with QAC. Do you have any idea?
Anirban
Anirban il 25 Gen 2022
Modificato: Anirban il 26 Gen 2022
Different static analysis tools have different ways to report the issues found. I will not be able to comment on how some specific tool does it. If you contact MathWorks Technical Support, they can help with understanding the differences

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by