MISRA C:2004 rules mapped to Klocwork checkers
Guideline | Category | Checker name and description |
---|---|---|
Dir. 1.3 | Required | |
Dir. 1.4 | Required | |
Dir. 1.5 | Advisory | |
Dir. 2.4 | Advisory | |
Dir. 3.1 | Required | |
Dir. 3.2 | Required | |
Dir. 3.3 | Advisory | |
Dir. 3.5 | Required | |
Dir. 3.6 | Required | |
Dir. 18.3 | Required | |
Dir. 21.1 | Required | |
Rule 1.1 | Required | |
Rule 1.2 | Required | |
Rule 2.1 | Required |
MISRA.ASM.ENCAPS Assembly language is not isolated. |
Rule 2.2 | Required |
MISRA.TOKEN.CPCOM C++ style comments |
Rule 2.3 | Required |
MISRA.TOKEN.BADCOM Inappropriate character sequence in a comment |
Rule 3.4 | Required |
MISRA.PRAGMA Non-documented pragma directive |
Rule 4.1 | Required |
MISRA.TOKEN.WRONGESC.C.2004 Incorrect escape sequence in a literal |
Rule 4.2 | Required |
MISRA.CHAR.TRIGRAPH Trigraph usage |
Rule 5.1 | Required |
MISRA.DEFINE.LONGNAME Macro name is too long MISRA.IDENT.LONG Identifier is longer than 31 characters |
Rule 5.2 | Required |
MISRA.VAR.HIDDEN Identifier declared in an inner scope hides identifier in outer scope |
Rule 5.3 | Required |
MISRA.TYPEDEF.NOT_UNIQUE Typedef name is used for another entity |
Rule 5.4 | Required |
MISRA.CT.UNIQUE.ID Identifier clashes with tag name |
Rule 5.5 | Advisory |
MISRA.VAR.UNIQUE.STATIC Identifier with static storage specifier clashes with other identifier |
Rule 5.6 | Advisory |
MISRA.TYPE.NAMECLASH.C.2004 Identifier in one name space has same spelling as identifier in other name space |
Rule 5.7 | Advisory |
MISRA.VAR.UNIQUE Identifier clashes with other identifier |
Rule 6.1 | Required |
MISRA.CHAR.NOT_CHARACTER 'char' is used for non-character value |
Rule 6.2 | Required |
MISRA.SIGNED_CHAR.NOT_NUMERIC 'signed char' or 'unsigned char' is used for non-numeric value |
Rule 6.3 | Advisory |
MISRA.BUILTIN_NUMERIC Builtin numeric type is used |
Rule 6.4 | Required |
MISRA.BITFIELD.TYPE Type of bit-field is not signed/unsigned integer |
Rule 6.5 | Required |
MISRA.BITFIELD.SIGNED Length of a named signed bit-field is less than 2 MISRA.BITFIELD.SIGNED.UNNAMED Length of an unnamed signed bit-field is less than 2 |
Rule 7.1 | Required |
MISRA.TOKEN.OCTAL.ESCAPE Usage of octal escape sequences MISRA.TOKEN.OCTAL.INT Usage of octal integer constants |
Rule 8.1 | Required |
MISRA.FUNC.NOPROT.CALL Function is called but has no prototype MISRA.FUNC.NOPROT.DEF Function has a definition but no prototype |
Rule 8.2 | Required |
MISRA.DECL.NO_TYPE Declaration without a type |
Rule 8.3 | Required |
MISRA.OBJ.TYPE.IDENT Type not identical with type of other declaration |
Rule 8.4 | Required |
MISRA.OBJ.TYPE.COMPAT Type not compatible with type of other declaration |
Rule 8.5 | Required |
MISRA.ONEDEFRULE.FUNC Global function definition in a header file MISRA.ONEDEFRULE.VAR Global variable definition in a header file |
Rule 8.6 | Required |
MISRA.DECL.FUNC_LOCAL Function is declared locally |
Rule 8.7 | Required |
MISRA.VAR.MIN.VIS Name visibility is too wide |
Rule 8.8 | Required | |
Rule 8.9 | Required | |
Rule 8.10 | Required | |
Rule 8.11 | Required |
MISRA.FUNC.STATIC.REDECL Function or object redeclaration does not include 'static' modifier |
Rule 8.12 | Required |
MISRA.DECL.ARRAY_SIZE Declaration of array with unknown size |
Rule 9.1 | Required |
UNINIT.HEAP.MIGHT Uninitialized Heap Use - possible UNINIT.HEAP.MUST Uninitialized Heap Use UNINIT.STACK.ARRAY.MIGHT Uninitialized Array - possible UNINIT.STACK.ARRAY.MUST Uninitialized Array UNINIT.STACK.ARRAY.PARTIAL.MUST Partially Uninitialized Array UNINIT.STACK.MIGHT Uninitialized Variable - possible UNINIT.STACK.MUST Uninitialized Variable |
Rule 9.2 | Required |
MISRA.INIT.BRACES Incorrect initializer braces placement. |
Rule 9.3 | Required |
MISRA.ENUM.INIT Non-first enumerator is explicitly initialized, but not all elements are explicitly initialized. |
Rule 10.1 | Required |
MISRA.CVALUE.IMPL.CAST The value of an expression implicitly converted to a different type |
Rule 10.2 | Required |
MISRA.CVALUE.IMPL.CAST The value of an expression implicitly converted to a different type |
Rule 10.3 | Required |
MISRA.CAST.INT Non-trivial integer expression is cast to a wider type, or type with a different signedness |
Rule 10.4 | Required |
MISRA.CAST.FLOAT Non-trivial float expression is cast to a wider type |
Rule 10.5 | Required |
MISRA.CAST.UNSIGNED_BITS The result of bitwise operation on unsigned char or short is not cast back to original type |
Rule 10.6 | Required |
MISRA.LITERAL.UNSIGNED.SUFFIX Unsigned integer literal without 'U' suffix |
Rule 11.1 | Required |
MISRA.CAST.FUNC_PTR Cast between a function pointer and a non-integral type |
Rule 11.2 | Required |
MISRA.CAST.PTR.UNRELATED Object of pointer type cast to unrelated type |
Rule 11.3 | Advisory |
MISRA.CAST.PTR_TO_INT Cast between a pointer and an integral type |
Rule 11.4 | Advisory |
MISRA.CAST.PTR Cast between a pointer to object type and a different pointer to object type |
Rule 11.5 | Required |
MISRA.CAST.CONST Cast operation removes const or volatile modifier from a pointer or reference |
Rule 12.1 | Advisory |
MISRA.EXPR.PARENS.INSUFFICIENT Limited dependence required for operator precedence rules in expressions MISRA.EXPR.PARENS.REDUNDANT Limited dependence required for operator precedence rules in expressions |
Rule 12.2 | Required |
PORTING.VAR.EFFECTS Variable used twice in one expression where one usage is subject to side-effects |
Rule 12.3 | Required |
MISRA.SIZEOF.SIDE_EFFECT Operand of sizeof has side effects |
Rule 12.4 | Required |
MISRA.LOGIC.SIDEEFF Right operand in a logical 'and' or 'or' expression contains side effects MISRA.LOGIC.SIDEEFF.COND Branch expression in a conditional expression contains side effects |
Rule 12.5 | Required |
MISRA.LOGIC.PRIMARY Operand in a logical 'and' or 'or' expression is not a primary expression |
Rule 12.6 | Advisory |
MISRA.LOGIC.OPERAND.NOT_BOOL Operand of logical operator is not effectively boolean MISRA.LOGIC.OPERATOR.NOT_BOOL Operand of non-logical operator is effectively boolean |
Rule 12.7 | Required |
MISRA.BITS.NOT_UNSIGNED Operand of bitwise operation is not unsigned integer MISRA.BITS.NOT_UNSIGNED.PREP Operand of bitwise operation is not unsigned integer |
Rule 12.8 | Required |
MISRA.SHIFT.RANGE Right operand of shift operation is out of range - greater or equal to max bit-length of left operand, or negative |
Rule 12.9 | Required |
MISRA.UMINUS.UNSIGNED Operand of unary minus is unsigned |
Rule 12.10 | Required |
MISRA.COMMA Comma operator is used |
Rule 12.11 | Advisory |
MISRA.COMP.WRAPAROUND Wrap-around in a condition MISRA.ELIF.WRAPAROUND Wrap-around in #elif directive MISRA.IF.WRAPAROUND Wrap-around in #if directive NUM.OVERFLOW.DF Possible numeric overflow or wraparound |
Rule 12.12 | Required |
MISRA.FLOAT.BIT.REPR Use of bit manipulations of floating-point values which rely on storage layout |
Rule 12.13 | Advisory |
MISRA.INCR_DECR.OTHER Increment or decrement operator is mixed with other operators in expression |
Rule 13.1 | Required |
MISRA.ASSIGN.COND Assignment operator is used in a condition |
Rule 13.2 | Advisory |
MISRA.ZERO_EQ.IMPLICIT Non-boolean expression is implicitly tested against zero |
Rule 13.3 | Required |
MISRA.FLOAT_EQUAL Floating point expression is tested for equality |
Rule 13.4 | Required |
MISRA.FOR.COND.FLT Floating point object is used in the condition section of a 'for' loop |
Rule 13.5 | Required |
MISRA.FOR.COND For loop condition does not depend on loop counter MISRA.FOR.INCR.CHANGE For loop increment expression does not change loop counter |
Rule 13.6 | Required |
MISRA.FOR.STMT.CHANGE For loop counter is modified within the loop statement |
Rule 13.7 | Required |
INVARIANT_CONDITION.GEN Invariant expression in a condition INVARIANT_CONDITION.UNREACH Invariant expression in a condition |
Rule 14.1 | Advisory |
UNREACH.ENUM Code is unreachable due to the possible value(s) of an enum UNREACH.GEN Unreachable code UNREACH.RETURN Unreachable Void Return |
Rule 14.2 | Required |
MISRA.STMT.NO_EFFECT The statement has no side effects, and does not change control flow |
Rule 14.3 | Required |
MISRA.NULL.STMT Null statement is not the only statement on line or comments are placed incorrectly |
Rule 14.4 | Required |
MISRA.GOTO Goto statement is used |
Rule 14.5 | Required |
MISRA.CONTINUE Continue statement is used |
Rule 14.6 | Required |
MISRA.ITER.ONETERM Iteration statement has more than one break or goto for loop termination. |
Rule 14.7 | Required |
MISRA.RETURN.NOT_LAST Return is not the last statement in a function |
Rule 14.8 | Required |
MISRA.STMT.NO_COMPOUND The body of switch, while, do/while or for statement is not a compound statement |
Rule 14.9 | Required |
MISRA.IF.NO_COMPOUND The body of if/else statement is not a compound statement |
Rule 14.10 | Required |
MISRA.IF.NO_ELSE A chain of if/else-if statements is not terminated with else or is terminated with an empty else clause |
Rule 15.0 | Required | |
Rule 15.1 | Required |
MISRA.SWITCH.LABEL A switch label belongs to nested compound statement inside switch body |
Rule 15.2 | Required |
MISRA.SWITCH.NO_BREAK No break or throw statement at the end of switch-clause |
Rule 15.3 | Required |
MISRA.SWITCH.NODEFAULT No default clause at the end of a switch statement |
Rule 15.4 | Required |
MISRA.SWITCH.BOOL Condition of switch statement is boolean expression |
Rule 15.5 | Required |
MISRA.SWITCH.NO_CASE No case-clause in a switch statement |
Rule 16.1 | Required |
MISRA.FUNC.VARARG Function with variable number of arguments |
Rule 16.2 | Required |
MISRA.FUNC.RECUR Recursive function |
Rule 16.3 | Required |
MISRA.FUNC.UNNAMED.PARAMS Function declaration has unnamed parameters |
Rule 16.4 | Required |
MISRA.FUNC.PARAMS.IDENT Identifiers used in declaration and definition of function are not identical |
Rule 16.5 | Required |
MISRA.FUNC.NO_PARAMS Function without parameters is missing void parameter type |
Rule 16.6 | Required |
MISRA.FUNC.UNMATCHED.PARAMS Number of formal and actual parameters passed to function do not match |
Rule 16.7 | Advisory |
MISRA.PPARAM.NEEDS.CONST Pointer parameter is not used to modify the addressed object but is not declared as a pointer to const |
Rule 16.8 | Required |
FUNCRET.GEN Non-void function does not return value FUNCRET.IMPLICIT Non-void function implicitly returning int does not return value |
Rule 16.9 | Required |
MISRA.FUNC.ADDR Address of a function is used without & operator |
Rule 16.10 | Required |
SV.RVT.RETVAL_NOTTESTED Ignored Return Value |
Rule 17.1 | Required |
MISRA.PTR.ARITH Pointer is used in arithmetic or array index expression |
Rule 17.2 | Required |
MISRA.PTR.SUB Pointer subtraction shall only be applied if pointing to same array MISRA.PTR.SUB.OBJECT Pointer subtraction shall only be applied if pointing to same object |
Rule 17.3 | Required |
MISRA.PTR.CMP.2008 Pointer comparison using comparison operators shall only be applied if pointing to same array and within the range MISRA.PTR.CMP.OBJECT.2008 Pointer comparison using comparison operators shall only be applied if pointing to same object and within the range |
Rule 17.4 | Required |
MISRA.PTR.ARITH Pointer is used in arithmetic or array index expression |
Rule 17.5 | Advisory |
MISRA.PTR.TO_PTR_TO_PTR Pointer declaration has more than two levels of indirection |
Rule 17.6 | Required |
LOCRET.ARG Function returns address of local variable LOCRET.GLOB Function returns address of local variable LOCRET.RET Function returns address of local variable |
Rule 18.1 | Required |
MISRA.INCOMPLETE.STRUCT Incomplete struct type is used MISRA.INCOMPLETE.STRUCT.UNNAMED Incomplete unnamed struct type is used MISRA.INCOMPLETE.UNION Incomplete union type is used MISRA.INCOMPLETE.UNION.UNNAMED Incomplete unnamed union type is used |
Rule 18.2 | Required |
MISRA.ASSIGN.OVERLAP Object is assigned to an overlapping object |
Rule 18.4 | Required |
MISRA.UNION Union is used |
Rule 19.1 | Advisory |
MISRA.INCL.INSIDE Include directive preceded by a preprocessor output token |
Rule 19.2 | Advisory |
MISRA.INCL.SYMS Non-standard characters in header file names |
Rule 19.3 | Required |
MISRA.INCL.BAD Non-standard include directive |
Rule 19.4 | Required |
MISRA.DEFINE.BADEXP Inappropriate macro expansion |
Rule 19.5 | Required |
MISRA.DEFINE.NOTGLOBAL Define not at the global level MISRA.UNDEF.NOTGLOBAL Undef not at the global level |
Rule 19.6 | Required |
MISRA.UNDEF Undef usage |
Rule 19.7 | Advisory |
MISRA.DEFINE.FUNC Function-like macro definition |
Rule 19.8 | Required |
MISRA.EXPANSION.NARGS Missing macro argument |
Rule 19.9 | Required |
MISRA.EXPANSION.DIRECTIVE Directive-like tokens within a macro argument |
Rule 19.10 | Required |
MISRA.DEFINE.NOPARS Macro parameter with no parentheses |
Rule 19.11 | Required |
MISRA.ELIF.UNDEF Undefined macros in #elif directive MISRA.IF.UNDEF Undefined macros in #if directive |
Rule 19.12 | Required |
MISRA.DEFINE.SHARP.MANY Several # or ## operators in a macro definition |
Rule 19.13 | Advisory |
MISRA.DEFINE.SHARP # or ## operator in a macro definition |
Rule 19.14 | Required |
MISRA.ELIF.DEFINED Incorrect 'defined' usage in #elif directive MISRA.IF.DEFINED Incorrect 'defined' usage in #if directive |
Rule 19.15 | Required |
MISRA.INCGUARD Include guard is not provided |
Rule 19.16 | Required | |
Rule 19.17 | Required |
MISRA.ELIF.OTHERFILE #elif in an improper file MISRA.ELSE.OTHERFILE #else in an improper file MISRA.ENDIF.OTHERFILE #endif in an improper file |
Rule 20.1 | Required |
MISRA.DEFINE.WRONGNAME Usage of a name from the standard library for naming a macro MISRA.DEFINE.WRONGNAME.UNDERSCORE Usage of a reserved name for naming a macro MISRA.EXPANSION.UNSAFE Unsafe macro usage MISRA.INCL.UNSAFE Unsafe header inclusion |
Rule 20.2 | Required |
MISRA.STDLIB.WRONGNAME Reused name of standard library macro, object or function MISRA.STDLIB.WRONGNAME.UNDERSCORE Usage of a reserved name for naming a language entity MISRA.UNDEF.WRONGNAME Undefinition of a name from the standard library MISRA.UNDEF.WRONGNAME.UNDERSCORE Undefinition of a reserved name |
Rule 20.3 | Required | |
Rule 20.4 | Required |
MISRA.STDLIB.MEMORY Use of dynamic heap memory allocation |
Rule 20.5 | Required |
MISRA.EXPANSION.UNSAFE Unsafe macro usage MISRA.STDLIB.ERRNO Use of error indicator 'errno' |
Rule 20.6 | Required |
MISRA.EXPANSION.UNSAFE Unsafe macro usage |
Rule 20.7 | Required |
MISRA.EXPANSION.UNSAFE Unsafe macro usage MISRA.STDLIB.LONGJMP Use of setjmp macro or longjmp function |
Rule 20.8 | Required |
MISRA.EXPANSION.UNSAFE Unsafe macro usage MISRA.INCL.UNSAFE Unsafe header inclusion MISRA.STDLIB.SIGNAL Use of the signal handling facilities of signal.h |
Rule 20.9 | Required |
MISRA.INCL.UNSAFE Unsafe header inclusion MISRA.STDLIB.STDIO Use of input/output library stdio.h in production code |
Rule 20.10 | Required |
MISRA.STDLIB.ATOI Use of 'atof', 'atoi' or 'atol' from library stdlib.h |
Rule 20.11 | Required |
MISRA.STDLIB.ABORT Use of 'abort', 'exit', 'getenv' or 'system' from library stdlib.h |
Rule 20.12 | Required |
MISRA.INCL.UNSAFE Unsafe header inclusion MISRA.STDLIB.TIME Use of the time handling functions of library time.h |
Support Summary
Number of rules not statically verifiable: 11 of 142
Number of statically verifiable rules supported: 124 of 131
MISRA C:2004 coverage = 95% (excludes rules that are not statically verifiable)
"MISRA", "MISRA C" and "MISRA C++" are registered trademarks of The MISRA Consortium Limited.