The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Peter Hurley <peter@hurleysoftware.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Whitcroft <apw@canonical.com>
Cc: David Howells <dhowells@redhat.com>,
	"Ken O'Brien" <kernel@kenobrien.org>,
	gregkh@linuxfoundation.org, swetland@google.com,
	arve@android.com, viro@zeniv.linux.org.uk,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] checkpatch: Warn on unnecessary line continuations
Date: Mon, 22 Oct 2012 06:16:43 -0700	[thread overview]
Message-ID: <1350911803.7502.4.camel@joe-AO722> (raw)
In-Reply-To: <1350910971.28457.3.camel@thor>

Line continuations are not normal kernel style.
Bleat a warning when used outside of a macro definition.

Signed-off-by: Joe Perches <joe@perches.com>
---

On Mon, 2012-10-22 at 09:02 -0400, Peter Hurley wrote:
> On Mon, 2012-10-22 at 05:15 -0700, Joe Perches wrote:
> > waOn Mon, 2012-10-22 at 10:37 +0100, David Howells wrote:
> > > Joe Perches <joe@perches.com> wrote:
> > > 
> > > > On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> > > > ...
> > > > > -		pr_err("binder: %d: binder_alloc_buf failed to "
> > > > > +		pr_err("binder: %d: binder_alloc_buf failed to " \
> > > > >  		       "map pages in userspace, no vma\n", proc->pid);
> > > > ...
> > > > Nice try, but the "right" way to do this is to coalesce formats like:
> > > > 
> > > > 		pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> > > > 		       proc->pid);
> > > 
> > > Surely the right way is to fix _checkpatch_ to see ["]\n\s*["] and merge the
> > > lines before checking them?  We shouldn't have to fix up the source in either
> > > of these fashions just because checkpatch is broken.
> > 
> > checkpatch is stupid, but it's not broken here.
> > 
> > Formats should be coalesced into a single line to make
> > grepping the source for dmesg output easier.
> 
> But MODULE_PARM_DESC() multi-line strings are ok, right?
> 

I don't think so.
Maybe this patch:

 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 21a9f5d..d4ea29a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3011,6 +3011,14 @@ sub process {
 					      "Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
 				}
 			}
+
+# check for line continuations outside of #defines
+
+		} else {
+			if ($line =~ /^\+.*\\$/) {
+				WARN("LINE_CONTINUATIONS",
+				     "Avoid unnecessary line continuations\n" . $herecurr);
+			}
 		}
 
 # do {} while (0) macro tests:



  reply	other threads:[~2012-10-22 13:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20 22:33 [PATCH 1/2] staging: android: checkpatch.pl fixes Ken O'Brien
2012-10-20 22:33 ` [PATCH 2/2] staging: android: binder.c: checkpatch.pl Ken O'Brien
2012-10-21  1:05 ` [PATCH 1/2] staging: android: checkpatch.pl fixes Joe Perches
2012-10-21  2:05   ` Cruz Julian Bishop
2012-10-21  2:09     ` Joe Perches
2012-10-22  9:37   ` David Howells
2012-10-22 12:15     ` Joe Perches
2012-10-22 13:02       ` Peter Hurley
2012-10-22 13:16         ` Joe Perches [this message]
2012-10-22 16:45           ` [PATCH] checkpatch: Warn on unnecessary line continuations Joe Perches
2012-10-28  4:46             ` [PATCH v2] " Joe Perches
2012-10-22 20:03 ` [PATCH 1/2] staging: android: checkpatch.pl fixes Greg KH
2012-10-24 14:48   ` kernel kernel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350911803.7502.4.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@kenobrien.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=swetland@google.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox