The arguments to a macro should not include preprocessor directives, such as #define
, #ifdef
, and #include
. Doing so is undefined behavior, according to Section 6.10.3, para. 11, of the C Standard [ISO/IEC 9899:2011].
The sequence of preprocessing tokens bounded by the outside-most matching parentheses forms the list of arguments for the function-like macro. The individual arguments within the list are separated by comma preprocessing tokens, but comma preprocessing tokens between matching inner parentheses do not separate arguments. If there are sequences of preprocessing tokens within the list of arguments that would otherwise act as preprocessing directives, the behavior is undefined.
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
PRE32-C | low | unlikely | medium | P2 | L3 |
Related Guidelines
ISO/IEC 9899:2011 Section Section 6.10.3.1, "Argument substitution"
...