From: Andy Whitcroft <apw@shadowen.org>
To: Christer Weinigel <christer@weinigel.se>
Cc: Andi Kleen <andi@firstfloor.org>,
linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [RFC/PATCH] Update coding standard to avoid ungrepable printk format strings
Date: Mon, 25 Feb 2008 05:29:25 +0000 [thread overview]
Message-ID: <20080225052925.GA2604@shadowen.org> (raw)
In-Reply-To: <47C017C4.20209@weinigel.se>
On Sat, Feb 23, 2008 at 01:55:32PM +0100, Christer Weinigel wrote:
> Andi Kleen wrote:
> >RFC: Update coding standard to avoid split up printk format strings
>
> While we're talking about checkpatch.pl, I'd definitely like to teach
> checkpatch about "list_for_each" and friends.
>
> list_for_each is flow control, not a function call. I find it much
> easier to see that something is a loop when there is a space between the
> name and the parenthesis rather than when they are smashed together.
>
> old patch follows
>
> /Christer
>
> checkpatch complains about the following:
>
> WARNING: no space between function name and open parenthesis '('
> #520: FILE: drivers/spi/spi_s3c24xx_dma.c:478:
> + list_for_each_entry (transfer, &message->transfers, transfer_list) {
>
> which I think is a bit bogus since it actually is a for statement in
> disguise. The following patch adds list_for_each to the list of things
> that look like functions that it shouldn't complain about.
>
> Index: linux-2.6.23/scripts/checkpatch.pl
> ===================================================================
> --- linux-2.6.23.orig/scripts/checkpatch.pl
> +++ linux-2.6.23/scripts/checkpatch.pl
> @@ -681,7 +681,7 @@ sub process {
>
> # check for spaces between functions and their parentheses.
> if ($line =~ /($Ident)\s+\(/ &&
> - $1 !~
> /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/
> &&
> + $1 !~
> /^(?:if|for|while|switch|list_for_each.*|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/
> &&
> $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) {
> WARN("no space between function name and open
> parenthesis '('\n" . $herecurr);
> }
This has come up a few times. In previous discussions there were
supporters for spaces as well as not. Looking over the existing in kernel
use, the majority are without a space (from before checkpatch encouraged
that usage); and so it is that that won the day.
-apw
next prev parent reply other threads:[~2008-02-25 5:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-22 13:26 [RFC/PATCH] Update coding standard to avoid ungrepable printk format strings Andi Kleen
2008-02-22 13:53 ` Stefan Richter
2008-02-22 14:01 ` Andi Kleen
2008-02-22 15:02 ` Alan Cox
2008-02-22 16:58 ` Joe Perches
2008-02-23 12:55 ` Christer Weinigel
2008-02-25 5:29 ` Andy Whitcroft [this message]
2008-02-25 5:30 ` 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=20080225052925.GA2604@shadowen.org \
--to=apw@shadowen.org \
--cc=andi@firstfloor.org \
--cc=christer@weinigel.se \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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.