[Spice-devel] [PATCH v2 11/13] Add mention of header guards

Christophe de Dinechin christophe at dinechin.org
Wed Feb 7 11:07:23 UTC 2018


From: Christophe de Dinechin <dinechin at redhat.com>

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 docs/spice_style.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/docs/spice_style.txt b/docs/spice_style.txt
index 780f0615..e2465aa9 100644
--- a/docs/spice_style.txt
+++ b/docs/spice_style.txt
@@ -357,6 +357,21 @@ char *array[] = {
     "item_3",
 };
 
+Headers
+-------
+
+Headers should be protected against multiple inclusion using a macro that matches the header file name in uppercase, with all characters that are invalid in C replaced with an underscore '_':
+
+[source,h]
+---
+#ifndef MY_MODULE_H
+#define MY_MODULE_H
+
+...
+
+#endif /* MY_MODULE_H */
+---
+
 Header inclusion
 ----------------
 
-- 
2.13.5 (Apple Git-94)



More information about the Spice-devel mailing list