All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Matt Mackall <mpm@selenic.com>
Cc: Dave Jones <davej@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: checkpatch, a patch checking script.
Date: Sun, 29 Apr 2007 16:37:01 -0700	[thread overview]
Message-ID: <20070429163701.fb994561.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20070428172154.GA11115@waste.org>

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 ***

  reply	other threads:[~2007-04-29 23:33 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-23 14:11 [PATCH 0/9] Kconfig: cleanup s390 v2 Martin Schwidefsky
2007-04-23 16:52 ` Arnd Bergmann
2007-04-23 17:45 ` Andrew Morton
2007-04-24  7:52   ` Martin Schwidefsky
2007-04-25 18:21   ` Randy Dunlap
2007-04-25 21:30     ` Andrew Morton
2007-04-26  0:24       ` Andrew Morton
2007-04-26  0:32         ` Arnd Bergmann
2007-04-26  1:06           ` Andrew Morton
2007-04-27 14:21             ` patch style checks Andy Whitcroft
2007-04-27 15:44               ` jschopp
2007-04-26  1:39           ` [PATCH 0/9] Kconfig: cleanup s390 v2 Anton Vorontsov
2007-04-26  8:30           ` Andrew Morton
2007-04-26 20:36             ` Randy Dunlap
2007-04-26  0:39         ` Dave Jones
2007-04-26  2:38           ` Randy Dunlap
2007-04-26  3:02             ` Andrew Morton
2007-04-26  4:24               ` Dave Jones
2007-04-28  3:08               ` checkpatch, a patch checking script Dave Jones
2007-04-28  3:36                 ` Roland Dreier
2007-04-28  3:47                   ` Adrian Bunk
2007-04-30  0:43                   ` Randy Dunlap
2007-04-28  5:18                 ` Andrew Morton
2007-04-28  5:50                   ` Roland Dreier
2007-04-28 10:52                     ` Andi Kleen
2007-04-28  5:58                   ` Roland Dreier
2007-04-28  8:01                     ` Jan Engelhardt
2007-04-28  8:16                       ` Andrew Morton
2007-04-28 10:53                         ` Jan Engelhardt
2007-04-29 23:35                       ` Randy Dunlap
2007-04-28 10:48                   ` Andi Kleen
2007-04-28 10:02                     ` Andrew Morton
2007-04-28 10:15                       ` Alan Cox
2007-04-28 11:18                         ` Andi Kleen
2007-04-28 11:32                           ` Alan Cox
2007-04-28 17:06                       ` Dave Jones
2007-04-28 18:11                         ` Jeff Garzik
2007-04-30  0:59                   ` Randy Dunlap
2007-04-28 16:11                 ` Matt Mackall
2007-04-28 17:11                   ` Dave Jones
2007-04-28 17:21                     ` Matt Mackall
2007-04-29 23:37                       ` Randy Dunlap [this message]
2007-04-30  0:09                         ` Matt Mackall
2007-04-30  0:18                           ` Randy Dunlap
2007-04-30  1:59                             ` Matt Mackall
2007-04-30 23:59                 ` Randy Dunlap
2007-05-02 14:28                 ` Geert Uytterhoeven
2007-05-02 15:29                   ` Christoph Hellwig
2007-05-02 15:32                     ` Geert Uytterhoeven
2007-05-02 19:41                       ` Andrew Morton
2007-05-02 19:55                         ` Geert Uytterhoeven
2007-05-02 20:29                           ` Andrew Morton
2007-05-02 19:08                     ` Jan Engelhardt
2007-05-02 19:05                   ` Jan Engelhardt
2007-05-03  7:32                   ` Sébastien Dugué
2007-05-03  9:27                     ` Geert Uytterhoeven
2007-04-26 13:02       ` [PATCH 0/9] Kconfig: cleanup s390 v2 Andy Whitcroft
2007-05-09 11:21   ` Martin Schwidefsky
2007-05-09 16:35     ` Andrew Morton
2007-05-10  7:25       ` Martin Schwidefsky

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=20070429163701.fb994561.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    /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.