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