qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] HACKING: document #include order


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] HACKING: document #include order
Date: Wed, 16 Nov 2016 12:38:33 +0000

On Wed, Nov 16, 2016 at 9:39 AM, Markus Armbruster <address@hidden> wrote:
> 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".

Will send v2.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]