MISRA 2008
MISRA 2008
Below are the list of MISRA 2008 rules supported by Embold:
Rules | Rule Name |
---|---|
Rule 0-1-1 | A project shall NOt contain unreachable code. |
Rule 0-1-2 | A project shall NOt contain infeasible paths. |
Rule 0-1-3 | A project shall NOt contain unused variables. |
Rule 0-1-5 | A project shall NOt contain unused type declarations. |
Rule 0-1-7 | The value returned by a function having a NOn-void return type that is NOt an overloaded operator shall always be used. |
Rule 0-1-9 | There shall be NO dead code. |
Rule 0-1- 10 | Every defined function shall be called at least once. |
Rule 0-1- 11 | There shall be NO unused parameters (named or unnamed) in NOn-virtual functions. |
Rule 2-3-1 | Trigraphs shall NOt be used. |
Rule 2-5-1 | Digraphs should NOt be used. |
Rule 2-7-1 | The character sequence /* shall NOt be used within a C-style comment. |
Rule 2-7-2 | Sections of code shall NOt be “commented out” using C-style comments. |
Rule 2-7-3 | Sections of code should NOt be “commented out” using C++ comments. |
Rule 2-10-2 | Identifiers declared in an inner scope shall NOt hide an identifier declared in an outer scope. |
Rule 2-10-3 | A typedef name (including qualification, if any) shall be a unique identifier. |
Rule 2-10-4 | The identifier name of a NOn-member object or function with static storage duration should NOt be reused. |
Rule 2-10-5 | If an identifier refers to a type, it shall NOt also refer to an object or a function in the same scope. |
Rule 2-13-1 | Only those escape sequences that are defined in ISO/IEC 14882:2003 shall be used. |
Rule 2-13-2 | Octal constants (other than zero) and octal escape sequences (other than “\0”) shall NOt be used. |
Rule 2-13-3 | A “U ” suffix shall be applied to all octal or hexadecimal integer literals of unsigned type. |
Rule 2-13-4 | Literal suffixes shall be upper case. |
Rule 2-13-5 | Narrow and wide string literals shall NOt be concatenated. |
Rule 3-1-3 | When an array is declared, its size shall either be stated explicitly or defined implicitly by initialization. |
Rule 3-2-1 | All declarations of an object or function shall have compatible types. |
Rule 3-2-2 | The One Definition Rule shall NOt be violated. |
Rule 3-2-3 | A type, object or function that is used in multiple translation units shall be declared in one and only one file. |
Rule 3-2-4 | An identifier with external linkage shall have exactly one definition. |
Rule 3-3-2 | If a function has internal linkage then all re-declarations shall include the static storage class specifier. |
Rule 5-Rule 5-0-1 0-1 | The value of an expression shall be the same under any order of evaluation that the standard permits. |
Rule 5-0-2 | Limited dependence should be placed on C++ operator precedence rules in expressions. |
Rule 5-0-4 | An implicit integral conversion shall NOt change the signedness of the underlying type. |
Rule 5-0-5 | There shall be NO implicit floating-integral conversions. |
Rule 5-0-6 | An implicit integral or floating-point conversion shall NOt reduce the size of the underlying type |
Rule 5-0-8 | An explicit integral or floating-point conversion shall NOt increase the size of the underlying type of a cvalue expression. |
Rule 5-0-9 | An explicit integral conversion shall NOt change the signedness of the underlying type of a cvalue expression. |
Rule 5-0- 13 | The condition of an if‑statement and the condition of an iteration‑statement shall have type bool . |
Rule 5-0- 17 | Subtraction between pointers shall only be applied to pointers that address elements of the same array. |
Rule 5-0- 18 | >, >=, <, <= shall NOt be applied to objects of pointer type, except where they point to the same array. |
Rule 5-0- 21 | Bitwise operators shall only be applied to operands of unsigned underlying type. |
Rule 5-2-3 | Casts from a base class to a derived class should NOt be performed on polymorphic types. |
Rule 5-2-4 | C-style casts (other than void casts) and functional NOtation casts (other than explicit constructor calls) shall NOt be used. |
Rule 5-2-5 | A cast shall NOt remove any const or volatile qualification from the type of a pointer or reference. |
Rule 5-2-6 | A cast shall NOt convert a pointer to a function to any other pointer type, including a pointer to function type. |
Rule 5-2-7 | An object with pointer type shall NOt be converted to an unrelated pointer type, either directly or indirectly. |
Rule 5-2-8 | An object with integer type or pointer to void type shall NOt be converted to an object with pointer type. |
Rule 5-2-9 | A cast should NOt convert a pointer type to an integral type. |
Rule 5-2- 12 | An identifier with array type passed as a function argument shall NOt decay to a pointer. |
Rule 5-3-4 | Evaluation of the operand to the sizeof operator shall NOt contain side effects. |
Rule 5-14-1 | The right hand operand of a logical && or || operator shall NOt contain side effects. |
Rule 5-18-1 | The comma operator shall NOt be used. |
Rule 6-3-1 | The statement forming the body of a switch, while, do... while or for statement shall be a compound statement. |
Rule 6-4-2 | All if ... else if constructs shall be terminated with an else clause. |
Rule 6-4-3 | A switch statement shall be a well‑formed switch statement. |
Rule 6-4-5 | An unconditional throw or break statement shall terminate every NOnempty switch‑clause. |
Rule 6-4-6 | The final clause of a switch statement shall be the default‑ clause. |
Rule 6-4-7 | The condition of a switch statement shall NOt have bool type |
Rule 6-4-8 | Every switch statement shall have at least one case‑clause. |
Rule 6-5-3 | The loop‑counter shall NOt be modified within condition or statement. |
Rule 6-5-5 | A loop‑control‑variable other than the loop‑counter shall NOt be modified within condition or expression. |
Rule 6-5-6 | A loop‑control‑variable other than the loop‑counter which is modified in statement shall have type bool . |
Rule 6-6-3 | The continue statement shall only be used within a well‑formed for loop. |
Rule 6-6-4 | For any iteration statement there shall be NO more than one break or goto statement used for loop termination. |
Rule 6-6-5 | A function shall have a single point of exit at the end of the function. |
Rule 7-5-3 | A function shall NOt return a reference or a pointer to a parameter that is passed by reference or const reference. |
Rule 7-5-4 | Functions should NOt call themselves, either directly or indirectly. |
Rule 8-4-3 | All exit paths from a function with NOn-void return type shall have an explicit return statement with an expression. |
Rule 8-5-1 | All variables shall have a defined value before they are used. |
Rule 9-3-1 | const member functions shall NOt return NOn-const pointers or references to class‑data. |
Rule 9-5-1 | Unions shall NOt be used. |
Rule 10- 1-1 | Classes should NOt be derived from virtual bases. |
Rule 10- 3-2 | Each overriding virtual function shall be declared with the virtual keyword. |
Rule 15- 3-2 | There should be at least one exception handler to catch all otherwise unhandled exceptions |
Rule 15- 3-5 | A class type exception shall always be caught by reference. |
Rule 15- 5-1 | A class destructor shall NOt exit with an exception. |
Rule 16- 0-1 | #include directives in a file shall only be preceded by other preprocessor directives or comments. |
Rule 16- 0-8 | If the # token appears as the first token on a line, then it shall be immediately followed by a preprocessing token. |
Rule 16- 2-1 | The pre-processor shall only be used for file inclusion and include guards. |
Rule 16- 2-2 | C++ macros shall only be used for include guards, type qualifiers, or storage class specifiers. |
Rule 16- 2-3 | Include guards shall be provided. |
Rule 16- 2-4 | The ′,″,/* or // characters shall NOt occur in a header file name. |
Rule 16- 2-5 | The \ character should NOt occur in a header file name. |
Rule 16- 2-6 | The #include directive shall be followed by either a or ″filename″ sequence |
Rule 16- 3-1 | There shall be at most one occurrence of the # or ## operators in a single macro definition. |
Rule 16- 3-2 | The # and ## operators should NOt be used. |
Rule 17- 0-1 | Reserved identifiers, macros and functions in the standard library shall NOt be defined, redefined or undefined. |
Rule 17- 0-2 | The names of standard library macros and objects shall NOt be reused |
Rule 17- 0-5 | The setjmp macro and the longjmp function shall NOt be used. |
Rule 18- 0-1 | The C library shall NOt be used. |
Rule 18- 0-2 | The library functions atof, atoi and atol from library shall NOt be used. |
Rule 18- 0-3 | The library functions abort, exit, getenv and system from library shall NOt be used |
Rule 18- 0-4 | The time handling functions of library shall NOt be used. |
Rule 18- 0-5 | The unbounded functions of library shall NOt be used. |
Rule 18- 2-1 | The macro offsetof shall NOt be used. |
Rule 18- 4-1 | Dynamic heap memory allocation shall NOt be used. |
Rule 18- 7-1 | The signal handling facilities of shall NOt be used. |
Rule 19- 3-1 | The error indicator errNO shall NOt be used. |
Rule 27- 0-1 | The stream input/output library shall NOt be used. |
Rule 0-1- 12 | There shall be NO unused parameters (named or unnamed) in the set of parameters for a virtual function and all the functions that override it. |
Rule 3-9-1 | The types used for an object, a function return type, or a function parameter shall be token-for-token identical in all declarations and redeclarations. |
Rule 3-9-1 | A pointer operand and any pointer resulting from pointer arithmetic using that operand shall both address elements of the same array. |
Rule 5-19-1 | Evaluation of constant unsigned integer expressions should NOt lead to wrap-around. |
Rule 6-4-1 | The else keyword shall be followed by either a compound statement, or aNOther if statement. |
Rule 6-4-4 | A switch‑label shall only be used when the most closely- enclosing compound statement is the body of a switch statement. |
Rule 7-1-2 | A pointer or reference parameter in a function shall be declared as pointer to const or reference to const if the corresponding object is NOt modified. |
Rule 7-5-1 | A function shall NOt return a reference or a pointer to an automatic variable (including parameters), defined within the function. |
Rule 7-5-2 | The address of an object with automatic storage shall NOt be assigned to aNOther object that may persist after the first object has ceased to exist. |
Rule 10- 3-3 | A virtual function shall only be overridden by a pure virtual function if it is itself declared as pure virtual. |
Rule 11- 0-1 | Member data in NOn-POD class types shall be private. |
Rule 12- 8-2 | The copy assignment operator shall be declared protected or private in an abstract class |
Rule 16- 0-7 | Undefined macro identifiers shall NOt be used in #if or #elif preprocessor directives, except as operands to the defined operator. |
Rule 16- 0-7 | All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if or #ifdef directive to which they are related. |
Updated over 2 years ago