style: put some notes on inclusion order

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
Frediano Ziglio 2016-05-12 15:27:46 +01:00
parent 4585fa9cbd
commit 7673b388f5

View File

@ -307,3 +307,36 @@ char *array[] = {
"item_2",
"item_3",
};
Header inclusion
----------------
Headers should be included in this order
[source,c]
----
#include <system_headers.h>
#include <no_spice_no_system_libraries.h>
#include <spice_protocol.h>
#include <spice_common.h>
#include "spice_server.h"
----
(note the empty line between no spice-server and spice-server headers)
Also in source (no header) files you must include `config.h` at the beginning so should start (beside comments and copyright) with
[source,c]
----
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <system_headers.h>
#include <no_spice_no_system_libraries.h>
#include <spice_protocol.h>
#include <spice_common.h>
#include "spice_server.h"
----