]> www.infradead.org Git - mtd-utils.git/commit
Mark or fix switch cases that fall through
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 21 Sep 2017 09:15:32 +0000 (11:15 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 2 Nov 2017 00:34:18 +0000 (01:34 +0100)
commit475bf707b958f37844534b7b45c905521c7401a2
tree014f8425c525242aa83d16f1261575d5b83ddd5a
parentcb2fcfc0a1da3cfac9094abf1d11c23653937395
Mark or fix switch cases that fall through

Now that C++17 introduced a special fallthrough keyword for
explicitly tagging switch cases that are supposed to fall
through, newer gcc versions also implement a feature request
from 2002 to warn about maybe unwanted fall-throughs in switch
cases in other languages (like C).

For C code, we can either add a gcc specific attribute at the
end of the switch case, or use a special comment that gcc checks
for, indicating that the fall-through behaviour is indeed
intended.

This patch adds a "/* fall-through */" comment at the end of
various case blocks to silence gcc warnings and in some cases
a break, where fall-through was probably not intended.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
misc-utils/flash_erase.c
misc-utils/mtd_debug.c
nand-utils/nanddump.c
tests/fs-tests/utils/fstest_monitor.c
ubi-utils/ubiblock.c