Joint Strike Fighter Air Vehicle C++ IDs mapped to Klocwork C++ checkers

The table below maps the Joint Strike Fighter Air Vehicle C++ coding standard to Klocwork C++ checkers. The Joint Strike Fighter Air Vehicle C++ coding standard, developed by Lockheed Martin, helps programmers develop error-free code for safety-critical systems.

JSF AV ID Checker Code and Description
028

MISRA.USE.DEFINE  Non-guarding macro definition

031

MISRA.USE.DEFINE  Non-guarding macro definition

032

MISRA.USE.DEFINE  Non-guarding macro definition

035

MISRA.INCGUARD  Include guard is not provided

159

MISRA.BIN_OP.OVERLOAD  Comma, || or && operator overloaded

MISRA.UN_OP.OVERLOAD  Unary & operator is overloaded

164.1

MISRA.SHIFT.RANGE  Right operand of shift operation is out of range - greater or equal to max bit-length of left operand, or negative

173

LOCRET.ARG  Function returns address of local variable

LOCRET.GLOB  Function returns address of local variable

LOCRET.RET  Function returns address of local variable

194

MISRA.SWITCH.NOT_WELL_FORMED  Switch statement is not well-formed

196

MISRA.SWITCH.NOT_WELL_FORMED  Switch statement is not well-formed

198

MISRA.FOR.COUNTER.MANY  Many counters in a for loop

Rule 011

MISRA.CHAR.TRIGRAPH  Trigraph usage

Rule 012

MISRA.CHAR.DIGRAPH  Digraph usage

Rule 013

AUTOSAR.TYPE.WCHAR_T  Type wchar_t shall not be used

Rule 014

MISRA.LITERAL.SUFFIX.CASE  Literal suffix in lower case.

Rule 017

MISRA.STDLIB.ERRNO  Use of error indicator 'errno'

Rule 018

MISRA.EXPANSION.UNSAFE  Unsafe macro usage

Rule 019

AUTOSAR.SETLOCALE  The library <clocale> (locale.h) and the setlocale function shall not be used

Rule 020

MISRA.STDLIB.LONGJMP  Use of setjmp macro or longjmp function

Rule 021

MISRA.STDLIB.SIGNAL  Use of the signal handling facilities of signal.h

Rule 022

MISRA.STDLIB.STDIO  Use of input/output library stdio.h in production code

Rule 023

MISRA.STDLIB.ATOI  Use of 'atof', 'atoi' or 'atol' from library stdlib.h

Rule 024

MISRA.STDLIB.ABORT  Use of 'abort', 'exit', 'getenv' or 'system' from library stdlib.h

Rule 025

MISRA.STDLIB.TIME  Use of the time handling functions of library time.h

Rule 026

MISRA.ELIF.COND.NOT_BOOL.2012  #elif condition is not 0 or 1

MISRA.ELIF.DEFINED  Incorrect 'defined' usage in #elif directive

MISRA.ELIF.UNDEF  Undefined macros in #elif directive

MISRA.ELIF.WRAPAROUND  Wrap-around in #elif directive

MISRA.EXPANSION.DIRECTIVE  Directive-like tokens within a macro argument

MISRA.IF.COND.NOT_BOOL.2012  #if condition is not 0 or 1

MISRA.IF.DEFINED  Incorrect 'defined' usage in #if directive

MISRA.IF.UNDEF  Undefined macros in #if directive

MISRA.IF.WRAPAROUND  Wrap-around in #if directive

MISRA.UNDEF  Undef usage

MISRA.USE.EXPANSION  Macro expansion

MISRA.USE.UNKNOWNDIR  Unknown preprocessor directive is used

MISRA.USE.WRONGDIR  Improper preprocessor directive

Rule 029

MISRA.DEFINE.FUNC  Function-like macro definition

Rule 030

MISRA.DEFINE.BADEXP.CPP  Inappropriate macro expansion in a C++ source

Rule 033

MISRA.INCL.BAD  Non-standard include directive

Rule 036

HA.DUPLICATE 

HA.UNUSED 

Rule 037

