Received: from eggs.gnu.org ([2001:4830:134:3::10]:55307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCm2a-0002cz-VO for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:16:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCm2V-0002jv-0L for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:16:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCm2U-0002ji-Or for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:16:26 -0500 Date: Mon, 10 Feb 2014 06:16:22 -0200 From: Eduardo Habkost Message-ID: <20140210081622.GO28427@otherpad.lan.raisama.net> References: <1391936581-8382-1-git-send-email-ehabkost@redhat.com> <20140210013306.GB16594@T430.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140210013306.GB16594@T430.nay.redhat.com> Subject: Re: [Qemu-devel] [PATCH] CODING_STYLE: Section about mixed declarations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org, Andreas =?iso-8859-1?Q?F=E4rber?= On Mon, Feb 10, 2014 at 09:33:06AM +0800, Fam Zheng wrote: > On Sun, 02/09 07:03, Eduardo Habkost wrote: > > We had an unwritten rule about declarations having to be at beginning of > > blocks. Make it a written rule. > > > > Signed-off-by: Eduardo Habkost > > --- > > CODING_STYLE | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/CODING_STYLE b/CODING_STYLE > > index dcbce28..f6eb319 100644 > > --- a/CODING_STYLE > > +++ b/CODING_STYLE > > @@ -84,3 +84,10 @@ 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. Declarations > > + > > +Mixed declarations (interleaving statements and declarations within blocks) are > > +not allowed; declarations should be at beginning of blocks. In other words, > > +the code should not generate warnings if using GCC's > > +-Wdeclaration-after-statement option. > > What is the reason that we don't use -Wdeclaration-after-statement in Makefile? > Thanks. We have around 39 files today that don't follow the rule, today, and would generate warnings if we used -Wdeclaration-after-statement. -- Eduardo