summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorSami Kerola2017-05-16 10:18:24 +0200
committerKarel Zak2017-06-14 11:48:22 +0200
commitb1557fe98120132e6671924af4ed69f4e21d3de4 (patch)
tree5b7a0e689fd4a09288f57c3a8eb4f24075ca65a3 /misc-utils
parentlibblkid: fix gcc-7 warning -Wint-in-bool-context (diff)
downloadkernel-qcow2-util-linux-b1557fe98120132e6671924af4ed69f4e21d3de4.tar.gz
kernel-qcow2-util-linux-b1557fe98120132e6671924af4ed69f4e21d3de4.tar.xz
kernel-qcow2-util-linux-b1557fe98120132e6671924af4ed69f4e21d3de4.zip
misc: fix ggc-7 fallthrough warnings
(Original patch and commit message edited by Rudi.) gcc-7 adds -Wimplicit-fallthrough=3 to our default flag -Wextra. This warning can be silenced by using comment /* fallthrough */ which is also recognized by other tools like coverity. There are also other valid comments (see man gcc-7) but we consolidate this style now. We could have also used __attribute__((fallthrough)) but the comment looks nice and does not need to be ifdef'ed for compatibility. Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652 Reference: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/ Reviewed-by: Ruediger Meier <ruediger.meier@ga-group.nl> Suggested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/cal.c4
-rw-r--r--misc-utils/rename.c1
2 files changed, 2 insertions, 3 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 604eb26a7..86e159bfa 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -431,7 +431,7 @@ int main(int argc, char **argv)
ctl.req.day = strtos32_or_err(*argv++, _("illegal day value"));
if (ctl.req.day < 1 || DAYS_IN_MONTH < ctl.req.day)
errx(EXIT_FAILURE, _("illegal day value: use 1-%d"), DAYS_IN_MONTH);
- /* FALLTHROUGH */
+ /* fallthrough */
case 2:
if (isdigit(**argv))
ctl.req.month = strtos32_or_err(*argv++, _("illegal month value: use 1-12"));
@@ -443,7 +443,7 @@ int main(int argc, char **argv)
}
if (ctl.req.month < 1 || MONTHS_IN_YEAR < ctl.req.month)
errx(EXIT_FAILURE, _("illegal month value: use 1-12"));
- /* FALLTHROUGH */
+ /* fallthrough */
case 1:
ctl.req.year = strtos32_or_err(*argv++, _("illegal year value"));
if (ctl.req.year < SMALLEST_YEAR)
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index 65ac543ef..b06a2d969 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -189,7 +189,6 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
case 'h':
usage(stdout);
- /* fallthrough */
default:
errtryhelp(EXIT_FAILURE);
}