Re: [PATCH] checkpatch: don't warn on every struct without const_structs file

From: Joe Perches
Date: Tue Jan 10 2017 - 11:50:13 EST


On Tue, 2017-01-10 at 17:31 +0100, Johannes Berg wrote:
> > > I copied checkpatch elsewhere and ran it.
> >
> > Why do you want to copy checkpatch "someplace else"?
> > Instead of copy, I think you should soft link it.
>
> Well, no, I have to distribute it with that.
>
> > > Regardless, the current code is utterly stupid - it prints a
> > > warning that it won't flag any structs, and then proceeds to flag
> > > all structs.
> > >
> > > If you must, send a patch to abort() [whatever the perl equivalent
> > > is] when the file can't be found, but as it is, the code is just
> > > idiotic.
> >
> > Maybe so.
> >
> > As is, your patch description is incomplete because
> > it doesn't mention your use case.
>
> I don't think that's relevant.

I do. checkpatch is a script written for linux patches.

You are making use of the script outside of the linux tree.
You could just as well keep a local copy of this patch instead.

Your patch allows you to avoid this and the patch description
is relevant to why this is useful.

So your patch description is simply incorrect/incomplete:

---------------------------------------------------------------
The script says that it won't warn:
"No structs that should be const will be found [...]"

but then that doesn't work and it warns on every single struct
instead, since the regular expression ends up empty. Fix that
by checking that it's not empty first.
---------------------------------------------------------------

When used for linux, checkpatch works just fine and your
patch description describes a condition that doesn't happen.

> The script is internally inconsistent,
> as I do mention in the commit log, which is worth fixing.

Yeah, I think it's useful to fix.

Just make the commit message describe why the patch is
appropriate for non-linux uses.