Классификация предупреждений PVS-Studio согласно AUTOSAR C++14 Coding Guidelines
AUTOSAR C++14 Coding Guidelines — это набор руководств для написания кода на языке C++14, который предназначен для работы в системах, в которых важны безопасность и отказоустойчивость. Этот документ является обновлением стандарта MISRA C++:2008, а также основан на других ведущих стандартах написания кода и исследованиях, проделанных AUTOSAR. Основной сферой применения данного документа является автомобильная промышленность, но он также может быть использован и в других отраслях, занимающихся разработкой встраиваемых систем.
C/C++ диагностики
Error Code |
Error Description |
Mapping |
---|---|---|
Octal constants should not be used. |
AUTOSAR-M2.13.2 |
|
Size of an array is not specified. |
AUTOSAR-A3.1.4 |
|
The 'goto' statement shouldn't jump to a label declared earlier. |
AUTOSAR-M6.6.2 |
|
The body of a loop\conditional statement should be enclosed in braces. |
AUTOSAR-M6.3.1, AUTOSAR-M6.4.1 |
|
The function with the 'atof/atoi/atol/atoll' name should not be used. |
AUTOSAR-A18.0.2 |
|
The function with the 'abort/exit/getenv/system' name should not be used. |
AUTOSAR-M18.0.3 |
|
The macro with the 'setjmp' name and the function with the 'longjmp' name should not be used. |
AUTOSAR-M17.0.5 |
|
Unbounded functions performing string operations should not be used. |
AUTOSAR-M18.0.5 |
|
Unions should not be used. |
AUTOSAR-M9.5.1 |
|
Declaration should contain no more than two levels of pointer nesting. |
AUTOSAR-A5.0.3 |
|
The 'if' ... 'else if' construct should be terminated with an 'else' statement. |
AUTOSAR-M6.4.2 |
|
Literal suffixes should not contain lowercase characters. |
AUTOSAR-M2.13.4 |
|
Every switch-clause should be terminated by an unconditional 'break' or 'throw' statement. |
AUTOSAR-M6.4.5 |
|
The 'switch' statement should have 'default' as the last label. |
AUTOSAR-M6.4.6 |
|
All integer constants of unsigned type should have 'U' suffix. |
AUTOSAR-M2.13.3 |
|
A switch-label should only appear at the top level of the compound statement forming the body of a 'switch' statement. |
AUTOSAR-M6.4.4 |
|
The functions from time.h/ctime should not be used. |
AUTOSAR-M18.0.4 |
|
A switch-expression should not have Boolean type. Consider using of 'if-else' construct. |
AUTOSAR-M6.4.7 |
|
The comma operator should not be used. |
AUTOSAR-M5.18.1 |
|
Any label should be declared in the same block as 'goto' statement or in any block enclosing it. |
AUTOSAR-M6.6.1 |
|
The loop counter should not have floating-point type. |
AUTOSAR-A6.5.2 |
|
Unreachable code should not be present in the project. |
AUTOSAR-M0.1.1 |
|
Functions should not have unused parameters. |
AUTOSAR-M0.1.11 |
|
The value of uninitialized variable should not be used. |
AUTOSAR-M8.5.1 |
|
Function with a non-void return type should return a value from all exit paths. |
AUTOSAR-A8.4.2 |
|
Expression resulting from the macro expansion should be surrounded by parentheses. |
AUTOSAR-M16.0.6 |
|
The return value of non-void function should be used. |
AUTOSAR-A0.1.2 |
|
The address of an object with local scope should not be passed out of its scope. |
AUTOSAR-M7.5.2 |
|
Floating-point values should not be tested for equality or inequality. |
AUTOSAR-M6.2.2 |
|
Variable should be declared in a scope that minimizes its visibility. |
AUTOSAR-M3.4.1 |
|
Expressions with enum underlying type should have values corresponding to the enumerators of the enumeration. |
AUTOSAR-A7.1.2 |
|
Unary minus operator should not be applied to an expression of the unsigned type. |
AUTOSAR-M5.3.2 |
|
Expression containing increment (++) or decrement (--) should not have other side effects. |
AUTOSAR-M5.2.10 |
|
Incorrect shifting expression. |
AUTOSAR-M5.8.1 |
|
Operand of sizeof() operator should not have other side effects. |
AUTOSAR-M5.3.4 |
|
A pointer/reference parameter in a function should be declared as pointer/reference to const if the corresponding object was not modified. |
AUTOSAR-M7.1.2 |
|
Subtraction, >, >=, <, <= should be applied only to pointers that address elements of the same array. |
AUTOSAR-M5.0.17, AUTOSAR-M5.0.18 |
|
The result of an assignment expression should not be used. |
AUTOSAR-M6.2.1 |
|
Array indexing should be the only form of pointer arithmetic and it should be applied only to objects defined as an array type. |
AUTOSAR-M5.0.15 |
|
There should be no implicit integral-floating conversion. |
AUTOSAR-M5.0.5 |
|
A function should not call itself either directly or indirectly. |
AUTOSAR-A7.5.1 |
|
Constant expression evaluation should not result in an unsigned integer wrap-around. |
AUTOSAR-M5.19.1 |
|
Cast should not remove 'const' / 'volatile' qualification from the type that is pointed to by a pointer or a reference. |
AUTOSAR-A5.2.3 |
|
The 'operator &&', 'operator ||', 'operator ,' and the unary 'operator &' should not be overloaded. |
AUTOSAR-M5.2.11, AUTOSAR-M5.3.3 |
|
Operands of the logical '&&' or the '||' operators, the '!' operator should have 'bool' type. |
AUTOSAR-M5.3.1 |
|
Conversions between pointers to objects and integer types should not be performed. |
AUTOSAR-M5.2.8, AUTOSAR-M5.2.9 |
|
Identifiers that start with '__' or '_[A-Z]' are reserved. |
AUTOSAR-A17.0.1 |
|
Functions should not be declared at block scope. |
AUTOSAR-M3.1.2 |
|
The global namespace should only contain 'main', namespace declarations and 'extern "C"' declarations. |
AUTOSAR-M7.3.1 |
|
The identifier 'main' should not be used for a function other than the global function 'main'. |
AUTOSAR-M7.3.2 |
|
An identifier with array type passed as a function argument should not decay to a pointer. |
AUTOSAR-M5.2.12 |
|
Cast should not convert a pointer to a function to any other pointer type, including a pointer to function type. |
AUTOSAR-M5.2.6 |
|
The standard signal handling functions should not be used. |
AUTOSAR-M18.7.1 |
|
The standard input/output functions should not be used. |
AUTOSAR-M27.0.1 |
|
The 'static' storage class specifier should be used in all declarations of functions that have internal linkage. |
AUTOSAR-M3.3.2 |