AUTOSAR C++14 Rule M16-0-5
Arguments to a function-like macro shall not contain tokens that look like pre-processing directives
Description
Rule Definition
Arguments to a function-like macro shall not contain tokens that look like pre-processing directives.
Rationale
When a compiler encounters function-like macros, it replaces the argument of the macro into the replacement code. If the argument contains a token that looks like preprocessing directives, the replacement process during macro expansion is undefined. Depending on the environment, such a function-like macro might behave in unexpected ways, leading to errors and bugs.
Polyspace Implementation
Polyspace® flags calls to function-like macros if their argument starts with the
character #
.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Preprocessing Directives |
Category: Required, Automated |
Version History
Introduced in R2019a