Classification of PVS-Studio warnings according to the standards: MISRA C, MISRA C++
MISRA C and MISRA C++ are software development standards created by MISRA (Motor Industry Software Reliability Association). The purpose of these standards is to enhance security, portability, and reliability of programs for embedded systems.
The analyzer targets the versions of the standards: MISRA C:2012, MISRA C:2023, MISRA C++:2008 and MISRA C++:2023.
MISRA C 2012
- Mandatory + Required coverage: 86%;
- Mandatory + Required + Advisory coverage: 79%.
|
Error Code |
Error Description |
Mapping |
|---|---|---|
|
Octal constants should not be used. |
7.1 |
|
|
The 'goto' statement should not be used. |
15.1 |
|
|
Implicitly specified enumeration constants should be unique – consider specifying non-unique constants explicitly. |
8.12 |
|
|
Size of an array is not specified. |
8.11 |
|
|
The 'goto' statement shouldn't jump to a label declared earlier. |
15.2 |
|
|
A function should have a single point of exit at the end. |
15.5 |
|
|
The body of a loop\conditional statement should be enclosed in braces. |
15.6 |
|
|
The function with the 'atof/atoi/atol/atoll' name should not be used. |
21.7 |
|
|
The function with the 'abort/exit/getenv/system' name should not be used. |
21.8 |
|
|
The function with the 'qsort/bsearch' name should not be used. |
21.9 |
|
|
Memory allocation and deallocation functions should not be used. |
21.3 |
|
|
The macro with the 'setjmp' name and the function with the 'longjmp' name should not be used. |
21.4 |
|
|
Unions should not be used. |
19.2 |
|
|
Declaration should contain no more than two levels of pointer nesting. |
18.5 |
|
|
The 'if' ... 'else if' construct should be terminated with an 'else' statement. |
15.7 |
|
|
Literal suffixes should not contain lowercase characters. |
7.3 |
|
|
The 'default' label should be either the first or the last label of a 'switch' statement. |
16.5 |
|
|
Every 'switch' statement should have a 'default' label, which, in addition to the terminating 'break' statement, should contain either a statement or a comment. |
16.4 |
|
|
Every switch-clause should be terminated by an unconditional 'break' or 'throw' statement. |
16.3 |
|
|
All integer constants of unsigned type should have 'u' or 'U' suffix. |
7.2 |
|
|
A switch-label should only appear at the top level of the compound statement forming the body of a 'switch' statement. |
16.2 |
|
|
Every 'switch' statement should contain non-empty switch-clauses. |
16.6 |
|
|
The functions from time.h/ctime should not be used. |
21.10 |
|
|
A switch-expression should not have Boolean type. Consider using of 'if-else' construct. |
16.7 |
|
|
The comma operator should not be used. |
12.3 |
|
|
Any label should be declared in the same block as 'goto' statement or in any block enclosing it. |
15.3 |
|
|
Any loop should be terminated with no more than one 'break' or 'goto' statement. |
15.4 |
|
|
Expression of essential type 'foo' should not be explicitly cast to essential type 'bar'. |
10.5 |
|
|
String literal should not be assigned to object unless it has type of pointer to const-qualified char. |
7.4 |
|
|
The loop counter should not have floating-point type. |
14.1 |
|
|
Unreachable code should not be present in the project. |
2.1 |
|
|
Function should not contain labels not used by any 'goto' statements. |
2.6 |
|
|
Functions should not have unused parameters. |
2.7 |
|
|
The value of uninitialized variable should not be used. |
9.1 |
|
|
Arrays should not be partially initialized. |
9.3 |
|
|
Function should not be declared implicitly. |
17.3 |
|
|
Function with a non-void return type should return a value from all exit paths. |
17.4 |
|
|
Value of the essential character type should be used appropriately in the addition/subtraction operations. |
10.2 |
|
|
The values used in expressions should have appropriate essential types. |
10.1 |
|
|
Conversion between pointers of different object types should not be performed. |
11.3 |
|
|
Expression resulting from the macro expansion should be surrounded by parentheses. |
20.7 |
|
|
The return value of non-void function should be used. |
17.7 |
|
|
The address of an object with local scope should not be passed out of its scope. |
18.6 |
|
|
Pointer to FILE should not be dereferenced. |
22.5 |
|
|
Expression containing increment (++) or decrement (--) should not have other side effects. |
13.3 |
|
|
Incorrect shifting expression. |
12.2 |
|
|
Use of a pointer to FILE when the associated stream has already been closed. |
22.6 |
|
|
Operand of sizeof() operator should not have other side effects. |
13.6 |
|
|
The result of an assignment expression should not be used. |
13.4 |
|
|
Expressions with pointer type should not be used in the '+', '-', '+=' and '-=' operations. |
18.4 |
|
|
A function should not call itself either directly or indirectly. |
17.2 |
|
|
Constant expression evaluation should not result in an unsigned integer wrap-around. |
12.4 |
|
|
Cast should not remove 'const' / 'volatile' qualification from the type that is pointed to by a pointer or a reference. |
11.8 |
|
|
Both operands of an operator should be of the same type category. |
10.4 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
11.4 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
11.5 |
|
|
Value of the expression should not be converted to the different essential type or the narrower essential type. |
10.3 |
|
|
Identifiers that start with '__' or '_[A-Z]' are reserved. |
21.1 |
|
|
Identifiers that start with '__' or '_[A-Z]' are reserved. |
21.2 |
|
|
The function argument corresponding to a parameter declared to have an array type should have an appropriate number of elements. |
17.5 |
|
|
Macro should not be defined with the same name as a keyword. |
20.4 |
|
|
The 'restrict' specifier should not be used. |
8.14 |
|
|
Single-line comments should not end with a continuation token. |
3.2 |
|
|
Block of memory should only be freed if it was allocated by a Standard Library function. |
22.2 |
|
|
Line whose first token is '#' should be a valid preprocessing directive. |
20.13 |
|
|
Expression used in condition should have essential Boolean type. |
14.4 |
|
|
Casts between a void pointer and an arithmetic type should not be performed. |
11.6 |
|
|
Flexible array members should not be declared. |
18.7 |
|
|
The '//' and '/*' character sequences should not appear within comments. |
3.1 |
|
|
All memory or resources allocated dynamically should be explicitly released. |
22.1 |
|
|
Casts between a pointer and a non-integer arithmetic type should not be performed. |
11.7 |
|
|
Conversions should not be performed between pointer to function and any other type. |
11.1 |
|
|
Bit fields should only be declared with explicitly signed or unsigned integer type |
6.1 |
|
|
An identifier declared in an inner scope should not hide an identifier in an outer scope. |
5.3 |
|
|
Single-bit bit fields should not be declared as signed type. |
6.2 |
|
|
Controlling expressions should not be invariant. |
14.3 |
|
|
Array size should be specified explicitly when array declaration uses designated initialization. |
9.5 |
|
|
The value of a composite expression should not be assigned to an object with wider essential type. |
10.6 |
|
|
Variable length array types are not allowed. |
18.8 |
|
|
The standard signal handling functions should not be used. |
21.5 |
|
|
The standard input/output functions should not be used. |
21.6 |
|
|
Functions should be declared in prototype form with named parameters. |
8.2 |
|
|
Octal and hexadecimal escape sequences should be terminated. |
4.1 |
|
|
The 'static' keyword shall not be used between [] in the declaration of an array parameter. |
17.6 |
|
|
Features from <stdarg.h> should not be used. |
17.1 |
|
|
Features from <tgmath.h> should not be used. |
21.11 |
|
|
There should be no attempt to write to a stream that has been opened for reading. |
22.4 |
|
|
Inline functions should be declared with the static storage class. |
8.10 |
|
|
The 'static' storage class specifier should be used in all declarations of object and functions that have internal linkage. |
8.8 |
|
|
There should be no occurrence of undefined or critical unspecified behaviour. |
1.3 |
|
|
The ', " or \ characters and the /* or // character sequences should not occur in a header file name. |
20.2 |
|
|
Casts between a pointer to an incomplete type and any other type shouldn't be performed. |
11.2 |
|
|
Array element should not be initialized more than once. |
9.4 |
|
|
Operand that is a composite expression has more narrow essential type than the other operand. |
10.7 |
|
|
External identifiers should be distinct. |
5.1 |
|
|
A compatible declaration should be visible when an object or function with external linkage is defined. |
8.4 |
|
|
All conditional inclusion preprocessor directives should reside in the same file as the conditional inclusion directive to which they are related. |
20.4 |
|
|
Object should not be assigned or copied to an overlapping object. |
19.1 |
|
|
Identifiers declared in the same scope and name space should be distinct. |
5.2 |
|
|
Typedef names should be unique across all name spaces. |
5.6 |
|
|
Value of a composite expression should not be cast to a different essential type category or a wider essential type. |
10.8 |
|
|
Tag names should be unique across all name spaces. |
5.7 |
|
|
External object or function should be declared once in one and only one file. |
8.5 |
|
|
Macro identifiers should be distinct. |
5.4 |
|
|
The initializer for an aggregate or union should be enclosed in braces. |
9.2 |
|
|
Identifiers that define objects or functions with external linkage shall be unique. |
5.8 |
|
|
Features from <fenv.h> should not be used. |
21.12 |
|
|
The function with the 'system' name should not be used. |
21.21 |
|
|
The functions with the 'rand' and 'srand' name of <stdlib.h> should not be used. |
21.24 |
|
|
All memory synchronization operation should be executed in sequentially consistent order. |
21.25 |
|
|
Switch statements should be well-formed. |
16.1 |
|
|
The macro parameter immediately following a '#' operator should not immediately be followed by a '##' operator. |
20.11 |
|
|
Tokens that look like a preprocessing directive should not occur within a macro argument. |
20.6 |
MISRA C 2023
- Mandatory + Required coverage: 86%;
- Mandatory + Required + Advisory coverage: 78%.
|
Error Code |
Error Description |
Mapping |
|---|---|---|
|
Octal constants should not be used. |
7.1 |
|
|
The 'goto' statement should not be used. |
15.1 |
|
|
Implicitly specified enumeration constants should be unique – consider specifying non-unique constants explicitly. |
8.12 |
|
|
Size of an array is not specified. |
8.11 |
|
|
The 'goto' statement shouldn't jump to a label declared earlier. |
15.2 |
|
|
A function should have a single point of exit at the end. |
15.5 |
|
|
The body of a loop\conditional statement should be enclosed in braces. |
15.6 |
|
|
The function with the 'atof/atoi/atol/atoll' name should not be used. |
21.7 |
|
|
The function with the 'abort/exit/getenv/system' name should not be used. |
21.8 |
|
|
The function with the 'qsort/bsearch' name should not be used. |
21.9 |
|
|
Memory allocation and deallocation functions should not be used. |
21.3 |
|
|
The macro with the 'setjmp' name and the function with the 'longjmp' name should not be used. |
21.4 |
|
|
Unions should not be used. |
19.2 |
|
|
Declaration should contain no more than two levels of pointer nesting. |
18.5 |
|
|
The 'if' ... 'else if' construct should be terminated with an 'else' statement. |
15.7 |
|
|
Literal suffixes should not contain lowercase characters. |
7.3 |
|
|
The 'default' label should be either the first or the last label of a 'switch' statement. |
16.1 |
|
|
The 'default' label should be either the first or the last label of a 'switch' statement. |
16.5 |
|
|
Every 'switch' statement should have a 'default' label, which, in addition to the terminating 'break' statement, should contain either a statement or a comment. |
16.1 |
|
|
Every 'switch' statement should have a 'default' label, which, in addition to the terminating 'break' statement, should contain either a statement or a comment. |
16.4 |
|
|
Every switch-clause should be terminated by an unconditional 'break' or 'throw' statement. |
16.3 |
|
|
All integer constants of unsigned type should have 'u' or 'U' suffix. |
7.2 |
|
|
A switch-label should only appear at the top level of the compound statement forming the body of a 'switch' statement. |
16.2 |
|
|
Every 'switch' statement should contain non-empty switch-clauses. |
16.6 |
|
|
The functions from time.h/ctime should not be used. |
21.10 |
|
|
A switch-expression should not have Boolean type. Consider using of 'if-else' construct. |
16.7 |
|
|
The comma operator should not be used. |
12.3 |
|
|
Any label should be declared in the same block as 'goto' statement or in any block enclosing it. |
15.3 |
|
|
Any loop should be terminated with no more than one 'break' or 'goto' statement. |
15.4 |
|
|
Expression of essential type 'foo' should not be explicitly cast to essential type 'bar'. |
10.5 |
|
|
String literal should not be assigned to object unless it has type of pointer to const-qualified char. |
7.4 |
|
|
The loop counter should not have floating-point type. |
14.1 |
|
|
Unreachable code should not be present in the project. |
2.1 |
|
|
Function should not contain labels not used by any 'goto' statements. |
2.6 |
|
|
Functions should not have unused parameters. |
2.7 |
|
|
The value of uninitialized variable should not be used. |
9.1 |
|
|
Arrays should not be partially initialized. |
9.3 |
|
|
Function should not be declared implicitly. |
17.3 |
|
|
Function with a non-void return type should return a value from all exit paths. |
17.4 |
|
|
Value of the essential character type should be used appropriately in the addition/subtraction operations. |
10.2 |
|
|
The values used in expressions should have appropriate essential types. |
10.1 |
|
|
Conversion between pointers of different object types should not be performed. |
11.3 |
|
|
Expression resulting from the macro expansion should be surrounded by parentheses. |
20.7 |
|
|
The return value of non-void function should be used. |
17.7 |
|
|
The address of an object with local scope should not be passed out of its scope. |
18.6 |
|
|
Pointer to FILE should not be dereferenced. |
22.5 |
|
|
Expression containing increment (++) or decrement (--) should not have other side effects. |
13.3 |
|
|
Incorrect shifting expression. |
12.2 |
|
|
Use of a pointer to FILE when the associated stream has already been closed. |
22.6 |
|
|
Operand of sizeof() operator should not have other side effects. |
13.6 |
|
|
The result of an assignment expression should not be used. |
13.4 |
|
|
Expressions with pointer type should not be used in the '+', '-', '+=' and '-=' operations. |
18.4 |
|
|
A function should not call itself either directly or indirectly. |
17.2 |
|
|
Constant expression evaluation should not result in an unsigned integer wrap-around. |
12.4 |
|
|
Cast should not remove 'const' / 'volatile' qualification from the type that is pointed to by a pointer or a reference. |
11.8 |
|
|
Both operands of an operator should be of the same type category. |
10.4 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
11.4 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
11.5 |
|
|
Value of the expression should not be converted to the different essential type or the narrower essential type. |
10.3 |
|
|
Identifiers that start with '__' or '_[A-Z]' are reserved. |
21.1 |
|
|
Identifiers that start with '__' or '_[A-Z]' are reserved. |
21.2 |
|
|
The function argument corresponding to a parameter declared to have an array type should have an appropriate number of elements. |
17.5 |
|
|
Macro should not be defined with the same name as a keyword. |
20.4 |
|
|
The 'restrict' specifier should not be used. |
8.14 |
|
|
Single-line comments should not end with a continuation token. |
3.2 |
|
|
Block of memory should only be freed if it was allocated by a Standard Library function. |
22.2 |
|
|
Line whose first token is '#' should be a valid preprocessing directive. |
20.13 |
|
|
Expression used in condition should have essential Boolean type. |
14.4 |
|
|
Casts between a void pointer and an arithmetic type should not be performed. |
11.6 |
|
|
Flexible array members should not be declared. |
18.7 |
|
|
The '//' and '/*' character sequences should not appear within comments. |
3.1 |
|
|
All memory or resources allocated dynamically should be explicitly released. |
22.1 |
|
|
Casts between a pointer and a non-integer arithmetic type should not be performed. |
11.7 |
|
|
Conversions should not be performed between pointer to function and any other type. |
11.1 |
|
|
Bit fields should only be declared with explicitly signed or unsigned integer type |
6.1 |
|
|
An identifier declared in an inner scope should not hide an identifier in an outer scope. |
5.3 |
|
|
Single-bit bit fields should not be declared as signed type. |
6.2 |
|
|
Controlling expressions should not be invariant. |
14.3 |
|
|
Array size should be specified explicitly when array declaration uses designated initialization. |
9.5 |
|
|
The value of a composite expression should not be assigned to an object with wider essential type. |
10.6 |
|
|
Variable length array types are not allowed. |
18.8 |
|
|
The standard signal handling functions should not be used. |
21.5 |
|
|
The standard input/output functions should not be used. |
21.6 |
|
|
Functions should be declared in prototype form with named parameters. |
8.2 |
|
|
Octal and hexadecimal escape sequences should be terminated. |
4.1 |
|
|
The 'static' keyword shall not be used between [] in the declaration of an array parameter. |
17.6 |
|
|
Features from <stdarg.h> should not be used. |
17.1 |
|
|
Features from <tgmath.h> should not be used. |
21.11 |
|
|
There should be no attempt to write to a stream that has been opened for reading. |
22.4 |
|
|
Inline functions should be declared with the static storage class. |
8.10 |
|
|
The 'static' storage class specifier should be used in all declarations of object and functions that have internal linkage. |
8.8 |
|
|
There should be no occurrence of undefined or critical unspecified behaviour. |
1.3 |
|
|
The ', " or \ characters and the /* or // character sequences should not occur in a header file name. |
20.2 |
|
|
Casts between a pointer to an incomplete type and any other type shouldn't be performed. |
11.2 |
|
|
Array element should not be initialized more than once. |
9.4 |
|
|
Operand that is a composite expression has more narrow essential type than the other operand. |
10.7 |
|
|
External identifiers should be distinct. |
5.1 |
|
|
A compatible declaration should be visible when an object or function with external linkage is defined. |
8.4 |
|
|
All conditional inclusion preprocessor directives should reside in the same file as the conditional inclusion directive to which they are related. |
20.4 |
|
|
Object should not be assigned or copied to an overlapping object. |
19.1 |
|
|
Identifiers declared in the same scope and name space should be distinct. |
5.2 |
|
|
Typedef names should be unique across all name spaces. |
5.6 |
|
|
Value of a composite expression should not be cast to a different essential type category or a wider essential type. |
10.8 |
|
|
Tag names should be unique across all name spaces. |
5.7 |
|
|
External object or function should be declared once in one and only one file. |
8.5 |
|
|
Macro identifiers should be distinct. |
5.4 |
|
|
The initializer for an aggregate or union should be enclosed in braces. |
9.2 |
|
|
Identifiers that define objects or functions with external linkage shall be unique. |
5.8 |
|
|
The 'sizeof' operator should not have an operand which is a function parameter declared as 'array of type'. |
12.5 |
|
|
Function type should not be type qualified. |
17.13 |
|
|
The pointer arguments to the Standard Library functions memcpy, memmove and memcmp should be pointers to qualified or unqualified versions of compatible types. |
21.15 |
|
|
Pointer arguments to the 'memcmp' function should point to an appropriate type. |
21.16 |
|
|
Bit field should not be declared as a member of a union. |
6.3 |
|
|
Pointers to variably-modified array types should not be used. |
18.10 |
|
|
Object with temporary lifetime should not undergo array-to-pointer conversion. |
18.9 |
|
|
Identifiers should be distinct from macro names. |
5.5 |
|
|
Features from <fenv.h> should not be used. |
21.12 |
|
|
The function with the 'system' name should not be used. |
21.21 |
|
|
The functions with the 'rand' and 'srand' name of <stdlib.h> should not be used. |
21.24 |
|
|
A 'noreturn' function should have 'void' return type. |
17.10 |
|
|
Generic association should list an appropriate type. |
23.4 |
|
|
Default association should appear as either the first or the last association of a generic selection. |
23.8 |
|
|
Thread objects, thread synchronization objects and thread-specific storage pointers should have appropriate storage duration. |
22.13 |
|
|
Types should be explicitly specified. |
8.1 |
|
|
The '_Atomic' specifier should not be applied to the incomplete type 'void'. |
11.10 |
|
|
All memory synchronization operation should be executed in sequentially consistent order. |
21.25 |
|
|
Controlling expression of generic selection must not have side effects. |
23.2 |
|
|
The language features specified in Annex K should not be used. |
1.4 |
|
|
All arguments of any multi-argument type-generic macros from <tgmath.h> should have the same type. |
21.23 |
|
|
Structure and union members of atomic objects should not be directly accessed. |
12.6 |
|
|
Null pointer constant must be derived by expansion of the NULL macro provided by the implementation. |
11.9 |
|
|
All arguments of any type-generic macros from <tgmath.h> should have an appropriate essential type. |
21.22 |
|
|
Controlling expression of generic selection should have essential type that matches its standard type |
23.6 |
|
|
Initializer using chained designators should not contain initializers without designators. |
9.6 |
|
|
Argument of an integer constant macro should have an appropriate form. |
7.5 |
|
|
The small integer variants of the minimum-width integer constant macros should not be used. |
7.6 |
|
|
Initializer list should not contain persistent side effects. |
13.1 |
|
|
The right operand of a logical '&&' or '||' operator should not contain persistent side effects. |
13.5 |
|
|
Standard Library function 'memcmp' should not be used to compare null-terminated strings. |
21.14 |
|
|
Obsolescent language features should not be used. |
1.5 |
|
|
Dead code should not be used in a project. |
2.2 |
|
|
Switch statements should be well-formed. |
16.1 |
|
|
A function declared with a _Noreturn specifier should not return to its caller. |
16.1 |
|
|
A 'for' loop should be well-formed. |
14.2 |
|
|
Any value passed to a function from <ctype.h> should be representable as an unsigned character or be the value EOF. |
21.13 |
|
|
The macro EOF should only be compared with the unmodified return value of any Standard Library function capable of returning EOF. |
22.7 |
|
|
Use of the string handling functions from <string.h> should not result in accesses beyond the bounds of the objects referenced by their pointer parameters. |
21.17 |
|
|
The size argument passed to function from <string.h> should have an appropriate value. |
21.18 |
|
|
All declarations of an object with an explicit alignment specification should specify the same alignment. |
8.15 |
|
|
The value of an expression and its persistent side effects must be the same under all permitted evaluation orders and must be independent from thread interleaving. |
13.2 |
|
|
The macro parameter immediately following a '#' operator should not immediately be followed by a '##' operator. |
20.11 |
|
|
Tokens that look like a preprocessing directive should not occur within a macro argument. |
20.6 |
|
|
Thread objects, thread synchronization objects, and thread-specific storage pointers should only be accessed by the appropriate Standard Library functions. |
22.12 |
|
|
Pointers returned by the function 'localeconv' / 'getenv' / 'setlocale' / 'strerror' should be used as if they have pointer to const-qualified type. |
21.19 |
|
|
Subtraction between pointers should only be applied to pointers that address elements of the same array. |
18.2 |
MISRA C++ 2008
- Required + Advisory coverage: 33%
|
Error Code |
Error Description |
Mapping |
|---|---|---|
|
Octal constants should not be used. |
2-13-2 |
|
|
Size of an array is not specified. |
3-1-3 |
|
|
The 'goto' statement shouldn't jump to a label declared earlier. |
6-6-2 |
|
|
A function should have a single point of exit at the end. |
6-6-5 |
|
|
The body of a loop\conditional statement should be enclosed in braces. |
6-3-1 |
|
|
The body of a loop\conditional statement should be enclosed in braces. |
6-4-1 |
|
|
The function with the 'atof/atoi/atol/atoll' name should not be used. |
18-0-2 |
|
|
The function with the 'abort/exit/getenv/system' name should not be used. |
18-0-3 |
|
|
Memory allocation and deallocation functions should not be used. |
18-4-1 |
|
|
The macro with the 'setjmp' name and the function with the 'longjmp' name should not be used. |
17-0-5 |
|
|
Unbounded functions performing string operations should not be used. |
18-0-5 |
|
|
Unions should not be used. |
9-5-1 |
|
|
Declaration should contain no more than two levels of pointer nesting. |
5-0-19 |
|
|
The 'if' ... 'else if' construct should be terminated with an 'else' statement. |
6-4-2 |
|
|
Literal suffixes should not contain lowercase characters. |
2-13-4 |
|
|
Every switch-clause should be terminated by an unconditional 'break' or 'throw' statement. |
6-4-5 |
|
|
Only the first member of enumerator list should be explicitly initialized, unless all members are explicitly initialized. |
8-5-3 |
|
|
The 'switch' statement should have 'default' as the last label. |
6-4-6 |
|
|
All integer constants of unsigned type should have 'u' or 'U' suffix. |
2-13-3 |
|
|
A switch-label should only appear at the top level of the compound statement forming the body of a 'switch' statement. |
6-4-4 |
|
|
Every 'switch' statement should contain non-empty switch-clauses. |
6-4-8 |
|
|
The functions from time.h/ctime should not be used. |
18-0-4 |
|
|
A switch-expression should not have Boolean type. Consider using of 'if-else' construct. |
6-4-7 |
|
|
The comma operator should not be used. |
5-18-1 |
|
|
Any label should be declared in the same block as 'goto' statement or in any block enclosing it. |
6-6-1 |
|
|
Any loop should be terminated with no more than one 'break' or 'goto' statement. |
6-6-4 |
|
|
C-style and functional notation casts should not be performed. |
5-2-4 |
|
|
The loop counter should not have floating-point type. |
6-5-1 |
|
|
Unreachable code should not be present in the project. |
0-1-1 |
|
|
Functions should not have unused parameters. |
0-1-11 |
|
|
The value of uninitialized variable should not be used. |
8-5-1 |
|
|
Class destructor should not exit with an exception. |
15-5-1 |
|
|
Function with a non-void return type should return a value from all exit paths. |
8-4-3 |
|
|
Expression resulting from the macro expansion should be surrounded by parentheses. |
16-0-6 |
|
|
The return value of non-void function should be used. |
0-1-7 |
|
|
The address of an object with local scope should not be passed out of its scope. |
7-5-2 |
|
|
Floating-point values should not be tested for equality or inequality. |
6-2-2 |
|
|
Variable should be declared in a scope that minimizes its visibility. |
3-4-1 |
|
|
Expressions with enum underlying type should have values corresponding to the enumerators of the enumeration. |
7-2-1 |
|
|
Unary minus operator should not be applied to an expression of the unsigned type. |
5-3-2 |
|
|
Expression containing increment (++) or decrement (--) should not have other side effects. |
5-2-10 |
|
|
Incorrect shifting expression. |
5-8-1 |
|
|
Operand of sizeof() operator should not have other side effects. |
5-3-4 |
|
|
A pointer/reference parameter in a function should be declared as pointer/reference to const if the corresponding object was not modified. |
7-1-2 |
|
|
Subtraction, >, >=, <, <= should be applied only to pointers that address elements of the same array. |
5-0-17 |
|
|
Subtraction, >, >=, <, <= should be applied only to pointers that address elements of the same array. |
5-0-18 |
|
|
There should be no user-defined variadic functions. |
8-4-1 |
|
|
The result of an assignment expression should not be used. |
6-2-1 |
|
|
Expressions with pointer type should not be used in the '+', '-', '+=' and '-=' operations. |
5-0-15 |
|
|
Array indexing should be the only form of pointer arithmetic and it should be applied only to objects defined as an array type. |
5-0-15 |
|
|
There should be no implicit integral-floating conversion. |
5-0-5 |
|
|
A function should not call itself either directly or indirectly. |
7-5-4 |
|
|
Constant expression evaluation should not result in an unsigned integer wrap-around. |
5-19-1 |
|
|
Cast should not remove 'const' / 'volatile' qualification from the type that is pointed to by a pointer or a reference. |
5-2-5 |
|
|
The 'operator &&', 'operator ||', 'operator ,' and the unary 'operator &' should not be overloaded. |
5-2-11 |
|
|
The 'operator &&', 'operator ||', 'operator ,' and the unary 'operator &' should not be overloaded. |
5-3-3 |
|
|
Operands of the logical '&&' or the '||' operators, the '!' operator should have 'bool' type. |
5-3-1 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
5-2-8 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
5-2-9 |
|
|
Identifiers that start with '__' or '_[A-Z]' are reserved. |
17-0-1 |
|
|
Functions should not be declared at block scope. |
3-1-2 |
|
|
The global namespace should only contain 'main', namespace declarations and 'extern "C"' declarations. |
7-3-1 |
|
|
The identifier 'main' should not be used for a function other than the global function 'main'. |
7-3-2 |
|
|
An identifier with array type passed as a function argument should not decay to a pointer. |
5-2-12 |
|
|
Cast should not convert pointer to function to any other pointer type. |
5-2-6 |
|
|
The standard signal handling functions should not be used. |
18-7-1 |
|
|
The standard input/output functions should not be used. |
27-0-1 |
|
|
The 'static' storage class specifier should be used in all declarations of object and functions that have internal linkage. |
3-3-2 |
|
|
All conditional inclusion preprocessor directives should reside in the same file as the conditional inclusion directive to which they are related. |
16-1-2 |
|
|
The value of an expression and its persistent side effects must be the same under all permitted evaluation orders and must be independent from thread interleaving. |
5-0-1 |
MISRA C++ 2023
- Mandatory + Required coverage: 24%;
- Mandatory + Required + Advisory coverage: 19%.
|
Error Code |
Error Description |
Mapping |
|---|---|---|
|
Octal constants should not be used. |
5-13-3 |
|
|
The 'goto' statement shouldn't jump to a label declared earlier. |
9-6-3 |
|
|
The body of a loop\conditional statement should be enclosed in braces. |
9-3-1 |
|
|
The function with the 'atof/atoi/atol/atoll' name should not be used. |
21-2-1 |
|
|
The function with the 'abort/exit/getenv/system' name should not be used. |
21-2-3 |
|
|
The macro with the 'setjmp' name and the function with the 'longjmp' name should not be used. |
21-10-2 |
|
|
Unions should not be used. |
12-3-1 |
|
|
The 'if' ... 'else if' construct should be terminated with an 'else' statement. |
9-4-1 |
|
|
The value of uninitialized variable should not be used. |
11-6-2 |
|
|
Function with a non-void return type should return a value from all exit paths. |
9-6-5 |
|
|
Expression resulting from the macro expansion should be surrounded by parentheses. |
19-3-4 |
|
|
The return value of non-void function should be used. |
0-1-2 |
|
|
The address of an object with local scope should not be passed out of its scope. |
6-8-3 |
|
|
Subtraction, >, >=, <, <= should be applied only to pointers that address elements of the same array. |
8-7-2 |
|
|
Subtraction, >, >=, <, <= should be applied only to pointers that address elements of the same array. |
8-9-1 |
|
|
A function should not call itself either directly or indirectly. |
8-2-10 |
|
|
Cast should not remove 'const' / 'volatile' qualification from the type that is pointed to by a pointer or a reference. |
8-2-3 |
|
|
The 'operator &&', 'operator ||', 'operator ,' and the unary 'operator &' should not be overloaded. |
16-5-2 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
8-2-6 |
|
|
Conversions between pointers to objects and integer types should not be performed. |
8-2-7 |
|
|
Functions should not be declared at block scope. |
6-0-1 |
|
|
The identifier 'main' should not be used for a function other than the global function 'main'. |
6-0-4 |
|
|
Single-line comments should not end with a continuation token. |
5-7-3 |
|
|
Line whose first token is '#' should be a valid preprocessing directive. |
19-0-1 |
|
|
The '//' and '/*' character sequences should not appear within comments. |
5-7-1 |
|
|
An identifier declared in an inner scope should not hide an identifier in an outer scope. |
6-4-1 |
|
|
Single-bit bit fields should not be declared as signed type. |
12-2-3 |
|
|
The standard signal handling functions should not be used. |
21-10-3 |
|
|
The standard input/output functions should not be used. |
30-0-1 |
|
|
Octal and hexadecimal escape sequences should be terminated. |
5-13-2 |
|
|
Features from <stdarg.h> should not be used. |
21-10-1 |
|
|
All conditional inclusion preprocessor directives should reside in the same file as the conditional inclusion directive to which they are related. |
19-1-2 |
|
|
The value of an expression and its persistent side effects must be the same under all permitted evaluation orders and must be independent from thread interleaving. |
4-6-1 |