Re: +checkpatch-add-check-for-use-of-sizeof-without-parenthesis.patch added to-mm tree

From: Joe Perches
Date: Tue Jul 10 2012 - 01:13:11 EST


On Mon, 2012-07-09 at 19:21 -0700, David Rientjes wrote:
> On Mon, 9 Jul 2012, Joe Perches wrote:
>
> > I don't really care what style a large block of code
> > uses. I care that it mostly has the same form.

> Same form?? The sizeof operator has two forms depending on whether it's a
> unary expression or a type as specified by the standard.

> The issue here is that you're mandating they all use the same form because
> you're quoting an email from Linus four years ago that you dug up but
> isn't required in the coding style and is already used in over 1000 places
> in the kernel.

$ git grep -E "\bsizeof\s*\*"|wc -l
935
$ git grep -E "\bsizeof\s*\(\s*\*"|wc -l
12762

> If you want the output of checkpatch.pl to be useful, I would think you
> would want to eliminate this kind of garbage.

You are using high emotion words for little purpose.

checkpatch is useful, but it's not all that useful for those
quite familiar with kernel style.

Except maybe to generate flame emails...

It does have some use for reviewing patches.

> > "Another example of this is "sizeof". The kernel universally (I hope) has
> > parenthesis around the sizeof argument, even though it's clearly not
> > required by the C language."
>
> He's obviously addressing a single form of the sizeof operator, i.e. those
> on unary expressions; sizeof used on a type CLEARLY DOES require the
> parenthesis.

That's one opinion, though I doubt it's his.
<shrug> Maybe he'll reply. (edit: he did)

> you're talking purely about style preferences here.

_All_ of checkpatch is style preference.
None if it is a mandate. Those that care to use it can.
You can ignore it. I don't mind.

Otherwise, just read and write the code and do what you
think best. I'm not a particular style zealot. I'm not
going to nack a patch just because you or anyone else uses
a style that isn't the predominate one.

cheers, Joe

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