MISRA-C:2012 Compliance Matrix

In this section you will find a description of all MISRA (The Motor Industry Software Reliability Association) rules. Due to copyright limitations, we have altered rule descriptions. The original descriptions can be found in Guidelines for The Use of The C Language in Vehicle Based Software, March 2013, The Motor Industry Software Reliability Association, Watling Street, Nuneaton, Warwickshire CV10 OTU, www.misra.org.uk

Rules are classified by MISRA as either mandatory Ma, required Re or advisory Ad. The succeeding sections list all rules along with support notes: whether the rule is fully supported (those rules are marked MISRA-C Supported Icon Ma/Re/Ad) nearly full supported MISRA-C Partly Supported Icon Ma/Re/Ad with Note, or either not statically checkable MISRA-C Not Statically Checkable Icon or not supported in DAC V4.x MISRA-C Non Supported Icon (Ma-/Re-/Ad-) Current list of unsupported rules can also be viewed in the "Options > Static Code Analyzer".

Standard C environment

MISRA-C Non Supported Icon 1.1 (Re-): The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limits.
Note: MISRA-C Partly Supported Icon Limited support in terms of covered cases will be added.

MISRA-C Supported Icon 1.2 (Ad): Language extensions should not be used.

MISRA-C Not Statically Checkable Icon 1.3 (Re-): There shall be no occurrence of undefined or critical unspecified behavior.

Unused code

MISRA-C Non Supported Icon 2.1 (Re-): A project shall not contain unreachable code.

MISRA-C Non Supported Icon 2.2 (Re-): There shall be no dead code.

MISRA-C Supported Icon 2.3 (Ad): [...]: A project should not contain unused type declarations.

MISRA-C Partly Supported Icon 2.4 (Ad): [...]: A project should not contain unused tag declarations.
Note
: Usage of enum fields is not supported.

MISRA-C Supported Icon 2.5 (Ad): [...]: A project should not contain unused macro declarations.

MISRA-C Supported Icon 2.6 (Ad): [...]: A function should not contain unused label declarations.

MISRA-C Supported Icon 2.7 (Ad): [...]: There should be no unused parameters in functions.

Comments