HA.OPTIMIZE 

Rule 039

MISRA.ONEDEFRULE.FUNC  Global function definition in a header file

MISRA.ONEDEFRULE.VAR  Global variable definition in a header file

Rule 040

CWARN.INCL.NO_INTERFACE  Source file does not include its interface header

Rule 042

AUTOSAR.STYLE.SINGLE_STMT_PER_LINE  Each expression statement and identifier declaration shall be placed on a separate line

Rule 046

MISRA.DEFINE.NOT_DISTINCT.C99.2012  Identifier name is too long

Rule 053.1

MISRA.INCL.SYMS  Non-standard characters in header file names

Rule 057

JSF.ORDER.ACCESS_SPEC  The public, protected, and private sections of a class will be declared in that order

Rule 059

MISRA.IF.NO_COMPOUND  The body of if/else statement is not a compound statement

Rule 067

MISRA.MEMB.NOT_PRIVATE  Member variable in non-POD class is not private

Rule 069

MISRA.MEMB.NON_CONST  Non-const member function does not change any member variables

Rule 070

AUTOSAR.FRIEND_DECL  Friend declarations shall not be used

Rule 070.1

AUTOSAR.DTOR.NON_VIRTUAL  If a public destructor of a class is non-virtual, then the class should be declared final

Rule 071

UNINIT.CTOR.MIGHT  Uninitialized Variable in Constructor - possible

Rule 071.1

MISRA.CTOR.DYNAMIC  Object's dynamic type is used from the body of its constructor

Rule 074

AUTOSAR.CTOR.NSDMI_INIT_LIST  Both NSDMI and a non-static member initializer in a constructor shall not be used in the same type

Rule 075

CWARN.MEMBER.INIT.ORDER  Members of the initialization list are not listed in the order in which they are declared in the class

Rule 076

CL.FFM.ASSIGN  Use of free memory (double free) - no operator=

CL.FFM.COPY  Use of free memory (double free) - no copy constructor

CL.SHALLOW.ASSIGN  Use of free memory (double free) - shallow copy in operator=

CL.SHALLOW.COPY  Use of free memory (double free) - shallow copy in copy constructor

Rule 077

MISRA.CTOR.BASE  Constructor does not explicitly call constructor of its base class

UNINIT.CTOR.MIGHT  Uninitialized Variable in Constructor - possible

UNINIT.CTOR.MUST  Uninitialized Variable in Constructor

Rule 077.1

JSF.MBR.SIG.MATCHES.COPY_CSTR  The definition of a member function shall not contain default arguments that produce a signature identical to that of the implicitly-declared copy constructor

Rule 078

CWARN.DTOR.NONVIRT.DELETE  Delete expression for an object of a class with virtual methods and no virtual destructor

CWARN.DTOR.NONVIRT.NOTEMPTY  Class has virtual functions inherited from a base class, but its destructor is not virtual and not empty

Rule 079

CL.MLK  Memory Leak - in destructor

CL.MLK.VIRTUAL  Memory Leak - possible in destructor

Rule 081

CL.SELF-ASSIGN  Use of free memory (double free) - in operator=

Rule 082

AUTOSAR.ASSIGN.RETURN  An assignment operator shall return a reference to "this"

Rule 085

JSF.CLASS.DEFINE.OPPOSITE_OPERATOR  When two operators are opposites (such as == and !=), both will be defined and one will be defined in terms of the other

Rule 087

JSF.INHERITANCE.NON_ABSTRACT  Hierarchies should be based on abstract classes

Rule 088

MISRA.DERIVE.VIRTUAL  Class is derived from virtual base

MISRA.VIRTUAL.BASE.DIAMOND  Base class is used as virtual not in diamond hierarchy

Rule 089

MISRA.VIRTUAL.NOVIRTUAL  Overriding virtual function declared with no 'virtual' keyword

Rule 094

JSF.DERIVED.NON_VIRT.REDEFINED  An inherited nonvirtual function shall not be redefined in a derived class

Rule 095

MISRA.SAME.DEFPARAMS  Overriding virtual function and the function it overrides have different default arguments

