mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Betty Dall <betty.dall@hp.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Whitcroft <apw@canonical.com>
Subject: Re: [PATCH] checkpatch: Add checks for do {} while (0) macro misuses
Date: Fri, 20 Jul 2012 08:49:57 -0700	[thread overview]
Message-ID: <1342799397.21447.35.camel@joe2Laptop> (raw)
In-Reply-To: <loom.20120720T160308-562@post.gmane.org>

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


      reply	other threads:[~2012-07-20 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19 22:11 Joe Perches
2012-07-20 14:40 ` Betty Dall
2012-07-20 15:49   ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342799397.21447.35.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=betty.dall@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®