[previous] MISRA C:2012  Rule-20.14:  (Required) [next] All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are related

Example Code:


#pragma PRQA_MESSAGES_OFF 0883

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

#if 1
#include "rule-20.14.h"
#endif


extern int16_t rule_2014( void )
{
    return 1;
}

Example Code:


/* Following #endif matches #if in parent file */

#endif                                                  /* 3318 */

/* Following #if is not matched in this file */

#if 1                                                   /* 3317 */


QAC messages that encompass this guideline:

3317 '#if...' not matched by '#endif' in included file. This is probably an error.
3318 '#else'/'#elif'/'#endif' in included file matched '#if...' in parent file. This is probably an error.



(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