SLAU132V October 2004 – February 2020
MISRA C is a set of software development guidelines for the C programming language. It promotes best practices in developing safety-related electronic systems in road vehicles and other embedded systems. MISRA C was originally launched in 1998 by the Motor Industry Software Reliability Association, and has since been adopted across a wide variety of industries. A subsequent update to the guidelines was publishes as MISRA C:2004
You can alter your code to work with the MISRA C:2004 rules. The following options and pragmas can be used to enable/disable rules:
The syntax of the option and the pragmas is:
--check_misra={all|required|advisory|none|rulespec} |
#pragma CHECK_MISRA ("{all|required|advisory|none|rulespec}") |
#pragma RESET_MISRA ("{all|required|advisory|rulespec}") |
The rulespec parameter is a comma-separated list of rule numbers to enable or disable.
Example: --check_misra=1.1,1.4,1.5,2.1,2.7,7.1,7.2,8.4
Example: #pragma CHECK_MISRA("-7.1,-7.2,-8.4")
A typical use case is to use the --check_misra option on the command line to specify the rules that should be checked in most of your code. Then, use the CHECK_MISRA pragma with a rulespec to activate or deactivate certain rules for a particular region of code.
Two options control the severity of certain MISRA C:2004 rules:
The syntax for these options is:
--misra_advisory={error|warning|remark|suppress} |
--misra_required={error|warning|remark|suppress} |