Rule 096

JSF.CAST.DERIVED.ARRAY.FUNC.CALL  Arrays shall not be treated polymorphically

Rule 097

MISRA.FUNC.ARRAY.PARAMS  Function argument with array type decay to a pointer

Rule 098

MISRA.NS.GLOBAL  Function, variable or type declaration in global namespace

Rule 107

MISRA.OBJ.TYPE.COMPAT  Type not compatible with type of other declaration

Rule 108

MISRA.FUNC.VARARG  Function with variable number of arguments

Rule 109

AUTOSAR.FUNC.INLINE_DEF  A function definition shall only be placed in a class definition if (1) the function is intended to be inlined (2); it is a member function template; (3) it is a member function of a class template

Rule 112

MLK.MIGHT  Memory Leak - possible

MLK.MUST  Memory Leak

MLK.RET.MIGHT  Memory Leak - possible

MLK.RET.MUST  Memory Leak

Rule 113

MISRA.RETURN.NOT_LAST  Return is not the last statement in a function

Rule 114

FUNCRET.GEN  Non-void function does not return value

Rule 115

MISRA.FUNC.UNUSEDRET  Return value of a non-void function is not used

Rule 117.1

MISRA.VAR.NEEDS.CONST  Variable is not modified but is declared without const qualifier

Rule 118.1

MISRA.PPARAM.NEEDS.CONST  Pointer parameter is not used to modify the addressed object but is not declared as a pointer to const

Rule 119

MISRA.FUNC.RECUR  Recursive function

Rule 135

MISRA.VAR.HIDDEN  Identifier declared in an inner scope hides identifier in outer scope

Rule 136

MISRA.VAR.MIN.VIS  Name visibility is too wide

Rule 138

MISRA.FUNC.STATIC.REDECL  Function or object redeclaration does not include 'static' modifier

MISRA.VAR.UNIQUE.STATIC  Identifier with static storage specifier clashes with other identifier

Rule 140

AUTOSAR.REGISTER  The register keyword shall not be used

Rule 141

AUTOSAR.DECL.IN_DEFN  A class, structure, or enumeration shall not be declared in the definition of its type

MISRA.CT.UNIQUE.ID  Identifier clashes with tag name

Rule 142

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 144

MISRA.INIT.BRACES  Incorrect initializer braces placement.

Rule 145

MISRA.ENUM.INIT  Non-first enumerator is explicitly initialized, but not all elements are explicitly initialized.

Rule 147

MISRA.FLOAT.BIT.REPR  Use of bit manipulations of floating-point values which rely on storage layout

Rule 149

MISRA.TOKEN.OCTAL.ESCAPE  Usage of octal escape sequences

MISRA.TOKEN.OCTAL.INT  Usage of octal integer constants

Rule 150

AUTOSAR.HEX.UPPER  Hexadecimal constants should be upper case

Rule 151.1

CERT.STR.ASSIGN.CONST_TO_NONCONST 

Rule 152

MISRA.DECL.MANY_DCLS  More than one declarator in one declaration

Rule 153

MISRA.UNION  Union is used

Rule 154

MISRA.BITFIELD.SIGNED  Length of a named signed bit-field is less than 2

MISRA.BITFIELD.TYPE.CPP  Type of bit-field is neither bool, nor signed/unsigned integer

MISRA.FIELD.BIT.ENUM  Bit-field has enum type.

Rule 156

JSF.UNNAMED.MEMBER  All the members of a structure (or class) shall be named and shall only be accessed via their names

Rule 157

MISRA.LOGIC.POSTFIX  Operand in a logical 'and' or 'or' expression is not a postfix expression

MISRA.LOGIC.SIDEEFF  Right operand in a logical 'and' or 'or' expression contains side effects

Rule 158

MISRA.LOGIC.PRIMARY  Operand in a logical 'and' or 'or' expression is not a primary expression

Rule 160

MISRA.ASSIGN.COND  Assignment operator is used in a condition

MISRA.ASSIGN.SUBEXPR  Assignment operator is used in a sub-expression outside a condition

