lkml.org 
[lkml]   [2008]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC/PATCH] Update coding standard to avoid ungrepable printk format strings
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);
}

\
 
 \ /
  Last update: 2008-02-23 13:57    [W:0.044 / U:0.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site