mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 12/12] checkpatch: Move test for space before semicolon after operator spacing
Date: Mon, 10 Jun 2013 15:20:50 -0700	[thread overview]
Message-ID: <fa92d99b165b46fc2a7283b1e80f4da9ee1f4dc0.1370902448.git.joe@perches.com> (raw)
In-Reply-To: <cover.1370902448.git.joe@perches.com>

Moving this test allows the --fix option to work better.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9696be5..5989415 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2646,16 +2646,6 @@ sub process {
 			}
 		}
 
-# check for whitespace before a non-naked semicolon
-		if ($line =~ /^\+.*\S\s+;/) {
-			if (WARN("SPACING",
-				 "space prohibited before semicolon\n" . $herecurr) &&
-			    $fix) {
-				$fixed[$linenr - 1] =~
-				    s/^(\+.*\S)\s+;/$1;/;
-			}
-		}
-
 # Check operator spacing.
 		if (!($line=~/\#\s*include/)) {
 			my $fixed_line = "";
@@ -2920,6 +2910,16 @@ sub process {
 
 		}
 
+# check for whitespace before a non-naked semicolon
+		if ($line =~ /^\+.*\S\s+;/) {
+			if (WARN("SPACING",
+				 "space prohibited before semicolon\n" . $herecurr) &&
+			    $fix) {
+				1 while $fixed[$linenr - 1] =~
+				    s/^(\+.*\S)\s+;/$1;/;
+			}
+		}
+
 # check for multiple assignments
 		if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
 			CHK("MULTIPLE_ASSIGNMENTS",
-- 
1.8.1.2.459.gbcd45b4.dirty


      parent reply	other threads:[~2013-06-10 22:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 22:20 [PATCH 00/12] checkpatch: collection of neatenings and new "--fix" Joe Perches
2013-06-10 22:20 ` [PATCH 01/12] checkpatch: Remove quote from CamelCase test Joe Perches
2013-06-10 22:20 ` [PATCH 02/12] checkpatch: Improve network block comment test and message Joe Perches
2013-06-10 22:20 ` [PATCH 03/12] checkpatch: Warn when networking block comment lines don't start with * Joe Perches
2013-06-10 22:20 ` [PATCH 04/12] checkpatch: Warn on comparisons to jiffies Joe Perches
2013-06-10 22:20 ` [PATCH 05/12] checkpatch: Warn on comparisons to get_jiffies_64() Joe Perches
2013-06-10 22:20 ` [PATCH 06/12] checkpatch: Reduce false positive rate of "complex macros" Joe Perches
2013-06-10 22:20 ` [PATCH 07/12] checkpatch: Add a placeholder to check blank lines before declarations Joe Perches
2013-06-10 22:20 ` [PATCH 08/12] checkpatch: Don't warn on blank lines before/after braces as often Joe Perches
2013-06-10 22:20 ` [PATCH 09/12] checkpatch: Add a --strict test for comparison to true/false Joe Perches
2013-06-10 22:20 ` [PATCH 10/12] checkpatch: Improve "no space after cast" test Joe Perches
2013-06-10 22:20 ` [PATCH 11/12] checkpatch: Create an EXPERIMENTAL --fix option to correct patches Joe Perches
2013-06-10 22:20 ` Joe Perches [this message]

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=fa92d99b165b46fc2a7283b1e80f4da9ee1f4dc0.1370902448.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®