misra c++

PC-lint/FlexeLint Support
For MISRA C++
The chart below is based on au-misra-cpp.lnt, our configuration file for MISRA C++ 2008.
Although we have taken great care in creating this chart, we make no guarantees as to its completeness
and accuracy. If you find any discrepancies or errors, please send an email to “sales” at “gimpel.com”
with the details.
Checked
Partially
Checked
Not Statically
Checkable
Not Yet
Checked
Totals
Required Rules
Advisory Rules
Document
169
14
1
3
0
0
3
1
9
25
3
0
200
18
10
Totals
184
3
13
28
228
Rule
Category
Support
0-1-1
0-1-2
0-1-3
0-1-4
0-1-5
0-1-6
0-1-7
0-1-8
0-1-9
0-1-10
0-1-11
0-1-12
0-2-1
0-3-1
0-3-2
0-4-1
0-4-2
0-4-3
1-0-1
1-0-2
1-0-3
2-2-1
2-3-1
2-5-1
2-7-1
2-7-2
2-7-3
req
req
req
req
req
req
req
req
req
req
req
req
req
doc
req
doc
doc
doc
req
req
doc
doc
req
adv
req
req
adv
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
n/a
n/a
n/a
Yes
n/a
n/a
n/a
Yes
Yes
Yes
n/a
n/a
www.gimpel .com
Notes
unreachable
infeasible path
unused variable
symbol not referenced or accessed
unused type declaration
last value assigned to variable not used
ignoring return value of function
void return type for function without external side-effects
dead ( redundant) code
unused function
unused function parameter
unused function parameter
unions shall not be used
automatically accomplished by using PC-lint/FlexeLint
ignoring return value of function
not statically checkable
not statically checkable
not statically checkable
strict ANSI / ISO
not statically checkable
not statically checkable
not statically checkable
do not use trigraphs
possible digraph used
do not nest comments
not statically checkable
not statically checkable
Page 1 of 6
2-10-1
2-10-2
2-10-3
2-10-4
2-10-5
2-10-6
2-13-1
2-13-2
2-13-3
2-13-4
2-13-5
3-1-1
3-1-2
3-1-3
3-2-1
3-2-2
3-2-3
3-2-4
3-3-1
req
req
req
req
adv
req
req
req
req
req
req
req
req
req
req
req
req
req
req
Partial
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
3-3-2
3-4-1
3-9-1
3-9-2
3-9-3
4-5-1
4-5-2
4-5-3
4-10-1
4-10-2
5-0-1
5-0-2
5-0-3
5-0-4
5-0-5
5-0-6
5-0-7
5-0-8
5-0-9
5-0-10
5-0-11
5-0-12
5-0-13
5-0-14
req
req
req
adv
req
req
req
req
req
req
req
adv
req
req
req
req
req
req
req
req
req
req
req
req
Yes
no
no
Yes
Yes
Yes
no
Yes
no
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
www.gimpel .com
suspicious constant
report on name hiding
typedef is not a unique declarator
tag is not a unique declarator
identifier with static storage is reused
symbol redeclared
non-ANSI escape sequence
octal constant or escape sequence used
unsigned octal & hexadecimal literals require a ‘U’ suffix
lower case literal suffix
mixing narrow and wide string literals in concatenation
No object/function definitions in headers
function not declared at file scope
array has dimension 0
symbol is redeclared or redefined
symbol is redeclared or redefined
object / function / type previously declared
symbol is redeclared or redefined
header declaration for symbol could be moved from header to
module / symbol could be made static
static symbol not declared static
not currently supported
not currently supported
type or modifier used outside of typedef
bit representation of a floating point type used
boolean expression used with non-permitted operator
not currently supported
plain char used with prohibited operator
not currently supported
implicit conversion from 0 to pointer
order of evaluation
dependence placed on C’s operator precedence
implicit conversion of cvalue
implicit conversion changes signedness
implicit conversion between integer and floating point types
implicit conversion to smaller type.
cast of cvalue between integer and floating point types
cast of cvalue to larger type
cast of cvalue changes signedness
recasting required for operator ’~’ and ’<< ’
type other than plain char
disallowed use of non-numeric value
implicit conversion
implicit conversion
Page 2 of 6
5-0-15
5-0-16
5-0-17
5-0-18
5-0-19
5-0-20
5-0-21
5-2-1
5-2-2
5-2-3
5-2-4
5-2-5
5-2-6
5-2-7
5-2-8
5-2-9
5-2-10
5-2-11
5-2-12
5-3-1
5-3-2
5-3-3
5-3-4
5-8-1
5-14-1
5-17-1
5-18-1
5-19-1
6-2-1
6-2-2
6-2-3
6-3-1
6-4-1
6-4-2
6-4-3
6-4-4
req
req
req
req
req
req
req
req
req
adv
req
req
req
req
adv
adv
adv
req
req
req
req
req
req
req
req
req
req
adv
req
req
req
req
req
req
req
req
Yes
Yes
Yes
Yes
Yes
no
Yes
Yes
Yes
no
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
no
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
6-4-5
6-4-6
6-4-7
6-4-8
6-5-1
6-5-2
req
req
req
req
req
req
Yes
Yes
Yes
Yes
no
no
www.gimpel .com
pointer arithmetic other than array indexing used
out-of-bounds pointer
subtract operator applied to pointers
relational operator applied to pointers
more than two pointer indirection levels used
not currently supported
bitwise operator applied to signed underlying type
non-postfix expression used with logical operator
use dynamic cast to downcast polymorphic type
not currently supported
C-style cast
attempt to cast away const (or volatile)
suspicious cast / unusual pointer cast
pointer conversion to an unrelated type
cast from integer or pointer to void to a pointer to an object
cast from pointer to integral type
increment or decrement combined with another operator
overloading special operators – comma && ||
array type passed to function expecting a pointer
boolean expression required for operators ! && ||
prohibited operator applied to unsigned underlying type
unary operator & overloaded
'sizeof' used on expression with side effect
out of bounds value for right hand side of shift operator
side effects on right hand side of logical operator
not currently supported
comma operator used
overflow in computing constant
assignment operator used in sub-expression
floating point test for equality or inequality
null statement not on a line by itself
left brace expected for switch, while, do...while, and for
left brace expected for if and else
no 'else' at end of 'if ... else if' chain
departure from MISRA switch syntax
most closely enclosing compound statement of a case/default is
not of a switch
missing unconditional break from switch case
switch statement has no default or case follows default
boolean value in switch statement
switch does not have a case
not currently supported
not currently supported
Page 3 of 6
6-5-3
6-5-4
6-5-5
6-5-6
6-6-1
6-6-2
6-6-3
6-6-4
6-6-5
7-1-1
7-1-2
7-2-1
7-3-1
7-3-2
7-3-3
7-3-4
7-3-5
7-3-6
7-4-1
7-4-2
7-4-3
7-5-1
7-5-2
7-5-3
req
req
req
req
req
req
req
req
req
req
req
req
req
req
req
req
req
req
doc
req
req
req
req
req
Yes
no
no
no
no
Yes
Partial
Partial
Yes
Yes
Yes
no
Yes
Yes
Yes
Yes
no
Yes
n/a
Yes
no
Yes
Yes
Yes
7-5-4
8-0-1
8-3-1
8-4-1
8-4-2
8-4-3
8-4-4
8-5-1
8-5-2
8-5-3
9-3-1
9-3-2
9-3-3
9-5-1
9-6-1
9-6-2
9-6-3
9-6-4
10-1-1
req
req
req
req
req
req
req
req
req
req
req
req
req
req
doc
req
req
req
adv
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
n/a
Yes
Yes
Yes
Yes
www.gimpel .com
reuse of for loop variable could cause chaos
not currently supported
not currently supported
not currently supported
not currently supported
goto jumps to an earlier point in the code
continue statement detected
more than one break terminates loop
return before function end
use const on parameters where appropriate
use const on parameters where appropriate
not currently supported
global declaration other than main(), namespace, extern "C"
non-global function, main, declared
unnamed namespace in header
using-directive used
not currently supported
using-directive/declaration in header file
not statically checkable
only use the asm declaration to introduce assembly code
not currently supported
returning address of auto variable
assigning address of auto to static
returning address of reference to a const parameter
address of reference parameter transferred outside of function
worst case function for stack usage
multiple declarators in a declaration
virtual function has default parameter
function has variable number of arguments
function parameter list differs from prior declaration
function should return a value
function identifier used without '&' or parenthesized parameter list
symbol not initialized
omitted braces within an initializer
should initialize either all enum members or only the first
const member function anomaly
member function returns non-const address
member function could be made const
unions shall not be used
not statically checkable
bit field must be explicitly signed int, unsigned int, or bool
bit field type should be int
signed bit field is too small
base class need not be virtual
Page 4 of 6
10-1-2
10-1-3
10-2-1
10-3-1
10-3-2
10-3-3
11-0-1
12-1-1
12-1-2
12-1-3
12-8-1
12-8-2
14-5-1
14-5-2
14-5-3
14-6-1
14-6-2
14-7-1
14-7-2
14-7-3
14-8-1
14-8-2
15-0-1
15-0-2
15-0-3
15-1-1
15-1-2
15-1-3
15-3-1
15-3-2
15-3-3
15-3-4
15-3-5
15-3-6
15-3-7
15-4-1
15-5-1
15-5-2
15-5-3
req
req
adv
req
req
req
req
req
adv
req
req
req
req
req
req
req
req
req
req
req
req
adv
doc
adv
req
req
req
req
req
adv
req
req
req
req
req
req
req
req
req
no
Yes
no
no
Yes
no
Yes
Yes
Yes
no
Yes
Yes
Yes
Yes
Yes
Yes
n/a
Yes
no
Yes
Yes
Yes
n/a
Yes
Yes
no
Yes
Yes
Yes
no
no
Yes
Yes
no
Yes
Yes
Yes
Yes
Yes
16-0-1
16-0-2
16-0-3
16-0-4
req
req
req
req
Yes
Yes
Yes
Yes
www.gimpel .com
not currently supported
non-virtual base class included twice in class
not currently supported
not currently supported
'virtual' assumed for function
not currently supported
non-private data member within a non-POD structure
call to virtual function within a constructor or destructor
symbol did not appear in constructor initializer list
not currently supported
constructor access global data
public copy constructor in abstract class
generic function template associated with type
template constructor cannot be a copy constructor
operator =() for class is not assignment operator
unqualified name subject to misinterpretation
awaiting clarification from MISRA
template was defined but not instantiated
not currently supported
specialization occurs in different file than template
explicit specialization of overloaded function templates
viable set contains both function and template
not statically checkable
pointer expression thrown
case/default within loop; may have been misplaced
not currently supported
explicit throw of the NULL macro
empty throw outside of a catch block
exception thrown within destructor
not currently supported
not currently supported
uncaught exception not on throw-list
catch parameter is not a reference
not currently supported
catch handler after catch(...) in a try-catch sequence
exception specification conflict
exception thrown within destructor
exception not in throw-list of function
exception thrown within destructor / uncaught exception not on
throw-list
declaration before #include
’#define/#undef’ used within a block
use of ’undef’ is discouraged
function-like macro defined
Page 5 of 6
16-0-5
16-0-6
16-0-7
16-0-8
16-1-1
16-1-2
16-2-1
16-2-2
16-2-3
16-2-4
16-2-5
16-2-6
16-3-1
16-3-2
16-6-1
17-0-1
17-0-2
17-0-3
17-0-4
17-0-5
18-0-1
18-0-2
18-0-3
18-0-4
18-0-5
18-2-1
18-4-1
18-7-1
19-3-1
27-0-1
req
req
req
req
req
req
req
req
req
req
adv
req
req
adv
doc
req
req
req
req
req
req
req
req
req
req
req
req
req
req
req
www.gimpel .com
Yes
Yes
Yes
Yes
Yes
Yes
no
Yes
Yes
Yes
Yes
Yes
Yes
Yes
n/a
Yes
Yes
no
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
apparent preprocessor directive in macro
unparenthesized macro parameter in definition of macro
undefined preprocessor variable
all preprocessing directives must be valid
non-standard use of ‘defined’ preprocessor operator
#if not closed off within file
not currently supported
macro could become const variable
header file lacks standard include guard
header file name with non-standard character
header file name with non-standard character ‘\’
need < or " after #include
multiple use of '#/##' operators in definition of macro
'#/##' operator used in macro
not statically checkable
complain about #define standard functions
re-use of reserved identifier
not currently supported
use of +elib options to lint library code
do not use setjmp and longjmp
do not use C library
do not use atof, atoi, atol
do not use abort, exit, getenv, system
do not use functions in ctime header
do not use inbounded functions in cstring header
do not use offsetof
do not use dynamic heap memory allocation functions
do not use csignal functions
do not use errno
do not use cstdio functions
Page 6 of 6