From: Mike Frysinger <vapier.adi@gmail.com>
To: John Kacur <jkacur@redhat.com>
Cc: Joe Perches <joe@perches.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Andy Whitcroft <apw@canonical.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] checkpatch.pl: Add warning on non #define continuation lines
Date: Tue, 2 Feb 2010 12:06:23 -0500 [thread overview]
Message-ID: <8bd0f97a1002020906u602f263fj276af79181e443d4@mail.gmail.com> (raw)
In-Reply-To: <520f0cf11002020549td6bb27fp9301d3385dc6a0e3@mail.gmail.com>
On Tue, Feb 2, 2010 at 08:49, John Kacur wrote:
> On Tue, Feb 2, 2010 at 1:55 PM, Joe Perches wrote:
>> On Tue, 2010-02-02 at 11:08 +0000, Mark Brown wrote:
>>> it'd be good to also check for just regular use of
>>> continuations in code other than macro definitions. These are just a
>>> style nit but if there's a script that filters out false positives from
>>> the macros that'd be handy...
>>
>>> Running "grep ' \\$' sound/soc/blackfin/*.[ch]" suggests that there's
>>> still some of the continuations I mentioned above in there (plus a lot
>>> of false positives from macros).
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 3257d3d..a174501 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -1234,6 +1234,7 @@ sub process {
>>
>> $realcnt = 0;
>> $linenr = 0;
>> + my $in_define = 0;
>> foreach my $line (@lines) {
>> $linenr++;
>>
>> @@ -1388,6 +1389,16 @@ sub process {
>> WARN("adding a line without newline at end of file\n" . $herecurr);
>> }
>>
>> + if ($rawline =~ /\\$/) {
>> + if ($rawline =~ /\s*\#\s*define\s+/) {
>> + $in_define = 1;
>> + } elsif (!$in_define) {
>> + WARN("Continuations outside of macros should be avoided\n" . $herecurr);
>> + }
>> + } else {
>> + $in_define = 0;
>> + }
>> +
>> # Blackfin: use hi/lo macros
>> if ($realfile =~ m@arch/blackfin/.*\.S$@) {
>> if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) {
>>
>>find ./ -name "*.[ch]" | xargs ./scripts/checkpatch.pl -f | grep -a3 Continuations
>
> Checkpatch is already kind of loud, so I'm not sure I like the idea -
> you even say yourself that it's just a style nit.
> But just in-case there are a lot of people who do like this, then you
> have to do some work to get rid of false positives. Try something like
> the following.
>
> 1. apply your patch.
> 2. run something like
> find ./ -name "*.[ch]" | xargs ./scripts/checkpatch.pl -f | grep -a3
> Continuations
>
> and then go through the results looking for false positives.
>
> One that I see right away, is with #if
> For example,
>
> #39: FILE: arch/arm/mach-lh7a40x/lcd-panel.h:39:
> +#if defined (MACH_LPD79520)\
>
> WARNING: Continuations outside of macros should be avoided
> #40: FILE: arch/arm/mach-lh7a40x/lcd-panel.h:40:
> + || defined (MACH_LPD79524)\
those examples are missing spaces before the \ ;)
-mike
next prev parent reply other threads:[~2010-02-02 17:06 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-31 20:02 [PATCH 00/10] treewide: Fix format strings that misuse continuations Joe Perches
2010-01-31 20:02 ` [PATCH 01/10] arch/powerpc: Fix continuation line formats Joe Perches
2010-02-01 2:16 ` Benjamin Herrenschmidt
2010-02-01 18:30 ` Joe Perches
2010-02-08 3:46 ` Benjamin Herrenschmidt
2010-01-31 20:02 ` [PATCH 02/10] arch/blackfin: " Joe Perches
2010-01-31 20:02 ` [PATCH 03/10] drivers/ide: " Joe Perches
2010-02-04 2:44 ` David Miller
2010-01-31 20:02 ` [PATCH 04/10] drivers/serial/bfin_5xx.c: " Joe Perches
2010-01-31 20:02 ` [PATCH 05/10] drivers/scsi/arcmsr: " Joe Perches
2010-02-01 17:16 ` James Bottomley
2010-02-01 17:30 ` Joe Perches
2010-02-01 18:02 ` Frans Pop
2010-02-02 18:20 ` Stefan Richter
2010-01-31 20:02 ` [PATCH 06/10] drivers/staging: " Joe Perches
2010-01-31 21:22 ` Gábor Stefanik
2010-01-31 20:02 ` [PATCH 07/10] drivers/net/amd8111e.c: " Joe Perches
2010-02-04 2:44 ` David Miller
2010-01-31 20:02 ` [PATCH 08/10] fs/proc/array.c: " Joe Perches
2010-01-31 20:02 ` [PATCH 09/10] mm/slab.c: " Joe Perches
2010-01-31 20:08 ` Matt Mackall
2010-01-31 20:13 ` Joe Perches
2010-01-31 20:32 ` Frans Pop
2010-01-31 20:38 ` Joe Perches
2010-01-31 23:53 ` Frans Pop
2010-01-31 20:02 ` [PATCH 10/10] sound/soc/blackfin: " Joe Perches
2010-02-01 14:47 ` Mark Brown
2010-02-01 17:08 ` Joe Perches
2010-02-02 4:13 ` Mike Frysinger
2010-02-02 11:08 ` Mark Brown
2010-02-02 12:55 ` [RFC PATCH] checkpatch.pl: Add warning on non #define continuation lines Joe Perches
2010-02-02 13:49 ` John Kacur
2010-02-02 17:06 ` Mike Frysinger [this message]
2010-02-02 22:34 ` [RFC PATCH V2] " Joe Perches
2010-02-02 23:18 ` Daniel Walker
2010-02-03 15:15 ` Andy Whitcroft
[not found] ` <m2n.s.201002011906064544@fjphome.nl>
2010-02-01 19:07 ` [PATCH 05/10] drivers/scsi/arcmsr: Fix continuation line formats Frans Pop
2010-02-01 19:35 ` [RFC] Fix unnecessary spaces before newlines in logging messages Joe Perches
2010-02-01 20:10 ` Frans Pop
2010-02-01 20:34 ` [PATCH] Warn on unnecessary spaces before quoted newlines Joe Perches
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=8bd0f97a1002020906u602f263fj276af79181e443d4@mail.gmail.com \
--to=vapier.adi@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=jkacur@redhat.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®