Qt-Autosar

Selection of AutosarC++ rules for Qt

Nested Rules

Qt-Autosar-A0.1.4

There shall be no unused named parameters in non-virtual functions

Qt-Autosar-A0.1.5

There shall be no unused named parameters in the set of parameters for a virtual function and all the functions that override it

Qt-Autosar-A0.1.6

There should be no unused type declarations

Qt-Autosar-A1.4.3

All code should compile free of compiler warnings

Qt-Autosar-A2.3.1

Only those characters specified in the C++ Language Standard basic source character set shall be used in the source code

Qt-Autosar-A2.5.1

Trigraphs shall not be used

Qt-Autosar-A2.5.2

Digraphs shall not be used

Qt-Autosar-A2.7.1

The character \ shall not occur as a last character of a C++ comment

Qt-Autosar-A2.10.1

An identifier declared in an inner scope shall not hide an identifier declared in an outer scope

Qt-Autosar-A2.10.4

The identifier name of a non-member object with static storage duration or static function shall not be reused within a namespace

Qt-Autosar-A2.10.5

An identifier name of a function with static storage duration or a non-member object with external or internal linkage should not be reused

Qt-Autosar-A2.10.6

A class or enumeration name shall not be hidden by a variable, function or enumerator declaration in the same scope

Qt-Autosar-A2.13.1

Only those escape sequences that are defined in ISO/IEC 14882:2014 shall be used

Qt-Autosar-A2.13.2

String literals with different encoding prefixes shall not be concatenated

Qt-Autosar-A2.13.3

Type wchar_t shall not be used

Qt-Autosar-A2.13.4

String literals shall not be assigned to non-constant pointers

Qt-Autosar-A2.13.6

Universal character names shall be used only inside character or string literals

Qt-Autosar-A3.1.1

It shall be possible to include any header file in multiple translation units without violating the One Definition Rule

Qt-Autosar-A3.3.1

Objects or functions with external linkage (including members of named namespaces) shall be declared in a header file

Qt-Autosar-A4.10.1

Only nullptr literal shall be used as the null-pointer-constant

Qt-Autosar-A5.0.1

The value of an expression shall be the same under any order of evaluation that the standard permits

Qt-Autosar-A5.1.4

A lambda expression object shall not outlive any of its reference-captured objects

Qt-Autosar-A5.1.9

Identical unnamed lambda expressions shall be replaced with a named function or a named lambda expression

Qt-Autosar-A5.2.3

A cast shall not remove any const or volatile qualification from the type of a pointer or reference

Qt-Autosar-A5.3.1

Evaluation of the operand to the typeid operator shall not contain side effects

Qt-Autosar-A5.3.3

Pointers to incomplete class types shall not be deleted

Qt-Autosar-A5.5.1

A pointer to member shall not access non-existent class members

Qt-Autosar-A5.10.1

A pointer to member virtual function shall only be tested for equality with null-pointer-constant

Qt-Autosar-A6.5.1

A for-loop that loops through all elements of the container and does not use its loop-counter shall not be used

Qt-Autosar-A6.5.2

A for loop shall contain a single loop-counter which shall not have floating-point type

Qt-Autosar-A7.1.4

The register keyword shall not be used

Qt-Autosar-A7.3.1

All overloads of a function shall be visible from where it is called

Qt-Autosar-A7.5.1

A function shall not return a reference or a pointer to a parameter that is passed by reference to const

Qt-Autosar-A7.6.1

Functions declared with the [[noreturn]] attribute shall not return

Qt-Autosar-A8.4.2

All exit paths from a function with non-void return type shall have an explicit return statement with an expression

Qt-Autosar-A10.2.1

Non-virtual public or protected member functions shall not be redefined in derived classes

Qt-Autosar-A10.3.2

Each overriding virtual function shall be declared with the override or final specifier

Qt-Autosar-A10.3.3

Virtual functions shall not be introduced in a final class

Qt-Autosar-A10.3.5

A user-defined assignment operator shall not be virtual

Qt-Autosar-A12.4.1

Destructor of a base class shall be public virtual, public override or protected non-virtual

Qt-Autosar-A12.8.1

Move and copy constructors shall only move and respectively copy base classes and data members of a class, without any side effects

Qt-Autosar-A12.8.3

Moved-from object shall not be read-accessed

Qt-Autosar-A12.8.4

Move constructor shall not initialize its class members and base classes using copy semantics

Qt-Autosar-A13.1.2

User defined suffixes of the user defined literal operators shall start with underscore followed by one or more letters

Qt-Autosar-A13.1.3

User defined literals operators shall only perform conversion of passed parameters

Qt-Autosar-A13.2.1

An assignment operator shall return a reference to “this”

Qt-Autosar-A13.2.2

A binary arithmetic operator and a bitwise operator shall return a “prvalue”

Qt-Autosar-A13.2.3

A relational operator shall return a boolean value

Qt-Autosar-A13.5.1

If “operator[]” is to be overloaded with a non-const version, const version shall also be implemented

Qt-Autosar-A13.5.5

Comparison operators shall be non-member functions with identical parameter types and noexcept

Qt-Autosar-A14.5.3

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

Qt-Autosar-A14.7.1

A type used as a template argument shall provide all members that are used by the template

Qt-Autosar-A14.7.2

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

Qt-Autosar-A14.8.2

Explicit specializations of function templates shall not be used

Qt-Autosar-A15.1.2

An exception object shall not be a pointer

Qt-Autosar-A15.3.4

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

Qt-Autosar-A15.3.5

A class type exception shall be caught by reference or const reference

Qt-Autosar-A15.4.1

