[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] HACKING: document #include order
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] HACKING: document #include order |
Date: |
Wed, 16 Nov 2016 10:39:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> 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 <address@hidden>
>> Cc: Markus Armbruster <address@hidden>
>> Cc: Eric Blake <address@hidden>
>> Signed-off-by: Stefan Hajnoczi <address@hidden>
>> ---
>> 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".