aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2010-03-08 17:02:45 -0700
committerJim Meyering <meyering@redhat.com>2010-03-09 17:07:15 +0100
commit095375925eced79b694e53a2e5fe13151e5e1378 (patch)
tree8da93e7cee99a0e95076a1e4da958ff60a94ff1e /HACKING
parenthacking: fix typos (diff)
downloadlibvirt-095375925eced79b694e53a2e5fe13151e5e1378.tar.gz
libvirt-095375925eced79b694e53a2e5fe13151e5e1378.tar.bz2
libvirt-095375925eced79b694e53a2e5fe13151e5e1378.zip
hacking: add a section on preprocessor conventions
* doc/hacking.html.in (preprocessor): New section to document recently-discussed style issues. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING14
1 files changed, 14 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index b6f63ddac..9ee87c106 100644
--- a/HACKING
+++ b/HACKING
@@ -102,6 +102,20 @@ Usually they're in macro definitions or strings, and should be converted
anyhow.
+Preprocessor
+============
+For variadic macros, stick with C99 syntax:
+
+#define vshPrint(_ctl, ...) fprintf(stdout, __VA_ARGS__)
+
+Use parenthesis when checking if a macro is defined, and use
+indentation to track nesting:
+
+#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
+# define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
+#endif
+
+
C types
=======
Use the right type.