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: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] HACKING: document #include order
Date: Tue, 15 Nov 2016 14:34:08 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

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).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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