Re: [RFC PATCH] checkpatch: Add a --strict test for macro argumentreuse

From: Joe Perches
Date: Thu Nov 08 2012 - 08:25:53 EST


On Tue, 2012-11-06 at 12:00 -0800, Andrew Morton wrote:
> On Tue, 06 Nov 2012 02:35:39 -0800
> Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> > Add a test for reuse of macro arguments to highlight
> > any possible side-effects from this reuse.
> >
> > Avoid this check on token name pasting and when the
> > argument is used in a typeof or a __builtin.
>
> Does this mean that if I do
>
> #define foo(a) bar(a, a)
>
> that checkpatch will not generate a warning unless I give it
> "--strict"? If so: whaaah! I want that warning to come out by
> default.

Well, that was the intent, yes.

I wanted to avoid a bunch of people "improving" simple macros
with a normal checkpatch run on files like include/linux/kernel.h

> Not being totally lazy, I tried it myself but my perl v5.10.1 had
> conniptions over this patch:

Because I had originally used ERROR but decided to use the
incorrect form of CHECK instead of CHK when I submitted the
patch. Sorry.

Anyway, do try it on include/linux files with -f and see if
you think it's really appropriate to have the thing report
this type of error.

Dunno. Maybe it's appropriate to warn on .diff/.patch files
but only emit the message on checkpatch -f --strict uses.

I generally don't like different behavior based on runtime
input. Shrug. Who knows what's right here.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/