MISRA C:1998 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, April 1998, The Motor Industry Software Reliability Association, Watling Street, Nuneaton, Warwickshire CV10 OTU, www.misra.org.uk

Rules are classified by MISRA as either required (Re) or recommended (Rc). The succeeding sections list all rules along with support notes: whether the rule is fully supported (those rules are marked MISRA C Supported Icon), supported with specified limitations (MISRA C Partly Supported Icon), or either not statically checkable or not supported in DA-C V4.0 (Square red cross icon)

Note: DA-C Static Code Analysis has been designed primarily to extract symbol usage information for cross referencing purposes. Therefore, it can infer the type of an expression or some part of it only if that type is directly derived from some symbol used in it. That includes e.g. (a), a.x, *a, a+b, a[2] and excludes e.g. func(), (x)?(y):(z) and so on.

Current list of unsupported rules can also be viewed in the "Options > Static Code Analyzer".

Environment

MISRA C Supported Icon 1 (Re) Do not use nonstandard language extensions.

MISRA C Non Supported Icon 2 (Rc) Other languages should only be used with an interface standard.
Note: Not statically checkable.

MISRA C Supported Icon 3 (Rc) Inline assembly is only allowed in dedicated C functions.

MISRA C Non Supported Icon 4 (Rc) Provision should be made for appropriate run-time checking.
Note: Not statically checkable.

Character Sets

MISRA C Supported Icon 5 (Re) Use only characters defined by the C standard.

MISRA C Non Supported Icon 6 (Re) Numeric character values should be according to a subset of ISO 106460-1.
Note: Not statically checkable. ISO 10646-1 defines an international standard for mapping character sets to numeric values.

MISRA C Supported Icon 7 (Re) Do not use trigraphs.

MISRA C Supported Icon 8 (Re) Do not use wide characters and wide string literals.

Comments

MISRA C Supported Icon 9 (Re) Do not nest comments.

MISRA C Non Supported Icon 10 (Rc) Do not use comments to exclude code from compiling.

Identifiers

MISRA C Supported Icon 11 (Re) Identifiers should have at most 31 significant characters.
Note: DA-C analyses the source code and, of course, does not check whether a compiler/linker support 31 significant characters in identifiers.

MISRA C Non Supported Icon 12 (Rc) x: Do not use the same identifier in multiple name spaces.

Types

MISRA C Supported Icon 13 (Rc) Length-specific typedefs should be used instead of the basic types.

MISRA C Supported Icon 14 (Re) Use "unsigned char" or "signed char" instead of plain "char".

MISRA C Non Supported Icon 15 (Rc) Do not use nonstandard floating point arithmetic.

MISRA C Non Supported Icon 16 (Re) Do not rely on specific binary format for floating point numbers.

MISRA C Non Supported Icon 17 (Re) Do not reuse typedef names.

Constants

MISRA C Supported Icon 18 (Rc) Always use type suffix for numeric constants.

MISRA C Supported Icon 19 (Re) Do not use octal numbers other than zero.

Declarations and Definitions

MISRA C Supported Icon 20 (Re) Always declare before use all variable and function identifiers.

MISRA C Supported Icon 21 (Re) x: Identifiers should not hide identifiers in an outer scope.

MISRA C Supported Icon 22 (Rc) x declaration should be at in function y and "static".

MISRA C Supported Icon 23 (Rc) x: global declaration should be "static".

MISRA C Supported Icon 24 (Re) Identifiers shall not have both internal and external linkage.

MISRA C Supported Icon 25 (Re) x: Multiply defined identifier with external linkage.

MISRA C Supported Icon 26 (Re) x: Multiple declarations for objects or functions shall be compatible.

MISRA C Partly Supported Icon 27 (Rc) x: External declared in more than one file.

MISRA C Supported Icon 28 (Rc) Do not use "register" specifier.

MISRA C Partly Supported Icon 29 (Re) The use of a tag do not agree to declaration.
Note: Supported in type and variable declarations. Initializers are not checked whether they match the structure declared for tag.

Initialization

MISRA C Non Supported Icon 30 (Re) All local variables shall be initialized before use.

MISRA C Non Supported Icon 31 (Re) Braces shall be used in the initialization of arrays and structures.

MISRA C Supported Icon 32 (Re) Only the first, or all enumeration constants may be initialized.

Operators

MISRA C Partly Supported Icon 33 (Re) The right hand side of "&&" or "||" should not contain side effects.
Note: The user-defined function call is always considered to have side effects.

MISRA C Supported Icon 34 (Re) The operands of "&&" or "||" shall be primary expressions.

MISRA C Supported Icon 35 (Re) Do not use assignment operators in Boolean expressions.

MISRA C Supported Icon 36 (Rc) Logical operators should not be confused with bitwise operators.

