aboutsummaryrefslogtreecommitdiff
path: root/misc-utils
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-09-21 11:15:32 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-11-02 01:34:18 +0100
commit475bf707b958f37844534b7b45c905521c7401a2 (patch)
tree014f8425c525242aa83d16f1261575d5b83ddd5a /misc-utils
parentcb2fcfc0a1da3cfac9094abf1d11c23653937395 (diff)
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>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/flash_erase.c2
-rw-r--r--misc-utils/mtd_debug.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/misc-utils/flash_erase.c b/misc-utils/flash_erase.c
index 6db9fa3..0c9449f 100644
--- a/misc-utils/flash_erase.c
+++ b/misc-utils/flash_erase.c
@@ -155,8 +155,10 @@ int main(int argc, char *argv[])
default:
case 0:
errmsg("no MTD device specified");
+ /* fall-through */
case 1:
errmsg("no start erase block specified");
+ /* fall-through */
case 2:
errmsg("no erase block count specified");
error = 1;
diff --git a/misc-utils/mtd_debug.c b/misc-utils/mtd_debug.c
index d90a968..1fd6871 100644
--- a/misc-utils/mtd_debug.c
+++ b/misc-utils/mtd_debug.c
@@ -272,6 +272,7 @@ static int showinfo(int fd)
break;
case MTD_UBIVOLUME:
printf("MTD_UBIVOLUME");
+ break;
default:
printf("(unknown type - new MTD API maybe?)");
}