From 475bf707b958f37844534b7b45c905521c7401a2 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 21 Sep 2017 11:15:32 +0200 Subject: 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 --- ubi-utils/ubiblock.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ubi-utils') diff --git a/ubi-utils/ubiblock.c b/ubi-utils/ubiblock.c index 8e36678..71e60b6 100644 --- a/ubi-utils/ubiblock.c +++ b/ubi-utils/ubiblock.c @@ -74,6 +74,7 @@ static int parse_opt(int argc, char * const argv[]) switch (key) { case 'c': args.create = 1; + /* fall-through */ case 'r': args.node = optarg; break; -- cgit v1.2.3