AutosarC++17_03-A16.0.1

The pre-processor shall only be used for unconditional and conditional file inclusion and include guards, and using the following directives: (1) #ifndef, (2) #ifdef, (3) #if, (4) #if defined, (5) #elif, (6) #else, (7) #define, (8) #endif, (9) #include

Required inputs: IR

Possible Messages

Key

Text

Severity

Disabled

function_macro_definition

Macros are only allowed for include guards

None

False

line_directive

The pre-processor shall only be used for file inclusion and include guards.

None

False

object_macro_definition

Macros are only allowed for include guards

None

False

pp_if

Conditional compilation is only allowed for include guards

None

False

pragma

The pre-processor shall only be used for file inclusion and include guards.

None

False

undef

The pre-processor shall only be used for file inclusion and include guards.

None

False

Options

accept_conditional_includes

accept_conditional_includes : bool = True

Whether to accept #ifs for conditional includes.
 

allowed_pragmas

allowed_pragmas : set[str] = set()

Pragmas to be allowed by default, i.e., no message is produced for these.
 

exception_strings

exception_strings : list[str] = []

List of substrings in macro expansion that mark an exception of this rule.
 

report_elif

report_elif : bool = True

Whether to report every #elif in addition to the initial #if/#ifdef.