Dynamic exception-specification shall not be used

Qt-Autosar-A15.4.2

If a function is declared to be noexcept, noexcept(true) or noexcept(<true condition>), then it shall not exit with an exception

Qt-Autosar-A15.4.3

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

Qt-Autosar-A15.4.5

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

Qt-Autosar-A16.2.1

The ‘, “, /*, //, \ characters shall not occur in a header file name or in #include directive

Qt-Autosar-A17.0.1

Reserved identifiers, macros and functions in the C++ standard library shall not be defined, redefined or undefined

Qt-Autosar-A17.6.1

Non-standard entities shall not be added to standard namespaces

Qt-Autosar-A18.0.2

The error state of a conversion from string to a numeric value shall be checked

Qt-Autosar-A18.1.3

The std::auto_ptr type shall not be used

Qt-Autosar-A18.1.4

A pointer pointing to an element of an array of objects shall not be passed to a smart pointer of single object type

Qt-Autosar-A18.1.6

All std::hash specializations for user-defined types shall have a noexcept function call operator

Qt-Autosar-A18.5.3

The form of the delete expression shall match the form of the new expression used to allocate the memory

Qt-Autosar-A18.5.4

If a project has sized or unsized version of operator “delete” globally defined, then both sized and unsized versions shall be defined

Qt-Autosar-A18.5.8

Objects that do not outlive a function shall have automatic storage duration

Qt-Autosar-A18.5.11

“operator new” and “operator delete” shall be defined together

Qt-Autosar-A18.9.2

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

Qt-Autosar-A18.9.3

The std::move shall not be used on objects declared const or const&

Qt-Autosar-A20.8.1

An already-owned pointer value shall not be stored in an unrelated smart pointer

Qt-Autosar-A20.8.5

std::make_unique shall be used to construct objects owned by std::unique_ptr

Qt-Autosar-A20.8.6

std::make_shared shall be used to construct objects owned by std::shared_ptr

Qt-Autosar-A21.8.1

Arguments to character-handling functions shall be representable as an unsigned char

Qt-Autosar-A25.1.1

Non-static data members or captured values of predicate function objects that are state related to this object’s identity shall not be copied

Qt-Autosar-A26.5.1

Pseudorandom numbers shall not be generated using std::rand()

Qt-Autosar-A26.5.2

Random number engines shall not be default-initialized

Qt-Autosar-A27.0.3

Alternate input and output operations on a file stream shall not be used without an intervening flush or positioning call

Qt-Autosar-M0.1.1

A project shall not contain unreachable code

Qt-Autosar-M0.1.3

A project shall not contain unused variables

Qt-Autosar-M0.2.1

An object shall not be assigned to an overlapping object

Qt-Autosar-M2.7.1

The character sequence /* shall not be used within a C-style comment

Qt-Autosar-M3.2.1

All declarations of an object or function shall have compatible types

Qt-Autosar-M3.2.2

The One Definition Rule shall not be violated

Qt-Autosar-M3.2.3

A type, object or function that is used in multiple translation units shall be declared in one and only one file

Qt-Autosar-M3.2.4

An identifier with external linkage shall have exactly one definition

Qt-Autosar-M4.10.1

NULL shall not be used as an integer value

Qt-Autosar-M5.2.2

A pointer to a virtual base class shall only be cast to a pointer to a derived class by means of dynamic_cast

Qt-Autosar-M5.3.4

Evaluation of the operand to the sizeof operator shall not contain side effects

Qt-Autosar-M5.19.1

Evaluation of constant unsigned integer expressions should not lead to wrap-around

Qt-Autosar-M6.6.1

Any label referenced by a goto statement shall be declared in the same block, or in a block enclosing the goto statement

Qt-Autosar-M8.3.1

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

Qt-Autosar-M9.3.1

const member functions shall not return non-const pointers or references to class-data

Qt-Autosar-M9.6.4

Named bit-fields with signed integer type shall have a length of more than one bit

Qt-Autosar-M10.1.2

A base class shall only be declared virtual if it is used in a diamond hierarchy

Qt-Autosar-M10.1.3

An accessible base class shall not be both virtual and non-virtual in the same hierarchy

Qt-Autosar-M12.1.1

An object’s dynamic type shall not be used from the body of its constructor or destructor

Qt-Autosar-M14.5.3

A copy assignment operator shall be declared when there is a template assignment operator with a parameter that is a generic parameter

Qt-Autosar-M15.0.3

Control shall not be transferred into a try or catch block using a goto or a switch statement

Qt-Autosar-M15.1.2

NULL shall not be thrown explicitly

Qt-Autosar-M15.3.3

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

Qt-Autosar-M15.3.6

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

Qt-Autosar-M15.3.7

Where multiple handlers are provided in a single try-catch statement or function-try-block, any ellipsis (catch-all) handler shall occur last

Qt-Autosar-M16.0.5

Arguments to a function-like macro shall not contain tokens that look like preprocessing directives

Qt-Autosar-M16.0.6

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 ##

Qt-Autosar-M16.0.7

Undefined macro identifiers shall not be used in #if or #elif preprocessor directives, except as operands to the defined operator

Qt-Autosar-M16.0.8

If the # token appears as the first token on a line, then it shall be immediately followed by a preprocessing token

Qt-Autosar-M16.1.1

The defined preprocessor operator shall only be used in one of the two standard forms

Qt-Autosar-M16.1.2

All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if or #ifdef directive to which they are related

Qt-Autosar-M16.2.3

Include guards shall be provided

Qt-Autosar-M17.0.2

The names of standard library macros and objects shall not be reused

Options