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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to