linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] treewide: Add 'fallthrough' pseudo-keyword
@ 2019-10-05 16:46 Joe Perches
  2019-10-05 16:46 ` [PATCH 1/4] net: sctp: Rename fallthrough label to unhandled Joe Perches
                   ` (4 more replies)
  0 siblings, 5 replies; 27+ messages in thread
From: Joe Perches @ 2019-10-05 16:46 UTC (permalink / raw)
  To: Linus Torvalds, linux-sctp
  Cc: Miguel Ojeda, Kees Cook, Borislav Petkov, H . Peter Anvin,
	Thomas Gleixner, Pavel Machek, Gustavo A . R . Silva,
	Arnaldo Carvalho de Melo, Kan Liang, Namhyung Kim, Jiri Olsa,
	Alexander Shishkin, Shawn Landden, x86, linux-kernel,
	Nathan Chancellor, Nick Desaulniers, Andrew Morton, David Miller,
	clang-built-linux, Jonathan Corbet, Vlad Yasevich, Neil Horman,
	Marcelo Ricardo Leitner, linux-doc, netdev

Add 'fallthrough' pseudo-keyword to enable the removal of comments
like '/* fallthrough */'.

Add a script to convert the fallthrough comments.

The script can be run over any single file or treewide.

For instance, a treewide conversion can be done using:

$ git ls-files -- '*.[ch]' | \
  xargs scripts/cvt_style.pl -o --convert=fallthrough

This currently produces:

$ git diff --shortstat
 1839 files changed, 4377 insertions(+), 4698 deletions(-)

Example fallthrough conversion produced by the script:

$ scripts/cvt_style.pl -o --convert=fallthrough arch/arm/mm/alignment.c

a/arch/arm/mm/alignment.c
b/arch/arm/mm/alignment.c
@@ -695,8 +695,7 @@ thumb2arm(u16 tinstr)
 			return subset[(L<<1) | ((tinstr & (1<<8)) >> 8)] |
 			    (tinstr & 255);		/* register_list */
 		}
-		/* Else, fall through - for illegal instruction case */
-
+		fallthrough;	/* for illegal instruction case */
 	default:
 		return BAD_INSTR;
 	}
@@ -751,8 +750,7 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
 	case 0xe8e0:
 	case 0xe9e0:
 		poffset->un = (tinst2 & 0xff) << 2;
-		/* Fall through */
-
+		fallthrough;
 	case 0xe940:
 	case 0xe9c0:
 		return do_alignment_ldrdstrd;

Joe Perches (4):
  net: sctp: Rename fallthrough label to unhandled
  compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use
  Documentation/process: Add fallthrough pseudo-keyword
  scripts/cvt_style.pl: Tool to reformat sources in various ways

 Documentation/process/coding-style.rst |   2 +-
 Documentation/process/deprecated.rst   |  33 +-
 include/linux/compiler_attributes.h    |  17 +
 net/sctp/sm_make_chunk.c               |  12 +-
 scripts/cvt_style.pl                   | 808 +++++++++++++++++++++++++++++++++
 5 files changed, 855 insertions(+), 17 deletions(-)
 create mode 100755 scripts/cvt_style.pl

-- 
2.15.0

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2019-10-12  2:14 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-05 16:46 [PATCH 0/4] treewide: Add 'fallthrough' pseudo-keyword Joe Perches
2019-10-05 16:46 ` [PATCH 1/4] net: sctp: Rename fallthrough label to unhandled Joe Perches
2019-10-07 18:08   ` Nick Desaulniers
2019-10-10 20:34   ` Kees Cook
2019-10-11 12:20   ` Neil Horman
2019-10-05 16:46 ` [PATCH 2/4] compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use Joe Perches
2019-10-05 17:17   ` Miguel Ojeda
2019-10-07 18:14     ` Nick Desaulniers
2019-10-07 18:28       ` Joe Perches
2019-10-10 20:37     ` Kees Cook
2019-10-11 22:25       ` Miguel Ojeda
2019-10-05 16:46 ` [PATCH 3/4] Documentation/process: Add fallthrough pseudo-keyword Joe Perches
2019-10-05 17:47   ` Miguel Ojeda
2019-10-09 21:51     ` Nick Desaulniers
2019-10-05 16:46 ` [PATCH 4/4] scripts/cvt_style.pl: Tool to reformat sources in various ways Joe Perches
2019-10-05 17:31   ` Miguel Ojeda
2019-10-06  6:35     ` Joe Perches
2019-10-10 20:39       ` Kees Cook
2019-10-10 20:48         ` Joe Perches
2019-10-09 22:37   ` Nick Desaulniers
2019-10-11 16:29 ` [PATCH 0/4] treewide: Add 'fallthrough' pseudo-keyword Linus Torvalds
2019-10-11 17:43   ` Joe Perches
2019-10-11 17:46     ` Linus Torvalds
2019-10-12  2:14       ` Joe Perches
2019-10-11 18:01   ` Miguel Ojeda
2019-10-11 22:07     ` Kees Cook
2019-10-11 22:26       ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).