* [PATCH] Handle space after for_each_* macros gracefully in checkpatch
@ 2008-10-24 11:50 Andi Kleen
2008-10-24 14:23 ` Andy Whitcroft
0 siblings, 1 reply; 2+ messages in thread
From: Andi Kleen @ 2008-10-24 11:50 UTC (permalink / raw)
To: apw, linux-kernel
Handle space after for_each_* macros gracefully in checkpatch.pl
Anyone else seeing the irony of checkpatch.pl recommending to
use for_each_cpu_mask, but then not actually parsing it
correctly.
When you write
for_each_cpu_mask (...) {
it would complain about the space between mask and the open bracket
because it thinks it's a normal function call.
Fix this in a generic way. In theory someone could construct
a normal function that starts with for_each_* and it would
not warn, but I think that would be uncommon. The alternative
of listing all macros was tried first, but turned out to
be unwieldly.
I think I covered most of the common ones available, the
only exceptions are a few oddballs with leading prefix
like pnp_for_each* or zorro_for_each.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Index: linux-2.6.27-misc/scripts/checkpatch.pl
===================================================================
--- linux-2.6.27-misc.orig/scripts/checkpatch.pl
+++ linux-2.6.27-misc/scripts/checkpatch.pl
@@ -1513,6 +1513,7 @@ sub process {
if|for|while|switch|return|case|
volatile|__volatile__|
__attribute__|format|__extension__|
+ ([ph]?list_)?for_each_[a-z_]+|
asm|__asm__)$/x)
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Handle space after for_each_* macros gracefully in checkpatch
2008-10-24 11:50 [PATCH] Handle space after for_each_* macros gracefully in checkpatch Andi Kleen
@ 2008-10-24 14:23 ` Andy Whitcroft
0 siblings, 0 replies; 2+ messages in thread
From: Andy Whitcroft @ 2008-10-24 14:23 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel
On Fri, Oct 24, 2008 at 01:50:10PM +0200, Andi Kleen wrote:
> Handle space after for_each_* macros gracefully in checkpatch.pl
>
> Anyone else seeing the irony of checkpatch.pl recommending to
> use for_each_cpu_mask, but then not actually parsing it
> correctly.
>
> When you write
>
> for_each_cpu_mask (...) {
>
> it would complain about the space between mask and the open bracket
> because it thinks it's a normal function call.
>
> Fix this in a generic way. In theory someone could construct
> a normal function that starts with for_each_* and it would
> not warn, but I think that would be uncommon. The alternative
> of listing all macros was tried first, but turned out to
> be unwieldly.
>
> I think I covered most of the common ones available, the
> only exceptions are a few oddballs with leading prefix
> like pnp_for_each* or zorro_for_each.
I am happy with this conceptually. However when this was suggested
before there was a concensus that that it was not obvious whether this
was meant to be written as a function or a control and nothing was done.
So if people are with you on this, I am happy.
-apw
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-24 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-24 11:50 [PATCH] Handle space after for_each_* macros gracefully in checkpatch Andi Kleen
2008-10-24 14:23 ` Andy Whitcroft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).