"Rule 2.3: A project shall not contains unused typedef declarations: If a type is declared but not used, then it is unclear to a reviewer if the type is redundant or it has been left unused by mistake." After generating code in matlab simulink via AUTOSAR, I use Misra rule check and Polyspace code prover to check the generated code. Is there a way for Misra to remove the RTE .h file from its list and check the rest of the libraries and code? (I do not want to MISRA check the RTE.h file. but how ??)
Asked
Active
Viewed 294 times
1
-
Most static analysers are set up so that you can pick which files to include in the check. The real question is why "matlab simulink via AUTOSAR" doesn't generate MISRA C compliant code... then what's the point of using AUTOSAR to begin with? – Lundin Apr 19 '22 at 10:14
-
Does your MISRA/Polyspace check only your Matlab/Simulink code, or is it checking the whole software, which could contain other SWCs and the BSW that are not part of your M/S model code? Rte.h and other RTE related headers also include e.g. Std_Types.h or ComStack_Types.h which contain also structure definitions not commonly used at all in SWCs or from features (e.g. VersionCheck) which could be disabled in one module, but enabled in another. – kesselhaus Apr 19 '22 at 21:17
1 Answers
1
This is typically a tool-specific activity...
Depending on the tool, you can specify that file to be not checked, or include appropriate annotations in the file to switch off specific guideline checks.
Also, as Rule 2.3 is Advisory, in accordance with MISRA Compliance, you can Disapply it (with justification) either for a single file or more generally. Again, that would be implemented within your tool.
I can give guidance on one particular tool (see profile), but you're better talking with your vendor, if the manual is not helpful.
As an aside:
- MISRA is due to release a Guideline Reclassification Plan for automatically generated code - this proposes that users Disapply Rule 2.3 for auto-code.
- If you want to claim MISRA Compliance, the analysis needs to include all files (including your RTE.H) although some relaxation is permitted for adopted code (including auto-generated code).
See profile for affiliation.

Andrew
- 2,046
- 1
- 24
- 37
-
Wasn't this already released one year ago? [MISRA C:2012 Permits](https://www.misra.org.uk/app/uploads/2021/06/MISRA-C-2012-Permits-First-Edition.pdf) Or are you talking about changes to that document? – Lundin Apr 19 '22 at 10:20
-
Hi Lundin... no an actual Guideline Reclassification Plan (to replace Appendix E - which is not compliant with MISRA Compliance!!) which references the Permits document you cite. – Andrew Apr 19 '22 at 13:37
-
Hmm... but it would appear that neither Appendix E nor the linked document is addressing rule 2.3 specifically? – Lundin Apr 19 '22 at 13:47
-
No... it will be a GRP which (in accordance with MISRA Compliance) recategorize certain guidelines for auto-code... one of which is to *Disapply* Rule 2.3 - this isn't published yet. – Andrew Apr 19 '22 at 14:28