MISRA C Partly Supported Icon 37 (Re) Do not perform bitwise operations on signed integers.
See note.

MISRA C Non Supported Icon 38 (Re) A shift count shall be between 0 and the operand width minus 1.

MISRA C Partly Supported Icon 39 (Re) Do not apply unary minus to an unsigned expression.

MISRA C Partly Supported Icon 40 (Rc) Do not use "sizeof" on expressions with side effects.
Note: The user-defined function call is always considered to have side effects.

MISRA C Non Supported Icon 41 (Rc) The implementation of integer division should be documented.

MISRA C Supported Icon 42 (Re) The comma operator shall only be used in a "for" condition.

Conversions

MISRA C Non Supported Icon 43 (Re) Do not use implicit conversions which may result in information loss.
Note: DA-C Static Code Analysis does not give this kind of information.

MISRA C Partly Supported Icon 44 (Rc) Do not use redundant explicit casts.
See note.

MISRA C Partly Supported Icon 45 (Re) Do not use type casting from any type to / from pointers.
See note.

Expressions

MISRA C Partly Supported Icon 46 (Re) The value of an expression shall be evaluation order independent.

MISRA C Non Supported Icon 47 (Rc) Do not rely on operator precedence rules, but use parenthesis.

MISRA C Non Supported Icon 48 (Rc) Use explicit casts for mixed arithmetic.

MISRA C Supported Icon 49 (Rc) Tests of a (non-Boolean) value against 0 should be made explicit.

MISRA C Partly Supported Icon 50 (Re) Do not test floating point variables for exact equality or inequality.
See note.

MISRA C Non Supported Icon 51 (Rc) Constant unsigned integer expressions should not wrap-around.

Control flow

MISRA C Non Supported Icon 52 (Re) Unreachable code detected.

MISRA C Partly Supported Icon 53 (Re) All non-null statements should have a side-effect.
Note: The user-defined function call is always considered to have side effects.

MISRA C Non Supported Icon 54 (Re) A null statement should only occur on a separate line.

MISRA C Supported Icon 55 (Rc) Do not use labels.

MISRA C Supported Icon 56 (Re) Do not use "goto" statement.

MISRA C Supported Icon 57 (Re) Do not use "continue" statement.

MISRA C Supported Icon 58 (Re) Do not use "break" statement, except in a "switch".

MISRA C Supported Icon 59 (Re) An "if" or loop body shall always be enclosed in braces.

MISRA C Supported Icon 60 (Rc) All "if", "else if" constructs should contain a final "else".

MISRA C Supported Icon 61 (Re) Terminate every non-empty "case" clause with a "break".

MISRA C Supported Icon 62 (Re) Always put a "default" case in a "switch" statement.

MISRA C Non Supported Icon 63 (Rc) "switch" expression should not be of Boolean type.

MISRA C Supported Icon 64 (Re) "switch" statement with no "case" statements.

MISRA C Partly Supported Icon 65 (Re) Do not use floating point variable as loop counter.
See note.

MISRA C Non Supported Icon 66 (Rc) Use expressions in "for" only for loop control.

MISRA C Non Supported Icon 67 (Rc) Iterator variables should not be modified in a "for" loop.

Functions

MISRA C Supported Icon 68 (Re) Always declare a function at file scope.

MISRA C Supported Icon 69 (Re) Do not use functions with variable number of arguments.

MISRA C Partly Supported Icon 70 (Re) Functions should not call themselves.
Note: Only direct recursion is reported.

MISRA C Non Supported Icon 71 (Re) Function prototype should be visible at the definition and call.

MISRA C Supported Icon 72 (Re) Function prototype of the declaration shall match the definition.

MISRA C Supported Icon 73 (Re) Identifiers should be given for all prototype parameters or for none.

MISRA C Non Supported Icon 74 (Re) Parameter identifiers shall be identical for declaration/definition.

MISRA C Supported Icon 75 (Re) Function should have an explicit return type.

MISRA C Supported Icon 76 (Re) Functions with no parameters should have a "void" parameter list.

MISRA C Non Supported Icon 77 (Re) An actual parameter type should be compatible with the prototype.

MISRA C Supported Icon 78 (Re) x: The number of actual parameters should match the prototype.

MISRA C Supported Icon 79 (Re) The values returned by "void" functions should not be used.

MISRA C Partly Supported Icon 80 (Re) "void" expressions should not be passed as function parameters.

MISRA C Non Supported Icon 81 (Rc) "const" should be used for reference parameters not modified.

MISRA C Supported Icon 82 (Rc) A function should have a single point of exit.

MISRA C Partly Supported Icon 83 (Re) Every exit point shall have a "return" of the declared return type.
See note.

MISRA C Supported Icon 84 (Re) For "void" functions, "return" should not have an expression.

