lkml.org 
[lkml]   [2007]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: checkpatch, a patch checking script.
On Sat, 28 Apr 2007 12:21:54 -0500 Matt Mackall wrote:

> On Sat, Apr 28, 2007 at 01:11:01PM -0400, Dave Jones wrote:
> > On Sat, Apr 28, 2007 at 11:11:36AM -0500, Matt Mackall wrote:
> > > > I'm all ears for additional regexps, bug reports or other suggestions.
> > >
> > > Neat.
> > >
> > > Does it check for:
> > >
> > > functions marked extern?

data marked extern?

> > > pulling in external functions or variables without a header file?
> > > return used as a function, eg return(foo);?
> >
> > These sound a little more tricky than just dumb regexps.
> > I don't want to expand this to a fullblown C parser (given
> > that we have sparse which can do a better job), but I don't
> > object to adding some extra code to give the searches more
> > context.
>
> The first is a straightforward one-line regexp, as is the last:
>
> ^extern \w.*\w\(

Just omit the ending \( to catch functions or data.
Added.

> return\s?\(

Added. Thanks.

> The middle one is a bit trickier. Basically, we don't want people
> doing either:
>
> extern int capital_of_assyria;
> int sir_not_appearing_in_this_module();
>
> in .c files. The first of those two is easy, provided you can figure
> out the file type. And both are possible with multiline regexps.
>
> This whole thing would be quite a bit more powerful if your search
> function joined all the lines together, did a potentially multiline
> search, then calculated the line numbers from the search results. Then
> you could search for things like:
>
> if (...)
> {
>
> if (...) {
> single_statement;
> }
>
> Looking forward to fully-automated pedantry. This should probably live
> in scripts/.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-04-30 01:37    [W:0.388 / U:0.160 seconds]
©2003-2014 Jasper Spaans. Advertise on this site