Re: [PATCH 4/4] scripts/cvt_style.pl: Tool to reformat sources in various ways
From: Kees Cook
Date: Thu Oct 10 2019 - 16:39:11 EST
On Sat, Oct 05, 2019 at 11:35:42PM -0700, Joe Perches wrote:
> On Sat, 2019-10-05 at 19:31 +0200, Miguel Ojeda wrote:
> > Hi Joe,
>
> Hello.
>
> > On Sat, Oct 5, 2019 at 6:47 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
> []
> > > As for the commit itself: while I am sure this tool is very useful
> > (and certainly you put a *lot* of effort into this tool), I don't see
> > how it is related to the fallthrough remapping (at least the
> > non-fallthrough parts).
>
> It's not particularly related.
>
> It's a 10 year old script that I just extended because it's
> convenient for me.
>
> I think I first posted it in 2011, but I started it as a
> complement to checkpatch in 2010.
>
> https://lwn.net/Articles/380161/
>
> Doing the regexes for the fallthrough conversions took me
> a couple hours.
>
> > Also, we should consider whether we want more tools like this now or
> > simply put the efforts into moving to clang-format.
>
> I think clang-format could not do this sort of conversion.
> Nor could coccinelle or checkpatch.
>
> Anyway, it's not really necessary for this particular patch
> to be applied, but it's a convenient way to show the script
> has the capability to do fallthrough comment conversions.
>
> I think it does conversions fairly reasonably but likely
> some files could not compile without adding an #include
> like:
>
> #include <linux/compiler.h>
I think this is a nice tool to add -- at the very least it serves as
infrastructure for future similar conversions. And small cleanups can be
generated from it for people looking to clean up subsystems, etc.
--
Kees Cook