MISRA C/C++ Guidelines
Ensuring MISRA Compliance
The Motor Industry Software Reliability Association (MISRA) standard provides guidelines for C and C++ software development. Developed by an association of vehicle manufacturers, it aims to define best practice for safety critical systems.
MISRA Rules and Directives
The MISRA guidelines detail a set of rules and directives that should be adhered to when developing software.
The C and C++ programming languages provide strong flexibility for developers implementing code. This flexibility can lead to common mistakes and incorrect usage. The MISRA rules aim to highlight common mistakes and code that can lead to potential issues or reduced maintainability.
The original MISRA guidelines were written for the C language in 1998 (MISRA C 1998). A second edition was published in 2004 providing more focus on critical systems (MISRA C 2004).
With the increase use of C++ in safety critical systems, a new version of the standard was published specifically for C++ in 2008 (MISRA C++ 2008).
A new version of the C guidelines were published in 2012 (MISRA C 2012) extending the standard for C99. The update provided improved expansion of the MISRA C 2004 rules and clarification the existing rules.
Identifying MISRA Violations with SciTools Understand
SciTools Understand CodeCheck provides static analysis capability against predefined or custom developed rules.
Included as part of the default package are rules that cover the three commonly used variants of the MISRA standards:
- MISRA C 2004
- MISRA C++ 2008
- MISRA C 2012
Issue Deviation Justification
Ensuring compliance to MISRA requires that all violations of the standard are managed. In certain cases it may not be viable to fix a highlighted issue. In these instances the issue can be deviated by recording a justification containing the reason why no change is made.
SciTools Understand CodeCheck includes the functionality to deviate raised issues with a justification comment. The deviations can be generated per issue, per file or deviate a specific rule for the entire project.
- Integrate analysis into existing build streams
- Qualify code changes
Reporting and Metrics
- HTML MISRA violation report
- Violation density per file heatmaps
- Data extraction for custom reporting