Qt-Autosar¶
Selection of AutosarC++ rules for Qt
Nested Rules
There shall be no unused named parameters in non-virtual functions |
|
There shall be no unused named parameters in the set of parameters for a virtual function and all the functions that override it |
|
There should be no unused type declarations |
|
All code should compile free of compiler warnings |
|
Only those characters specified in the C++ Language Standard basic source character set shall be used in the source code |
|
Trigraphs shall not be used |
|
Digraphs shall not be used |
|
The character \ shall not occur as a last character of a C++ comment |
|
An identifier declared in an inner scope shall not hide an identifier declared in an outer scope |
|
The identifier name of a non-member object with static storage duration or static function shall not be reused within a namespace |
|
An identifier name of a function with static storage duration or a non-member object with external or internal linkage should not be reused |
|
A class or enumeration name shall not be hidden by a variable, function or enumerator declaration in the same scope |
|
Only those escape sequences that are defined in ISO/IEC 14882:2014 shall be used |
|
String literals with different encoding prefixes shall not be concatenated |
|
Type wchar_t shall not be used |
|
String literals shall not be assigned to non-constant pointers |
|
Universal character names shall be used only inside character or string literals |
|
It shall be possible to include any header file in multiple translation units without violating the One Definition Rule |
|
Objects or functions with external linkage (including members of named namespaces) shall be declared in a header file |
|
Only nullptr literal shall be used as the null-pointer-constant |
|
The value of an expression shall be the same under any order of evaluation that the standard permits |
|
A lambda expression object shall not outlive any of its reference-captured objects |
|
Identical unnamed lambda expressions shall be replaced with a named function or a named lambda expression |
|
A cast shall not remove any const or volatile qualification from the type of a pointer or reference |
|
Evaluation of the operand to the typeid operator shall not contain side effects |
|
Pointers to incomplete class types shall not be deleted |
|
A pointer to member shall not access non-existent class members |
|
A pointer to member virtual function shall only be tested for equality with null-pointer-constant |
|
A for-loop that loops through all elements of the container and does not use its loop-counter shall not be used |
|
A for loop shall contain a single loop-counter which shall not have floating-point type |
|
The register keyword shall not be used |
|
All overloads of a function shall be visible from where it is called |
|
A function shall not return a reference or a pointer to a parameter that is passed by reference to const |
|
Functions declared with the [[noreturn]] attribute shall not return |
|
All exit paths from a function with non-void return type shall have an explicit return statement with an expression |
|
Non-virtual public or protected member functions shall not be redefined in derived classes |
|
Each overriding virtual function shall be declared with the override or final specifier |
|
Virtual functions shall not be introduced in a final class |
|
A user-defined assignment operator shall not be virtual |
|
Destructor of a base class shall be public virtual, public override or protected non-virtual |
|
Move and copy constructors shall only move and respectively copy base classes and data members of a class, without any side effects |
|
Moved-from object shall not be read-accessed |
|
Move constructor shall not initialize its class members and base classes using copy semantics |
|
User defined suffixes of the user defined literal operators shall start with underscore followed by one or more letters |
|
User defined literals operators shall only perform conversion of passed parameters |
|
An assignment operator shall return a reference to “this” |
|
A binary arithmetic operator and a bitwise operator shall return a “prvalue” |
|
A relational operator shall return a boolean value |
|
If “operator[]” is to be overloaded with a non-const version, const version shall also be implemented |
|
Comparison operators shall be non-member functions with identical parameter types and noexcept |
|
A non-member generic operator shall only be declared in a namespace that does not contain class (struct) type, enum type or union type declarations |
|
A type used as a template argument shall provide all members that are used by the template |
|
Template specialization shall be declared in the same file (1) as the primary template (2) as a user-defined type, for which the specialization is declared |
|
Explicit specializations of function templates shall not be used |
|
An exception object shall not be a pointer |
|
Catch-all (ellipsis and std::exception) handlers shall be used only in (a) main, (b) task main functions, (c) in functions that are supposed to isolate independent components and (d) when calling third-party code that uses exceptions not according to AUTOSAR C++14 guidelines |
|
A class type exception shall be caught by reference or const reference |
|
Dynamic exception-specification shall not be used |
|
If a function is declared to be noexcept, noexcept(true) or noexcept(<true condition>), then it shall not exit with an exception |
|
The noexcept specification of a function shall either be identical across all translation units, or identical or more restrictive between a virtual member function and an overrider |
|
Checked exceptions that could be thrown from a function shall be specified together with the function declaration and they shall be identical in all function declarations and for all its overriders |
|
The ‘, “, /*, //, \ characters shall not occur in a header file name or in #include directive |
|
Reserved identifiers, macros and functions in the C++ standard library shall not be defined, redefined or undefined |
|
Non-standard entities shall not be added to standard namespaces |
|
The error state of a conversion from string to a numeric value shall be checked |
|
The std::auto_ptr type shall not be used |
|
A pointer pointing to an element of an array of objects shall not be passed to a smart pointer of single object type |
|
All std::hash specializations for user-defined types shall have a noexcept function call operator |
|
The form of the delete expression shall match the form of the new expression used to allocate the memory |
|
If a project has sized or unsized version of operator “delete” globally defined, then both sized and unsized versions shall be defined |
|
Objects that do not outlive a function shall have automatic storage duration |
|
“operator new” and “operator delete” shall be defined together |
|
Forwarding values to other functions shall be done via: (1) std::move if the value is an rvalue reference, (2) std::forward if the value is forwarding reference |
|
The std::move shall not be used on objects declared const or const& |
|
An already-owned pointer value shall not be stored in an unrelated smart pointer |
|
std::make_unique shall be used to construct objects owned by std::unique_ptr |
|
std::make_shared shall be used to construct objects owned by std::shared_ptr |
|
Arguments to character-handling functions shall be representable as an unsigned char |
|
Non-static data members or captured values of predicate function objects that are state related to this object’s identity shall not be copied |
|
Pseudorandom numbers shall not be generated using std::rand() |
|
Random number engines shall not be default-initialized |
|
Alternate input and output operations on a file stream shall not be used without an intervening flush or positioning call |
|
A project shall not contain unreachable code |
|
A project shall not contain unused variables |
|
An object shall not be assigned to an overlapping object |
|
The character sequence /* shall not be used within a C-style comment |
|
All declarations of an object or function shall have compatible types |
|
The One Definition Rule shall not be violated |
|
A type, object or function that is used in multiple translation units shall be declared in one and only one file |
|
An identifier with external linkage shall have exactly one definition |
|
NULL shall not be used as an integer value |
|
A pointer to a virtual base class shall only be cast to a pointer to a derived class by means of dynamic_cast |
|
Evaluation of the operand to the sizeof operator shall not contain side effects |
|
Evaluation of constant unsigned integer expressions should not lead to wrap-around |
|
Any label referenced by a goto statement shall be declared in the same block, or in a block enclosing the goto statement |
|
Parameters in an overriding virtual function shall either use the same default arguments as the function they override, or else shall not specify any default arguments |
|
const member functions shall not return non-const pointers or references to class-data |
|
Named bit-fields with signed integer type shall have a length of more than one bit |
|
A base class shall only be declared virtual if it is used in a diamond hierarchy |
|
An accessible base class shall not be both virtual and non-virtual in the same hierarchy |
|
An object’s dynamic type shall not be used from the body of its constructor or destructor |
|
A copy assignment operator shall be declared when there is a template assignment operator with a parameter that is a generic parameter |
|
Control shall not be transferred into a try or catch block using a goto or a switch statement |
|
NULL shall not be thrown explicitly |
|
Handlers of a function-try-block implementation of a class constructor or destructor shall not reference non-static members from this class or its bases |
|
Where multiple handlers are provided in a single try-catch statement or function-try-block for a derived class and some or all of its bases, the handlers shall be ordered most-derived to base class |
|
Where multiple handlers are provided in a single try-catch statement or function-try-block, any ellipsis (catch-all) handler shall occur last |
|
Arguments to a function-like macro shall not contain tokens that look like preprocessing directives |
|
In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ## |
|
Undefined macro identifiers shall not be used in #if or #elif preprocessor directives, except as operands to the defined operator |
|
If the # token appears as the first token on a line, then it shall be immediately followed by a preprocessing token |
|
The defined preprocessor operator shall only be used in one of the two standard forms |
|
All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if or #ifdef directive to which they are related |
|
Include guards shall be provided |
|
The names of standard library macros and objects shall not be reused |
Options
Setting an option for this rule means setting the default for all nested rules.
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.