Add 'Header guards' section in CONTRIBUTING.md
authorTim Rühsen <tim.ruehsen@gmx.de>
Wed, 24 Apr 2019 19:21:12 +0000 (21:21 +0200)
committerTim Rühsen <tim.ruehsen@gmx.de>
Tue, 7 May 2019 19:06:23 +0000 (21:06 +0200)
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
CONTRIBUTING.md

index e38bba321ebdc6fc71c4d9fe0c239cf77d059bd1..3a20170f6b46fcaf9e7c32ec3184093d5835270b 100644 (file)
@@ -115,6 +115,28 @@ They can however be used by unit tests in tests/ directory; in that
 case they should be part of the GNUTLS_PRIVATE_3_4 tag in libgnutls.map.
 
 
+# Header guards
+
+  Each private C header file SHOULD have a header guard consisting of the
+project name and the file path relative to the project directory, all uppercase.
+
+Example: `lib/srp.h` uses the header guard `GNUTLS_LIB_SRP_H`.
+
+The header guard is used as first and last effective code in a header file,
+like e.g. in lib/srp.h:
+
+```
+#ifndef GNUTLS_LIB_SRP_H
+#define GNUTLS_LIB_SRP_H
+
+...
+
+#endif /* GNUTLS_LIB_SRP_H */
+
+The public header files follow a similar convention but use the relative
+install directory as template, e.g. `GNUTLS_GNUTLS_H` for `gnutls/gnutls.h`.
+
+
 # Introducing new functions / API
 
   Prior to introducing any new API consider all options to offer the same