[previous] MISRA C:2012  Rule-20.6:  (Required) [next] Tokens that look like a preprocessing directive shall not occur within a macro argument

Example Code:


#include "misra.h"
#include "m3cmex.h"

#define SUM(A,B,C,D) ((A) + (B) + (C) + (D))                   /* 3453 */

extern int16_t rule_2006( void )
{
#if 0

   /* QAC will not parse the following code.
      A syntax error will be generated if the
      code is not in an excluded block */

   s16a =  SUM(    5,
#ifdef SW                                               /* Non-compliant * 0853 */
                   s16b,
#else                                                   /* Non-compliant * 0853 */
                   s16c,
#endif                                                  /* Non-compliant * 0853 */
                   0   );

#endif
    return 1;
}


QAC messages that encompass this guideline:

0853 [U] Macro arguments contain a sequence of tokens that has the form of a preprocessing directive.


Related rules:

Rule-1.3 There shall be no occurrence of undefined or critical unspecified behaviour



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents