Re: [PATCH] checkpatch: add an exclusion for 'for_each' helper macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joel Schopp wrote:
> 
> Dan Williams wrote:
>> checkpatch currently complains about macros like the following:
>>
>> #define for_each_dma_cap_mask(cap, mask) \
>>     for ((cap) = first_dma_cap(mask);       \
>>         (cap) < DMA_TX_TYPE_END;        \
>>         (cap) = next_dma_cap((cap), (mask)))
>>
>>
>> Signed-off-by: Dan Williams <[email protected]>
> 
> I'd like it if this patch updated Chapter 12 of
> Documentation/CodingStyle as well. That section is where the rule to
> check came from and it would be nice for it to mention the exception to
> the rule as well.
> 
> 
> 

The actual restriction is on statements not on lines it seems:

"Macros with multiple statements should be enclosed in a do - while block"

So if this is only a single statement it is safe without a "container".
 I have a patch cooked up here which works out if there are more than
one statement which seems to do the trick.

Dan, thanks for the report.

-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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux