[libvirt] [PATCH] HACKING: add a section on preprocessor conventions

* HACKING: Document recently-discussed style issues. Signed-off-by: Eric Blake <eblake@redhat.com> --- Turn recent discussions: https://www.redhat.com/archives/libvir-list/2010-March/msg00058.html https://www.redhat.com/archives/libvir-list/2010-March/msg00120.html into policy, so I don't keep debating style points ;) Can wait till after 0.7.7 (particularly since the vararg macro series is also waiting). HACKING | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/HACKING b/HACKING index be8725d..50b24ee 100644 --- a/HACKING +++ b/HACKING @@ -102,6 +102,17 @@ 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: + +#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE) + + C types ======= Use the right type. -- 1.6.6.1

On Tue, Mar 02, 2010 at 04:23:29PM -0700, Eric Blake wrote:
* HACKING: Document recently-discussed style issues.
Signed-off-by: Eric Blake <eblake@redhat.com> ---
Turn recent discussions: https://www.redhat.com/archives/libvir-list/2010-March/msg00058.html https://www.redhat.com/archives/libvir-list/2010-March/msg00120.html
into policy, so I don't keep debating style points ;)
Can wait till after 0.7.7 (particularly since the vararg macro series is also waiting).
HACKING | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/HACKING b/HACKING index be8725d..50b24ee 100644 --- a/HACKING +++ b/HACKING @@ -102,6 +102,17 @@ 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: + +#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE) + + C types ======= Use the right type.
ACK, to be pushed along the other ones after 0.7.7 is out, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Eric Blake