Eric Blake <ebl...@redhat.com> writes: > On 11/15/2016 02:29 PM, Stefan Hajnoczi wrote: >> It was not obvious to me why "qemu/osdep.h" must be the first #include. >> This documents the rationale and the overall #include order. >> >> Cc: Fam Zheng <f...@redhat.com> >> Cc: Markus Armbruster <arm...@redhat.com> >> Cc: Eric Blake <ebl...@redhat.com> >> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> >> --- >> HACKING | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >> > >> +1.2. Include directives >> + >> +Order include directives as follows: >> + >> +#include "qemu/osdep.h" /* Always first... */ >> +#include <...> /* then system headers... */ >> +#include "..." /* and finally QEMU headers. */ >> + >> +The "qemu/osdep.h" header contains preprocessor macros that affect the >> behavior >> +of core system headers like <stdint.h>. It must be the first include so >> that >> +core system headers included by external libraries get the preprocessor >> macros >> +that QEMU depends on. > > Might be worth mentioning that only .c files include osdep.h (.h files > do not need to, because they can only be included by a .c file that has > already included osdep.h first).
Yes, please, but make it "headers should not include osdep.h".