From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50580 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ojcoy-0003gQ-KJ for qemu-devel@nongnu.org; Thu, 12 Aug 2010 14:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ojcoa-0002is-VA for qemu-devel@nongnu.org; Thu, 12 Aug 2010 14:47:46 -0400 Received: from fe02x03-cgp.akado.ru ([77.232.31.165]:55602 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ojcoa-0002ib-N1 for qemu-devel@nongnu.org; Thu, 12 Aug 2010 14:47:44 -0400 Date: Thu, 12 Aug 2010 22:47:14 +0400 (MSD) From: malc Subject: Re: [Qemu-devel] [PATCH 1/5] CODING_STYLE: add preprocessor rules In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel On Thu, 12 Aug 2010, Blue Swirl wrote: > Add preprocessor rules from libvirt HACKING. > > Signed-off-by: Blue Swirl > --- > CODING_STYLE | 13 +++++++++++++ > 1 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/CODING_STYLE b/CODING_STYLE > index 92036f3..c4c09ab 100644 > --- a/CODING_STYLE > +++ b/CODING_STYLE > @@ -79,3 +79,16 @@ and clarity it comes on a line by itself: > Rationale: a consistent (except for functions...) bracing style reduces > ambiguity and avoids needless churn when lines are added or removed. > Furthermore, it is the QEMU coding style. > + > +5. Preprocessor > + > +For variadic macros, stick with C99 syntax: > + > +#define vshPrint(_ctl, ...) fprintf(stdout, __VA_ARGS__) _ctl is not used inside the macro expansion, furthermore i'd avoid using leading underscore even for macro arguments. > + > +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 > -- mailto:av1474@comtv.ru