MISRA C Supported Icon 85 (Rc) Use empty parenthesis to call functions with no parameters.

MISRA C Non Supported Icon 86 (Rc) If a function returns error information, it should be tested.

Preprocessing Directives

MISRA C Non Supported Icon 87 (Re) #include shall only be preceded by another directives or comments.

MISRA C Supported Icon 88 (Re) Non-standard characters are not allowed in #include directive.

MISRA C Supported Icon 89 (Re) Use either <filename> or \"filename\" after #include.

MISRA C Non Supported Icon 90 (Re) Plain macros shall only be used for constants/qualifiers/specifiers.

MISRA C Supported Icon 91 (Re) Do not #define / #undef a macro within a block.

MISRA C Supported Icon 92 (Rc) Do not use "#undef".

MISRA C Supported Icon 93 (Rc) Use a function instead a macro.

MISRA C Supported Icon 94 (Re) x: A function-like macro shall not be used without all arguments.

MISRA C Supported Icon 95 (Re) Macro arguments should not contain pre-preprocessing directives.

MISRA C Supported Icon 96 (Re) Macro definitions / parameters should be enclosed in parentheses.

MISRA C Supported Icon 97 (Rc) x: The use in a pre-processing directive before definition.

MISRA C Supported Icon 98 (Re) A macro definition shall contain at most one # or ## operator.

MISRA C Supported Icon 99 (Re) All uses of the #pragma directive shall be documented.

MISRA C Supported Icon 100 (Re) Nonstandard use of operator "defined".

Pointers and Arrays

MISRA C Supported Icon 101 (Rc) Do not use pointer arithmetic.

MISRA C Supported Icon 102 (Rc) Do not use more than double indirect pointers.

MISRA C Non Supported Icon 103 (Re) No relational operators between pointers to different objects.

MISRA C Non Supported Icon 104 (Re) Do not use non-constant pointers to functions.

MISRA C Non Supported Icon 105 (Re) x: should point to functions of identical type.

MISRA C Partly Supported Icon 106 (Re) An automatic address may not be assigned to a longer lived object.

MISRA C Non Supported Icon 107 (Re) Do not dereference null pointer.
Note: Not statically checkable.

Structures and Unions

MISRA C Supported Icon 108 (Re) x: All struct / union members shall be fully specified.

MISRA C Supported Icon 109 (Re) Do not use overlapping variable storage.

MISRA C Supported Icon 110 (Re) Do not use unions to access the sub-parts of larger types.

MISRA C Supported Icon 111 (Re) Bit fields shall have type "unsigned int" or "signed int".

MISRA C Non Supported Icon 112 (Re) Make "signed int" bit fields at least 2 bits wide.

MISRA C Supported Icon 113 (Re) Do not use unnamed struct / union members.

Standard Libraries

MISRA C Supported Icon 114 (Re) x: Do not redefine reserved and standard library names.

MISRA C Supported Icon 115 (Re) x: Do not reuse standard library function names.

MISRA C Non Supported Icon 116 (Re) Production libraries shall comply with the MISRA C restriction.
Note: DA-C analyzes standard libraries headers and reports MISRA warnings for them if Options > Static Code Analyzer... / General / Warnings / Disabled for all headers and Options > Static Code Analyzer... / General / Warnings / Disabled for standard library headers are both unchecked.

MISRA C Non Supported Icon 117 (Re) Library function parameters should be checked.
Not statically checkable.

MISRA C Supported Icon 118 (Re) Do not use heap memory allocation.

MISRA C Supported Icon 119 (Re) "errno" should not be used.

MISRA C Supported Icon 120 (Re) Do not use "offsetof" macro.

MISRA C Supported Icon 121 (Re) Do not use <locale.h> and "setlocale" function.

MISRA C Supported Icon 122 (Re) Do not use "setjmp" and "longjmp" standard library functions.

MISRA C Supported Icon 123 (Re) Do not use the signal handling of <signal.h>.

MISRA C Supported Icon 124 (Re) Do not use <stdio.h> library.

MISRA C Supported Icon 125 (Re) Do not use atof / atoi / atol standard library functions.

MISRA C Supported Icon 126 (Re) Do not use abort / exit / getenv / system standard library functions.

MISRA C Supported Icon 127 (Re) Do not use the time handling of <time.h> library.

Percentage of MISRA C:1998 Compliance Matrix Support in DA-C

Number of Rules (NoR): 127
Number of Required Rules (NoRe): 93
Number of Recommendations (NoRc): 34

Category

NoR
127

NoRe
93

NoRc
34

MISRA C Supported Icon Fully supported

76
60%

59
64%

17
50%

MISRA C Partly Supported Icon Supported with some limitations

16
13%

13
14%

3
9%

MISRA C Non Supported Icon Cannot be statically checkable, or not supported

35
28%

21
23%

14
41%