Skip to content

treewide: Add 'fallthrough' pseudo-keyword

Joe Perches linux-doc linux-sctp lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4net: sctp: Rename fallthrough label to unhandlednet/sctp/sm_make_chunk.c+6 -63 replies
2/4compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case useinclude/linux/compiler_attributes.h+17 -05 replies
3/4Documentation/process: Add fallthrough pseudo-keywordDocumentation/process/coding-style.rst Documentation/process/deprecated.rst+24 -112 replies
4/4scripts/cvt_style.pl: Tool to reformat sources in various waysscripts/cvt_style.pl+808 -05 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchPeter Zijlstra (Intel)Nick DesaulniersKees CookNeil Horman
1/4R-b R-b A-b
2/4A-b
3/4A-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 0/4] treewide: Add 'fallthrough' pseudo-keyword

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úllthrough

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úllthrough 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
Signature · 1 line
2.15.0