Rule 162

MISRA.CAST.INT.SIGN  Non-trivial integral expression is cast to type with different signedness

MISRA.CONV.INT.SIGN  Implicit integral conversion changes signedness

Rule 165

MISRA.UMINUS.UNSIGNED  Operand of unary minus is unsigned

Rule 166

MISRA.SIZEOF.SIDE_EFFECT  Operand of sizeof has side effects

Rule 168

MISRA.COMMA  Comma operator is used

Rule 169

JSF.POINTER_TO_POINTER  Pointers to pointers should be avoided when possible

Rule 170

MISRA.PTR.TO_PTR_TO_PTR  Pointer declaration has more than two levels of indirection

Rule 174

NPD.CHECK.CALL.MIGHT  Pointer may be passed to function that can dereference it after it was positively checked for NULL

NPD.CHECK.CALL.MUST  Pointer will be passed to function that may dereference it after it was positively checked for NULL

NPD.CHECK.MIGHT  Pointer may be dereferenced after it was positively checked for NULL

NPD.CHECK.MUST  Pointer will be dereferenced after it was positively checked for NULL

NPD.CONST.CALL  NULL is passed to function that can dereference it

NPD.CONST.DEREF  NULL is dereferenced

NPD.FUNC.CALL.MIGHT  Result of function that may return NULL may be passed to another function that may dereference it

NPD.FUNC.CALL.MUST  Result of function that may return NULL will be passed to another function that may dereference it

NPD.FUNC.MIGHT  Result of function that can return NULL may be dereferenced

NPD.FUNC.MUST  Result of function that may return NULL will be dereferenced

NPD.GEN.CALL.MIGHT  Null pointer may be passed to function that may dereference it

NPD.GEN.CALL.MUST  Null pointer will be passed to function that may dereference it

NPD.GEN.MIGHT  Null pointer may be dereferenced

NPD.GEN.MUST  Null pointer will be dereferenced

RNPD.CALL  Suspicious dereference of pointer in function call before NULL check

RNPD.DEREF  Suspicious dereference of pointer before NULL check

Rule 175

MISRA.LITERAL.NULL.PTR  Literal zero used as the null-pointer-constant.

Rule 176

JSF.FUNC.PTR.TYPEDEF  A typedef will be used to simplify program syntax when declaring function pointers

Rule 177

MISRA.CTOR.NOT_EXPLICIT  Constructor with one argument of built-in type is not declared 'explicit'

Rule 178

MISRA.CAST.PTR.VRCLASS  A cast form pointer to a virtual base class to pointer to a derived class does not use 'dynamic_cast'

Rule 179

MISRA.CAST.POLY.TYPE  Cast from a polymorphic base class to a derived class

Rule 180

MISRA.CONV.NUM.NARROWER  Implicit numeric conversion to narrower type

Rule 182

MISRA.CAST.INT_TO_PTR  Object with integer type or pointer to void cast to pointer type

MISRA.CAST.PTR.UNRELATED  Object of pointer type cast to unrelated type

MISRA.CAST.PTR_TO_INT  Cast between a pointer and an integral type

Rule 184

MISRA.CONV.FLOAT  Implicit floating-point conversion

Rule 185

MISRA.C_CAST  C-style cast to non-void type

MISRA.FUNC_CAST  Functional notation cast different from explicit constructor call

Rule 186

UNREACH.ENUM  Code is unreachable due to the possible value(s) of an enum

UNREACH.GEN  Unreachable code

UNREACH.RETURN  Unreachable Void Return

Rule 187

MISRA.STMT.NO_EFFECT  The statement has no side effects, and does not change control flow

Rule 188

JSF.LABEL  Labels will not be used, except in switch statements

Rule 189

AUTOSAR.GOTO  The goto statement shall not be used

Rule 190

MISRA.CONTINUE.ILL  Continue statement is used in an ill-formed for loop

Rule 191

JSF.BREAK  The break statement shall not be used

Rule 192

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 193

MISRA.SWITCH.NO_BREAK  No break or throw statement at the end of switch-clause

