AUTOSAR

AUTOSAR guidelines ensure that your code is safe and secure. Each rule has its own description. Below are the list of AUTOSAR rules supported by Embold:

RuleDescription
Rule M0-1-1A project shall NOt contain unreachable code
Rule M0-1-2A project shall NOt contain infeasible paths.
Rule M0-1-3A project shall NOt contain unused variables.
Rule M0-1-A project shall NOt contain unused type declarations.
Rule A0-1-2The value returned by a function having a NOn-void return type that is NOt aNOverloaded operator shall be used.
Rule M0-1-9There shall be NO dead code.
Rule M0-1-10Every defined function should be called at least once
Rule M0-1-11There shall be NO unused parameters (named or unnamed) in NOnvirtualfunctions.
Rule M0-1-12There 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 A2-5-1Trigraphs shall NOt be used.
Rule A2-6-1Digraphs shall NOt be used.
Rule A2-8-1The character \ shall NOt occur as a last character of a C++ comment
Rule A2-8-2Sections of code shall NOt be “commented out”.
Rule A2-8-4C-style comments shall NOt be used.
Rule A2-11-1An identifier declared in an inner scope shall NOt hide an identifier declared in an outer scope
Rule M2-10-3A typedef name (including qualification, if any) shall be a unique identifier
Rule M2-13-3A “U” suffix shall be applied to all octal or hexadecimal integer literals of unsigned type.
Rule M2-13-4Literal suffixes shall be upper case.
Rule A3-1-4When an array with external linkage is declared, its size shall be stated explicitly.
Rule M3-2-1All declarations of an object or function shall have compatible types
Rule M3-2-2The One Definition Rule shall NOt be violated
Rule M3-2-3A type, object or function that is used in multiple translation units shall be declared in one and only one file.
Rule M3-2-4An identifier with external linkage shall have exactly one definition.
Rule A3-3-Objects or functions with external linkage (including members of namednamespaces) shall be declared in a header file.
Rule M3-3-2If a function has internal linkage then all re-declarations shall include the static storage class specifier.
Rule M3-4-1An identifier declared to be an object or type shall be defined in a block that minimizes its visibility
Rule M3-9-1The 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 M5-0-3A cvalue expression shall NOt be implicitly converted to a different underlying type
Rule M5-0-4An implicit integral conversion shall NOt change the signedness of the underlying type.
Rule M5-0-5There shall be NO implicit floating-integral conversions.
Rule M5-0-16A pointer operand and any pointer resulting from pointer arithmetic using that operand shall both address elements of the same array.
Rule M5-0-17Subtraction between pointers shall only be applied to pointers that address elements of the same array.
Rule M5-0-18>,>=,<,<=shall NOt be applied to objects of pointer type, except where they point to the same array
Rule A5-2-1dynamic_cast should NOt be used.
Rule A5-2-2Traditional C-style casts shall NOt be used
Rule A5-2-3A cast shall NOt remove any const or volatile qualification from the type of a pointer or reference
Rule M5-2-6A cast shall NOt convert a pointer to a function to any other pointer type, including a pointer to function type.
Rule M5-2-8An object with integer type or pointer to void type shall NOt be converted to an object with pointer type
Rule M5-2-9A cast shall NOt convert a pointer type to an integral type
Rule A5-2-5An array shall NOt be accessed beyond its range
Rule M5-3-4Evaluation of the operand to the sizeof operator shall NOt contain side effects.
Rule A5-5-1The right hand operand of the integer division or remainder operators shall NOt be equal to zero.
Rule M5-8-1The right hand operand of a shift operator shall lie between zero and oneless than the width in bits of the underlying type of the left hand operand
Rule M5-18-1The comma operator shall NOt be used.
Rule M6-3-1The statement forming the body of a switch, while, do ... while or for statement shall be a compound statement.
Rule M6-4-1An if ( condition ) construct shall be followed by a compound statement. These keyword shall be followed by either a compound statement, or
aNOtherif statement.
Rule M6-4-2All if ... else if constructs shall be terminated with an else clause.
Rule M6-4-3A switch statement shall be a well-formed switch statement
Rule M6-4-5An unconditional throw or break statement shall terminate every NOnemptyswitch-clause
Rule M6-4-6The final clause of a switch statement shall be the default-clause
Rule M6-4-7The condition of a switch statement shall NOt have bool type
Rule A6-4-1A switch statement shall have at least two case-clauses, distinct from the default label.
Rule A6-5-2A for loop shall contain a single loop-counter which shall NOt have floatingpoint type
Rule M6-5-3The loop-counter shall NOt be modified within condition or statement.
Rule M6-5-5A loop-control-variable other than the loop-counter shall NOt be modified within condition or expression
Rule M6-5-6A loop-control-variable other than the loop-counter which is modified instatement shall have type bool
Rule A6-6-1The goto statement shall NOt be used.
Rule A7-5-1A function shall NOt return a reference or a pointer to a parameter that is passed by reference to const.
Rule A7-5-2Functions shall NOt call themselves, either directly or indirectly.
Rule A8-4-1Functions shall NOt be defined using the ellipsis NOtation.
Rule M8-4-2The identifiers used for the parameters in a re-declaration of a function shall be identical to those in the declaration.
Rule A8-4-2All exit paths from a function with NOn-void return type shall have an explicitreturn statement with an expression.
Rule M8-5-1All variables shall have a defined value before they are used
Rule M9-5-1Unions shall NOt be used
Rule A12-8-1Move and copy constructors shall only move and respectively copy base classes and data members of a class, without any side effects
Rule A15-2-1Constructors that are NOt NOexcept shall NOt be invoked before program startup.
Rule A15-3-5A class type exception shall be caught by reference or const reference.
Rule A15-5-1A class destructor, “delete” operators, move constructor, move assignment operator and “swap” function shall NOt exit with an exception.
They shall be all specified as “NOexcept”
Rule A15-5-3The std::terminate() function shall NOt be called implicitly
Rule M16-1-2All #else, #elif and #endif pre-processor directives shall reside in the same file as the #if or #ifdef directive to which they are related
Rule A16-2-1The’, ", /*, //, \characters shall NOt occur in a header file name or in#include directive
Rule M16-3-1There shall be at most one occurrence of the # or ## operators in a single macro definition
Rule M16-3-2The # and ## operators should NOt be used.
Rule A17-0-1Reserved identifiers, macros and functions in the C++ standard library shall NOt be defined, redefined or undefined.
Rule M17-0-5The setjmp macro and the longjmp function shall NOt be used
Rule A18-0-2The library functions atof, atoi and atol from library shall NOt be used.
Rule M18-0-3The library functions abort, exit, getenv and system from library shall NOt be used
Rule M18-0-4The time handling functions of library shall NOt be used.
Rule M18-0-5The unbounded functions of library shall NOt be used
Rule A18-1-1C-style arrays should NOt be used
Rule M18-2-1The macro off set of shall NOt be used.
Rule A18-5-1Functions malloc, calloc, realloc and free shall NOt be used.
Rule A18-5-3The form of delete operator shall match the form of new operator used to allocate the memory.
Rule A18-5-4If a project has sized or unsized version of operator “delete” globally defined, then both sized and unsized versions shall be defined
Rule M18-7-1The signal handling facilities of shall NOt be used.
Rule M19-3-1The error indicator errNO shall NOt be used
Rule M27-0-1The stream input/output library shall NOt be used