From: Christer Weinigel <christer@weinigel.se>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [RFC/PATCH] Update coding standard to avoid ungrepable printk format strings
Date: Sat, 23 Feb 2008 13:55:32 +0100 [thread overview]
Message-ID: <47C017C4.20209@weinigel.se> (raw)
In-Reply-To: <20080222132612.GA11717@basil.nowhere.org>
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);
}
next prev parent reply other threads:[~2008-02-23 12:55 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 [this message]
2008-02-25 5:29 ` Andy Whitcroft
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=47C017C4.20209@weinigel.se \
--to=christer@weinigel.se \
--cc=andi@firstfloor.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox