Re: [PATCH] checkpatch: Add --strict test for function pointer calling style

From: Joe Perches
Date: Wed Nov 05 2014 - 14:31:13 EST


On Wed, 2014-11-05 at 14:12 -0500, Peter Hurley wrote:
> On 11/05/2014 01:41 PM, Joe Perches wrote:
> > Peter Hurley wrote:
> >
> > The use of older function ptr calling style, (*fn)(), makes static
> > analysis more error-prone; replace with modern fn() style.
> >
> > So make checkpatch emit a --strict test for that condition.
> >
> > Update the unnecessary parentheses test for dereferencing
> > objects at the same time and create a $fix mechanism too.
>
> Cool.
>
> perl's not my thing; how does it know not to trip up on
>
> initcall_t *call;
>
> (*call)();
>
> [which I verified it properly does not flag in drivers/tty/tty_io.c]

because the regex only matches "(foo->bar)("

It doesn't match (*foo->bar)("

and foo->bar could be any number of -> or . uses like

"(foo->bar.baz)("

or

"( foo -> bar . baz ) ("

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