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>
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;
break;
case MTD_UBIVOLUME:
printf("MTD_UBIVOLUME");
+ break;
default:
printf("(unknown type - new MTD API maybe?)");
}
break;
case 'c':
canonical = true;
+ /* fall-through */
case 'p':
pretty_print = true;
break;
break;
}
state = 1;
+ /* fall-through */
case 1: /* Not quoted */
if (c == '\\') {
if (*p)
switch (key) {
case 'c':
args.create = 1;
+ /* fall-through */
case 'r':
args.node = optarg;
break;