Rule 194

MISRA.SWITCH.NODEFAULT  No default clause at the end of a switch statement

Rule 195

MISRA.SWITCH.BOOL  Condition of switch statement is boolean expression

Rule 196

MISRA.SWITCH.NO_CASE  No case-clause in a switch statement

Rule 197

MISRA.FOR.COUNTER.FLT  For loop counter has a floating point type

Rule 199

MISRA.FOR.COND.EQ  ++ or -- operations are not used to change loop counter, but condition tests loop counter for equality

MISRA.FOR.INCR  For loop counter is modified in an inappropriate way

MISRA.FOR.INCR.CHANGE  For loop increment expression does not change loop counter

Rule 200

JSF.LOOP.NULL.INIT_OR_INCR  Null initialize or increment expressions in for loops will not be used

Rule 201

MISRA.FOR.COND.CHANGE  For loop counter is modified within the loop condition section

MISRA.FOR.STMT.CHANGE  For loop counter is modified within the loop statement

Rule 202

MISRA.FLOAT_EQUAL  Floating point expression is tested for equality

Rule 203

NUM.OVERFLOW  Possible Overflow

Rule 204

MISRA.INCR_DECR.OTHER  Increment or decrement operator is mixed with other operators in expression

Rule 204.1

PORTING.VAR.EFFECTS  Variable used twice in one expression where one usage is subject to side-effects

Rule 205

AUTOSAR.TYPE.QUAL.VOLATILE  The volatile type qualifier shall not be used

Rule 206

AUTOSAR.OP.NEW_DELETE  Non-placement new or delete expressions shall not be used

AUTOSAR.STDLIB.MEMORY  Functions malloc, calloc, realloc and free shall not be used

FMM.MIGHT  Freeing Mismatched Memory - possible

FMM.MUST  Freeing Mismatched Memory

Rule 207

JSF.UNENCAPSULATED.GLOBAL  Unencapsulated global data will be avoided

Rule 208

JSF.EXCEPTION  C++ exceptions shall not be used

Rule 209

AUTOSAR.BUILTIN_NUMERIC  Fixed width integer types from <cstdint> shall be used in place of the basic numerical types

PORTING.MACRO.NUMTYPE  Macro describing a builtin numeric type is used

Rule 210

PORTING.BITFIELDS  Usage of bitfields within a structure

PORTING.BSWAP.MACRO  A custom byte swap macro is used without checking endian

PORTING.BYTEORDER.SIZE  An incompatible type is used with a network macro such as 'ntohl'

Rule 210.1

JSF.CAST.MBR.ORDER.ACCESS_SPEC  Algorithms shall not make assumptions concerning the order of allocation of nonstatic data members separated by an access specifier

Rule 212

PORTING.UNSIGNEDCHAR.OVERFLOW.FALSE  Relational expression may be always false depending on 'char' type signedness

PORTING.UNSIGNEDCHAR.OVERFLOW.TRUE  Relational expression may be always true depending on 'char' type signedness

Rule 213

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 214

JSF.USE.STATIC.NON_LOCAL  Assuming that non-local static objects, in separate translation units, are initialized in a special order shall not be done

Rule 215

MISRA.PTR.ARITH  Pointer is used in arithmetic or array index expression

Rules 027

MISRA.INCGUARD  Include guard is not provided

MISRA.USE.DEFINE  Non-guarding macro definition

Rules 084

MISRA.BIN_OP.OVERLOAD  Comma, || or && operator overloaded

MISRA.UN_OP.OVERLOAD  Unary & operator is overloaded

Rules 111

LOCRET.ARG  Function returns address of local variable

LOCRET.GLOB  Function returns address of local variable

LOCRET.RET  Function returns address of local variable

Rules 164

MISRA.SHIFT.RANGE  Right operand of shift operation is out of range - greater or equal to max bit-length of left operand, or negative

Rules 193

MISRA.SWITCH.NOT_WELL_FORMED  Switch statement is not well-formed

Rules 197

MISRA.FOR.COUNTER.MANY  Many counters in a for loop