From: Larry Finger <Larry.Finger@lwfinger.net>
To: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: Possible false positive from checkpatch.pl
Date: Mon, 12 Jul 2010 13:35:55 -0500 [thread overview]
Message-ID: <4C3B608B.9010501@lwfinger.net> (raw)
In-Reply-To: <1278959315.1501.261.camel@Joe-Laptop.home>
On 07/12/2010 01:28 PM, Joe Perches wrote:
> On Mon, 2010-07-12 at 12:52 -0500, Larry Finger wrote:
>> Andy,
>>
>> In preparing a vendor driver for submission to staging, I am getting the
>> following from checkpatch.pl:
>>
>> ERROR: Macros with multiple statements should be enclosed in a do - while loop
>> #377: FILE: staging/rtl8712/rtl871x_mp_ioctl.h:377:
>> +#define GEN_MP_IOCTL_HANDLER(sz, hdl, oid) {sz, hdl, oid},
>
> I think you should leave off the trailing comma from the macros
> and C99 might be better. Maybe something like:
>
> (whatever the field names really are)
>
> #define GEN_MP_IOCTL_HANDLER(sz, hdl, oid) \
> {.field1 = sz, .field2 = hdl, .field3 = oid}
>
>> ERROR: Macros with multiple statements should be enclosed in a do - while loop
>> #378: FILE: staging/rtl8712/rtl871x_mp_ioctl.h:378:
>> +#define EXT_MP_IOCTL_HANDLER(sz, subcode, oid) {sz,&mp_ioctl_ \
>> + ## subcode ## _hdl, oid},
>
> The line continuation is rather ugly too. Perhaps it's better as:
>
> #define EXT_MP_IOCTL_HANDLER(sz, subcode, oid) \
> {.field1 = sz, .field2 =&mp_ioctl_##subcode##_hdl, .field3 = oid}
>
> They pass checkpatch without error.
>
> $ cat foo.h
> #define GEN_MP_IOCTL_HANDLER(sz, hdl, oid) \
> {.field1 = sz, .field2 = hdl, .field3 = oid}
> #define EXT_MP_IOCTL_HANDLER(sz, subcode, oid) \
> {.field1 = sz, .field2 =&mp_ioctl_##subcode##_hdl, .field3 = oid}
> $ ./scripts/checkpatch.pl -f foo.h
> total: 0 errors, 0 warnings, 4 lines checked
>
> foo.h has no obvious style problems and is ready for submission.
These are ugly macros that will be eliminated, but for the moment they are in
the code. As I stated in my original email, removing the comma from the
definition and adding it to the code does fix the checkpatch error, but it
should not be necessary.
Larry
next prev parent reply other threads:[~2010-07-12 18:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-12 17:52 Possible false positive from checkpatch.pl Larry Finger
2010-07-12 18:28 ` Joe Perches
2010-07-12 18:35 ` Larry Finger [this message]
2010-07-12 19:03 ` Joe Perches
2010-07-12 19:37 ` Larry Finger
2010-07-12 19:49 ` Joe Perches
2010-07-14 13:14 ` Andy Whitcroft
2010-07-14 16:16 ` Joe Perches
2010-07-14 13:13 ` Andy Whitcroft
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=4C3B608B.9010501@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=apw@canonical.com \
--cc=joe@perches.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.