[previous] MISRA-C:2004  Rule  19.1:  (Advisory) [next] #include statements in a file should only be preceded by other preprocessor directives or comments.
All the #include statements in a particular code file should be grouped together near the head of the file. The rule states that the only items which may precede a #include in a file are other preprocessor directives or comments.

Example Code:


/*PRQA S 862 ++ */
#include "misra.h"
#include "m2cmex.h"

extern S16 test_1901( void )
{
   return 1;
}

#include "rule_19.1.h"

extern S16 test_1901x( void )
{
   return 1;
}



QAC messages that encompass this guideline:

5087 #include statements in a file should only be preceded by other preprocessor directives or comments.



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