kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: joe@perches.com (Joe Perches)
To: kernelnewbies@lists.kernelnewbies.org
Subject: [PATCH] checkpatch: Allow comments in macros tested for single statements
Date: Thu, 08 Jan 2015 13:31:33 -0800	[thread overview]
Message-ID: <1420752693.11784.13.camel@perches.com> (raw)
In-Reply-To: <79493.1420750167@turing-police.cc.vt.edu>

Convert all the comments to spaces before testing for
single statement macros.

Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Signed-off-by: Joe Perches <joe@perches.com>
---
> It's interesting that the warning only popped on the one case where the
> "/* looping version */" is on a separate line, not on the #else line.
> 
> Am cc'ing Joe Perches for that question. Joe - to get you up to speed,
> checkpatch was run against drivers/staging/skein/skein_block.c, and it
> flagged one definition of the macro R256, but not the other one, or the
> two definitions each for R512 and R1024.  Any idea why?

Yup, that was it...

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 6afc24b..6ac355e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4260,6 +4260,7 @@ sub process {
 			$ctx = $dstat;
 
 			$dstat =~ s/\\\n.//g;
+			$dstat =~ s/$;/ /g;
 
 			if ($dstat =~ /^\+\s*#\s*define\s+$Ident\s*${balanced_parens}\s*do\s*{(.*)\s*}\s*while\s*\(\s*0\s*\)\s*([;\s]*)\s*$/) {
 				my $stmts = $2;

  parent reply	other threads:[~2015-01-08 21:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 20:00 Submitted a first patch and no reply shirish gajera
2015-01-08 20:32 ` Valdis.Kletnieks at vt.edu
2015-01-08 20:37   ` shirish gajera
2015-01-08 20:49     ` Valdis.Kletnieks at vt.edu
2015-01-08 21:14       ` Joe Perches
2015-01-08 21:25         ` shirish gajera
2015-01-08 21:31       ` Joe Perches [this message]
2015-01-09 16:55 ` michi1 at michaelblizek.twilightparadox.com

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=1420752693.11784.13.camel@perches.com \
    --to=joe@perches.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).