MISRA-C Supported Icon 3.1 (Re): The character sequences /* and // shall not be used within a comment.

MISRA-C Supported Icon 3.2 (Re): Line-splicing shall not be used in // comments.

Character and lexical conventions

MISRA-C Partly Supported Icon 4.1 (Re): Octal and hexadecimal escape sequences shall be terminated.
Note: Multiple character constants are not supported.

MISRA-C Supported Icon 4.2 (Ad): Trigraphs should not be used.

Identifiers

MISRA-C Supported Icon 5.1 (Re): External identifiers shall be distinct.

MISRA-C Non Supported Icon 5.2 (Re-): Identifiers declared in the same scope and name space shall be distinct.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 5.3 (Re): [...]: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope.

MISRA-C Supported Icon 5.4 (Re): Macro identifiers shall be distinct.

MISRA-C Supported Icon 5.5 (Re): Identifiers shall be distinct from macro names.

MISRA-C Supported Icon 5.6 (Re-): A typedef name [...] shall be a unique identifier.

MISRA-C Supported Icon 5.7 (Re): A tag name [...] shall be a unique identifier.

MISRA-C Supported Icon 5.8 (Re): Identifiers that define objects or functions with external linkage shall be unique.

MISRA-C Non Supported Icon 5.9 (Ad-): Identifiers that define objects or functions with internal linkage shall be unique.
Note: MISRA-C Partly Supported Icon Limited support in terms of covered cases will be added.

Types

MISRA-C Supported Icon 6.1 (Re): Bit-fields shall only be declared with an appropriate type.

MISRA-C Supported Icon 6.2 (Re): Single-bit named bit fields shall not be of a signed type.

Literals and constants

MISRA-C Supported Icon 7.1 (Re): Octal constants shall not be used.

MISRA-C Non Supported Icon 7.2 (Re-): A u or U suffix shall be applied to all integer constants that are represented in an unsigned type.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 7.3 (Re): The lowercase character l shall not be used in a literal suffix.

MISRA-C Non Supported Icon 7.4 (Re-): A string literal shall not be assigned to an object unless the object's type is pointer to const-qualified char.
Note
: MISRA-C Supported Icon Full support will be added.

Declarations and definitions

MISRA-C Supported Icon 8.1 (Re): Types shall be explicitly specified.

MISRA-C Supported Icon 8.2 (Re): Function types shall be in prototype form with named parameters.

MISRA-C Non Supported Icon 8.3 (Re-): All declarations of an object or function shall use the same names and type qualifiers.

MISRA-C Supported Icon 8.4 (Re): [...]: A compatible declaration shall be visible when an object or function with external linkage is defined.

MISRA-C Non Supported Icon 8.5 (Re): [...]: An external object or function shall be declared once in one and only one file.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 8.6 (Re): [...]: An identifier with external linkage shall have exactly one external definition.

MISRA-C Supported Icon 8.7 (Ad): [...]: Functions and objects should not be defined with external linkage if they are referenced in only one translation unit.

MISRA-C Supported Icon 8.8 (Re): The static storage class specifier shall be used in all declarations of objects and functions that have internal linkage.

MISRA-C Supported Icon 8.9 (Ad): An object [...] should be defined at block scope if its identifier only appears in a single function [...].

MISRA-C Non Supported Icon 8.10 (Re-): An inline function shall be declared with the static storage class.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 8.11 (Ad-): When an array with external linkage is declared, its size should be explicitly specified.

MISRA-C Non Supported Icon 8.12 (Re-): Within an enumerator list, the value of an implicitly-specified enumeration constant shall be unique.

MISRA-C Non Supported Icon 8.13 (Ad-): A pointer should point to a const-qualified type whenever possible.

MISRA-C Supported Icon 8.14 (Re): The restrict type qualifier shall not be used.

Initialization

MISRA-C Supported Icon 9.1 (Ma): The value of an object with automatic storage duration shall not be read before it has been set.

MISRA-C Non Supported Icon 9.2 (Re-): The initializer for an aggregate or union shall be enclosed in braces.

MISRA-C Non Supported Icon 9.3 (Re-): Arrays shall not be partially initialized.

MISRA-C Non Supported Icon 9.4 (Re-): An element of an object shall not be initialized more than once.

MISRA-C Non Supported Icon 9.5 (Re-): Where designated initializers are used to initialize an array object the size of the array shall be specified explicitly.

Essential type

MISRA-C Non Supported Icon 10.1 (Re-): Operands shall not be of an inappropriate essential type.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 10.2 (Re-): Expressions of essentially character type shall not be used inappropriately in addition and subtraction operations.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 10.3 (Re-): The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 10.4 (Re-): Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 10.5 (Ad-): The value of an expression should not be cast to an inappropriate essential type.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 10.6 (Re-): The value of a composite expression shall not be assigned to an object with wider essential type.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 10.7 (Re-): If a composite expression is used as one operand of an operator in which the usual arithmetic conversions are performed then the other operand shall not have wider essential type.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 10.8 (Re-): The value of a composite expression shall not be cast to a different essential type category or a wider essential type.
Note: MISRA-C Supported Icon Full support will be added.

Pointer type conversion

MISRA-C Supported Icon 11.1 (Re): Conversions shall not be performed between a pointer to a function and any other type.

MISRA-C Supported Icon 11.2 (Re): Conversions shall not be performed between a pointer to an incomplete type and any other type.

MISRA-C Supported Icon 11.3 (Re): A cast shall not be performed between a pointer to object type and a pointer to a different object type.

MISRA-C Supported Icon 11.4 (Ad): A conversion should not be performed between a pointer to object and an integer type.

MISRA-C Supported Icon 11.5 (Ad): A conversion should not be performed from pointer to void into pointer to object.

MISRA-C Supported Icon 11.6 (Re): A cast shall not be performed between pointer to void and an arithmetic type.

MISRA-C Supported Icon 11.7 (Re): A cast shall not be performed between pointer to object and a non-integer arithmetic type.

MISRA-C Supported Icon 11.8 (Re): A cast shall not remove any const or volatile qualification from the type pointed to by a pointer.

MISRA-C Non Supported Icon 11.9 (Re-): The macro NULL shall be the only permitted form of integer null pointer constant.
Note
: MISRA-C Partly Supported Icon Limited support in terms of covered cases will be added.

Expressions

MISRA-C Non Supported Icon 12.1 (Ad-): The precedence of operators within expressions should be made explicit.

MISRA-C Non Supported Icon 12.2 (Re-): The right hand operand of a shift operator shall lie in the range zero to one less than the width in bits of the essential type of the left hand operand.
Note
: MISRA-C Partly Supported Icon Limited support will be added due to the fact that type sizes are not known for specific compilers.

MISRA-C Supported Icon 12.3 (Ad): The comma operator should not be used.

MISRA-C Non Supported Icon 12.4 (Ad-): Evaluation of constant expressions should not lead to unsigned integer wrap-around.
Note
: MISRA-C Partly Supported Icon Limited support will be added due to the fact that type sizes are not known for specific compilers and analyzer limitations.

Side effects

MISRA-C Partly Supported Icon 13.1 (Re): Initializer lists shall not contain persistent side effects.
Note
: Function call in initializer list is considered to have side effect by default.

MISRA-C Supported Icon 13.2 (Re): The value of an expression and its persistent side effects shall be the same under all permitted evaluation orders.

MISRA-C Non Supported Icon 13.3 (Ad-): A full expression containing an increment (++) or decrement (–) operator should have no other potential side effects other than that caused by the increment or decrement operator.
Note: MISRA-C Partly Supported Icon Limited support will be added.

MISRA-C Supported Icon 13.4 (Ad): The result of an assignment operator should not be used.

MISRA-C Supported Icon 13.5 (Re): The right hand operand of a logical && or || operator shall not contain persistent side effects.

MISRA-C Supported Icon 13.6 (Ma): The operand of the sizeof operator shall not contain any expression which has potential side effects.

Control statement expressions

MISRA-C Supported Icon 14.1 (Re): A loop counter shall not have essentially floating type.

MISRA-C Non Supported Icon 14.2 (Re-): A for loop shall be well-formed.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 14.3 (Re-): Controlling expressions shall not be invariant.

MISRA-C Supported Icon 14.4 (Re): The controlling expression of an if statement and the controlling expression of an iteration-statement shall have essentially Boolean type.

Control flow

MISRA-C Supported Icon 15.1 (Ad): The goto statement should not be used.

MISRA-C Supported Icon 15.2 (Re): The goto statement shall jump to a label declared later in the same function.

MISRA-C Non Supported Icon 15.3 (Re-): Any label referenced by a goto statement shall be declared in the same block, or in any block enclosing the goto statement.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 15.4 (Ad-): There should be no more than one break or goto statement used to terminate any iteration statement.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 15.5 (Ad): A function should have a single point of exit at the end.

MISRA-C Supported Icon 15.6 (Re): The body of an iteration-statement or a selection-statement shall be a compound-statement.

MISRA-C Supported Icon 15.7 (Re): All if ... else if constructs shall be terminated with an else statement.

Switch statements

MISRA-C Non Supported Icon 16.1 (Re-): All switch statements shall be well-formed.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 16.2 (Re-): A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 16.3 (Re): An unconditional break statement shall terminate every switch-clause.

MISRA-C Supported Icon 16.4 (Re): Every switch statement shall have a default label.

MISRA-C Non Supported Icon 16.5 (Re-): A default label shall appear as either the first or the last switch label of a switch statement.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Non Supported Icon 16.6 (Re-): Every switch statement shall have at least two switch clauses.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 16.7 (Re): A switch-expression shall not have essentially Boolean type.

Functions

MISRA-C Partly Supported Icon 17.1 (Re): The features of <stdarg.h> shall not be used.
Note
: Reported at include directive.

MISRA-C Partly Supported Icon 17.2 (Re): Functions shall not call themselves, either directly or indirectly.
Note
: Indirect calls are not supported.

MISRA-C Supported Icon 17.3 (Ma): A function shall not be declared implicitly.

MISRA-C Supported Icon 17.4 (Ma): All exit paths from a function with non-void return type shall have an explicit return statement with an expression.

MISRA-C Non Supported Icon 17.5 (Ad-): The function argument corresponding to a parameter declared to have an array type shall have an appropriate number of elements.

MISRA-C Supported Icon 17.6 (Ma): The declaration of an array parameter shall not contain the static keyword between the [].

MISRA-C Non Supported Icon 17.7 (Re-): The value returned by a function having non-void return type shall be used.
Note
: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 17.8 (Ad): A function parameter should not be modified.

Pointers and arrays

MISRA-C Non Supported Icon 18.1 (Re-): A pointer resulting from arithmetic on a pointer operand shall address an element of the same array as that pointer operand.

MISRA-C Non Supported Icon 18.2 (Re-): Subtraction between pointers shall only be applied to pointers that address elements of the same array.

MISRA-C Non Supported Icon 18.3 (Re-): The relational operators >, >=, < and <= shall not be applied to objects of pointer type except where they point into the same object.

MISRA-C Supported Icon 18.4 (Ad): The +, -, += and -= operators should not be applied to an expression of pointer type.

MISRA-C Partly Supported Icon 18.5 (Ad): Declarations should contain no more than two levels of pointer nesting.
Note
: Reported at usage, not the declaration.

MISRA-C Supported Icon 18.6 (Re): The address of an object with automatic storage shall not be copied to another object that persists after the first object has ceased to exist.

MISRA-C Supported Icon 18.7 (Re): Flexible array members shall not be declared.

MISRA-C Non Supported Icon 18.8 (Re-): Variable-length array types shall not be used.

Overlapping storage

MISRA-C Not Statically Checkable Icon 19.1 (Ma-): An object shall not be assigned or copied to an overlapping object.

MISRA-C Supported Icon 19.2 (Ad): The union keyword should not be used.

Preprocessing directives

MISRA-C Non Supported Icon 20.1 (Ad-): #include directives should only be preceded by preprocessor directives or comments.

MISRA-C Supported Icon 20.2 (Re): The ',  or \\ characters and the /* or // character sequences shall not occur in a header file name.

MISRA-C Supported Icon 20.3 (Re): The #include directive shall be followed by either a <filename> or filename sequence.

MISRA-C Supported Icon 20.4 (Re): A macro shall not be defined with the same name as a keyword.

MISRA-C Supported Icon 20.5 (Ad): #undef should not be used.

MISRA-C Supported Icon 20.6 (Re): Tokens that look like a preprocessing directive shall not occur within a macro argument.

MISRA-C Supported Icon 20.7 (Re): Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses.

MISRA-C Supported Icon 20.8 (Re): The controlling expression of a #if or #elif preprocessing directive shall evaluate to 0 or 1.

MISRA-C Supported Icon 20.9 (Re): All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define'd before evaluation.

MISRA-C Supported Icon 20.10 (Ad): The # and ## preprocessor operators should not be used.

MISRA-C Supported Icon 20.11 (Re): A macro parameter immediately following a # operator shall not immediately be followed by a ## operator.

MISRA-C Non Supported Icon 20.12 (Re-): A macro parameter used as an operand to the # or ## operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators.
Note: MISRA-C Supported Icon Full support will be added.

MISRA-C Supported Icon 20.13 (Re): A line whose first token is # shall be a valid preprocessing directive.

MISRA-C Supported Icon 20.14 (Re): All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are related.

Standard libraries

MISRA-C Supported Icon 21.1 (Re): [...]: #define and #undef shall not be used on a reserved identifier or reserved macro name.

MISRA-C Supported Icon 21.2 (Re): [...]: A reserved identifier or macro name shall not be declared.

MISRA-C Supported Icon 21.3 (Re): The memory allocation and deallocation functions of <stdlib.h> shall not be used.

MISRA-C Supported Icon 21.4 (Re): The standard header file <setjmp.h> shall not be used.

MISRA-C Supported Icon 21.5 (Re): The standard header file <signal.h> shall not be used.

MISRA-C Supported Icon 21.6 (Re): The Standard Library input/output functions shall not be used.

MISRA-C Supported Icon 21.7 (Re): The atof, atoi, atol and atoll functions of <stdlib.h> shall not be used.

MISRA-C Supported Icon 21.8 (Re): The library functions abort, exit, getenv and system of <stdlib.h> shall not be used.

MISRA-C Supported Icon 21.9 (Re): The library functions bsearch and qsort of <stdlib.h> shall not be used.

MISRA-C Supported Icon 21.10 (Re): The Standard Library time and date functions shall not be used.

MISRA-C Supported Icon 21.11 (Re): The standard header file <tgmath.h> shall not be used.

MISRA-C Supported Icon 21.12 (Ad): The exception handling features of <fenv.h> should not be used.

Resources

MISRA-C Not Statically Checkable Icon 22.1 (Re-): All resources obtained dynamically by means of Standard Library functions shall be explicitly released.

MISRA-C Not Statically Checkable Icon 22.2 (Ma-): A block of memory shall only be freed if it was allocated by means of a Standard Library function.

MISRA-C Not Statically Checkable Icon 22.3 (Re-): The same file shall not be open for a read and write access at the same time on different streams.

MISRA-C Not Statically Checkable Icon 22.4 (Ma-): There shall be no attempt to write to a stream which has been opened as read-only.

MISRA-C Supported Icon 22.5 (Ma): [...]: A pointer to a FILE object shall not be dereferenced.

MISRA-C Not Statically Checkable Icon 22.6 (Ma-): The value of a pointer to a FILE shall not be used after the associated stream has been closed.

Percentage of MISRA-C:2012 Compliance Matrix Support in DAC

Number of Rules: 143
Number of Mandatory Rules: 10
Number of Required Rules: 101
Number of Advisory Rules: 32

Category

Number
of all rules
143

Number of 
Mandatory rules
10

Number of 
Required rules
101

Number of
Advisory
rules
32

MISRA-C Supported Icon Fully supported

84
59%

6

58

20

MISRA-C Partly Supported Icon Supported with some limitations

6
4%

0

4

2

MISRA-C Non Supported Icon Not supported

53
37%

4

39

10

MISRA-C Not Statically Checkable Icon Cannot be statically checkable (already counted in 'Not supported')

7
5%

4

3

0