Messages in this thread | | | Subject | Re: [PATCH] checkpatch: types found in one source file do not affect processing of others | From | Joe Perches <> | Date | Mon, 18 May 2015 09:22:42 -0700 |
| |
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.
| |