Re: [PATCH] cvt_fallthrough: A tool to convert /* fallthrough */ comments to fallthrough;

From: Andrew Morton
Date: Thu Feb 20 2020 - 19:21:16 EST


On Thu, 20 Feb 2020 12:30:21 -0800 Joe Perches <joe@xxxxxxxxxxx> wrote:

> Convert /* fallthrough */ style comments to the pseudo-keyword fallthrough
> to allow clang 10 and higher to work at finding missing fallthroughs too.
>
> Requires a git repository and overwrites the input files.
>
> Typical command use:
> ./scripts/cvt_fallthrough.pl <path|file>
>
> i.e.:
>
> $ ./scripts/cvt_fallthrough.pl block
> converts all files in block and its subdirectories
> $ ./scripts/cvt_fallthrough.pl drivers/net/wireless/zydas/zd1201.c
> converts a single file
>
> A fallthrough comment with additional comments is converted akin to:
>
> - /* fall through - maybe userspace knows this conn_id. */
> + fallthrough; /* maybe userspace knows this conn_id */
>
> A fallthrough comment or fallthrough; between successive case statements
> is deleted.
>
> e.g.:
>
> case FOO:
> /* fallthrough */ (or fallthrough;)
> case BAR:
>
> is converted to:
>
> case FOO:
> case BAR:
>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
> scripts/cvt_fallthrough.pl | 215 +++++++++++++++++++++++++++++++++++++

Do we need this in the tree long-term? Or is it a matters of "hey
Linus, please run this" then something like add a checkpatch rule to
catch future slipups?