lkml.org 
[lkml]   [2012]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] checkpatch: Add checks for do {} while (0) macro misuses
From
Date
On Fri, 2012-07-20 at 14:40 +0000, Betty Dall wrote:

> I reviewed this and tested it out on the qib.h file we were looking at yesterday
> and it worked well. I was worried about a nested do {} while(0), because it will
> match with the first while. Here is a test case:
> #define qib_devinfo(pcidev, fmt, ...) \
> do { \
> do { \
> dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__); \
> } while (0); \
> } while (0)
>
> Checkpatch.pl didn't complain about that one. Granted, it is a contrived test
> case. Your change will catch the real problems.

Hi Betty.

Wow, you're thorough. Thanks for testing.

I don't mind that it doesn't work in all cases.
I suppose this would fail for loops too.

checkpatch is a pretty limited tool as it depends on
the code being compilable and doesn't really understand
c syntax. It is just a convenience tool and lots of
its logic is incomplete and some of its output can be
happily ignored.

cheers, Joe



\
 
 \ /
  Last update: 2012-07-20 18:21    [W:3.192 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site