mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Sowden <jeremy@azazel.net>
To: linux-kernel@vger.kernel.org, joe@perches.com, apw@canonical.com
Cc: Jeremy Sowden <jeremy@azazel.net>
Subject: [PATCH] checkpatch: fix for stripping brackets from macros.
Date: Mon, 18 Dec 2017 14:17:16 +0000	[thread overview]
Message-ID: <20171218141716.26227-1-jeremy@azazel.net> (raw)

When checking macros, checkpatch.pl strips parentheses, square brackets
and braces.  However, the search-and-replace expression was not correct,
and instead of replacing the brackets and their contents with just the
contents, it was replacing them with literal 1's.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 168687ae24fa..3b67646df845 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4874,9 +4874,9 @@ sub process {
 			$dstat =~ s/\s*$//s;
 
 			# Flatten any parentheses and braces
-			while ($dstat =~ s/\([^\(\)]*\)/1/ ||
-			       $dstat =~ s/\{[^\{\}]*\}/1/ ||
-			       $dstat =~ s/.\[[^\[\]]*\]/1/)
+			while ($dstat =~ s/\(([^\(\)]*)\)/$1/ ||
+			       $dstat =~ s/\{([^\{\}]*)\}/$1/ ||
+			       $dstat =~ s/.\[([^\[\]]*)\]/$1/)
 			{
 			}
 

base-commit: 53600ecfb6004f355bd3551bee180caf4b42d7a7
-- 
2.15.1

             reply	other threads:[~2017-12-18 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 14:17 Jeremy Sowden [this message]
2017-12-18 15:12 ` Joe Perches
2017-12-18 16:23   ` Jeremy Sowden

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=20171218141716.26227-1-jeremy@azazel.net \
    --to=jeremy@azazel.net \
    --cc=apw@canonical.com \
    --cc=joe@perches.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®