lkml.org 
[lkml]   [2020]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cvt_fallthrough: A tool to convert /* fallthrough */ comments to fallthrough;
On Thu, 20 Feb 2020 12:30:21 -0800 Joe Perches <joe@perches.com> 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@perches.com>
> ---
> 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?

\
 
 \ /
  Last update: 2020-02-21 01:21    [W:0.153 / U:4.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site