[previous] 0853 [next] [U] Macro arguments contain a sequence of tokens that has the form of a preprocessing directive.
Explicitly undefined REFERENCE - ISO:C90-6.8.3 Macro Replacement - Semantics

A function-like macro is being expanded and preprocessing directives have been encountered within the list of arguments. This is not permitted.

For example:


/*PRQA S 850,911,2017,2214,3110,3206,3227,3408,3417,3429,3453 ++*/

#define ADD(X, Y) ((X) + (Y))
#define SW

extern int foo ( int a, int b, int c )
{
    int r;

    r = ADD( a,                 /* Message 0907 - syntax error - and others XXXX */
#ifdef SW                       /* Message 0853 */
             b
#else                           /* Message 0853 */
             c
#endif                          /* Message 0853 */
             );

    return r;
}


MISRA-C:2004 Rules applicable to message 0853:

Rule  1.2  (Required) No reliance shall be placed on undefined or unspecified behaviour.
Rule  19.9  (Required) Arguments to a function-like macro shall not contain tokens that look like preprocessing directives.


See also:

QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents