Search code examples
cmisraautosar

Rule 2.3: A project shall not contains unused typedef declarations


"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 ??)


Solution

  • 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:

    1. MISRA is due to release a Guideline Reclassification Plan for automatically generated code - this proposes that users Disapply Rule 2.3 for auto-code.
    2. 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.