From: Joe Perches <joe@perches.com>
To: Alex Dowad <alexinbeijing@gmail.com>
Cc: Andy Whitcroft <apw@canonical.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] checkpatch: types found in one source file do not affect processing of others
Date: Mon, 18 May 2015 09:22:42 -0700 [thread overview]
Message-ID: <1431966162.2870.22.camel@perches.com> (raw)
In-Reply-To: <1431956009-16076-1-git-send-email-alexinbeijing@gmail.com>
On Mon, 2015-05-18 at 15:33 +0200, Alex Dowad wrote:
> checkpatch uses various cues in its input files to discover the names of
> user-defined types. It then uses that information when processing expressions,
> to discover more style issues.
>
> Unfortunately, in rare cases, this means that checkpatch may give different
> results if you run it on several files at the same time, or one by one! The
> reason is that it may identify a type (or something that looks like a type)
> in one file, and then carry this information over when processing a different
> file.
True, thanks.
I found the same thing, but hadn't gotten 'round
to submitting a patch for it.
> keep user-defined types in a separate array from built-in ones,
> and reset the array of user-defined types at the beginning of each new
> source file.
[]
> I am not a Perl programmer -- please let me know if there is a better way to
> accomplish what I am trying to do here.
I think nearly no-one _wants_ to be a perl monk.
(Except maybe for the free beer)
> @@ -511,7 +515,7 @@ $misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix;
>
> sub build_types {
> my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)";
> - my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";
> + my $all = "(?x: \n" . join("|\n ", @allTypeList) . "\n)";
> my $Misordered = "(?x: \n" . join("|\n ", @typeListMisordered) . "\n)";
> my $allWithAttr = "(?x: \n" . join("|\n ", @typeListWithAttr) . "\n)";
> $Modifier = qr{(?:$Attribute|$Sparse|$mods)};
> @@ -745,6 +749,7 @@ for my $filename (@ARGV) {
> @fixed = ();
> @fixed_inserted = ();
> @fixed_deleted = ();
> + @allTypeList = (@typeList);
> $fixlinenr = -1;
> }
I think a proper solution requires a bit more than this.
I believe both @modifierList and @typeList need to be reset
before each new file is processed.
I'll play with it.
Thanks Alex.
next prev parent reply other threads:[~2015-05-18 16:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 13:33 [PATCH] checkpatch: types found in one source file do not affect processing of others Alex Dowad
2015-05-18 16:22 ` Joe Perches [this message]
2015-05-18 17:03 ` Andy Whitcroft
2015-05-18 18:42 ` Joe Perches
2015-05-18 19:28 ` Alex Dowad
2015-05-19 0:22 ` [PATCH V2] checkpatch: Make types found in a source file/patch local Joe Perches
2015-05-19 10:34 ` [Acked] " Andy Whitcroft
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=1431966162.2870.22.camel@perches.com \
--to=joe@perches.com \
--cc=alexinbeijing@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.