From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5r7q-0004DM-Iy for qemu-devel@nongnu.org; Fri, 19 Jun 2015 03:54:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5r7m-0007Z6-DK for qemu-devel@nongnu.org; Fri, 19 Jun 2015 03:54:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33515) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5r7m-0007Yy-70 for qemu-devel@nongnu.org; Fri, 19 Jun 2015 03:54:06 -0400 Date: Fri, 19 Jun 2015 09:53:59 +0200 From: Thomas Huth Message-ID: <20150619095359.1bda48e4@thh440s> In-Reply-To: <1434698944-3331-1-git-send-email-pbonzini@redhat.com> References: <1434698944-3331-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] CODING_STYLE: update line length and mixed declaration rules List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Markus Armbruster , qemu-devel@nongnu.org, Eduardo Habkost , Andreas Faerber On Fri, 19 Jun 2015 09:29:04 +0200 Paolo Bonzini wrote: > 1) Line lengths above 80 characters do exist. They are rare, but > they happen from time to time. An ignored rule is worse than an > exception to the rule, so do the latter. > > 2) Mixed declarations also do exist at the top of #ifdef blocks. > Remark on this particular usage and suggest an alternative. > > Cc: Andreas Faerber > Cc: Markus Armbruster > Cc: Eduardo Habkost > Signed-off-by: Paolo Bonzini > --- > CODING_STYLE | 21 ++++++++++++++++----- > scripts/checkpatch.pl | 9 ++++++--- > 2 files changed, 22 insertions(+), 8 deletions(-) > > diff --git a/CODING_STYLE b/CODING_STYLE > index d46cfa5..d013cb8 100644 > --- a/CODING_STYLE > +++ b/CODING_STYLE > @@ -31,7 +31,11 @@ Do not leave whitespace dangling off the ends of lines. > > 2. Line width > > -Lines are 80 characters; not longer. > +Lines should be 80 characters; try not to make them longer. > + > +Sometimes it is hard to do, especially when dealing with QEMU subsystems > +that use long function or symbol names. Even in that case, do not make > +lines _much_ longer than 80 characters. Good idea ... this very, very strict 80 characters limit often drove me crazy already. If the code is more readable with a 81 or 82 characters line, that's IMHO a much better way to write code than to break it artificially just to satisfy that rule. ... > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 7f0aae9..f4e7050 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -1470,10 +1470,13 @@ sub process { > if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && > $rawline !~ /^.\s*\*\s*\@$Ident\s/ && > !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ || > - $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) && > - $length > 80) > + $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/)) > { > - WARN("line over 80 characters\n" . $herecurr); > + if ($length > 90) { > + ERROR("line over 90 characters\n" . $herecurr); > + } if ($length > 80) { Did you mean to use "elsif" here instead (because you've put the if on the same line as the "}")? > + WARN("line over 80 characters\n" . $herecurr); > + } > } > Thomas