diff options
author | Sami Kerola | 2017-05-16 10:18:24 +0200 |
---|---|---|
committer | Karel Zak | 2017-06-14 11:48:22 +0200 |
commit | b1557fe98120132e6671924af4ed69f4e21d3de4 (patch) | |
tree | 5b7a0e689fd4a09288f57c3a8eb4f24075ca65a3 /text-utils/more.c | |
parent | libblkid: fix gcc-7 warning -Wint-in-bool-context (diff) | |
download | kernel-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 'text-utils/more.c')
-rw-r--r-- | text-utils/more.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/text-utils/more.c b/text-utils/more.c index 72dd96bf4..c0c2e8743 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -1270,7 +1270,7 @@ int command(char *filename, register FILE *f) break; } lastp++; - /* fall through */ + /* fallthrough */ case '/': if (nlines == 0) nlines++; @@ -1368,7 +1368,7 @@ int command(char *filename, register FILE *f) (char *)0); break; } - /* fall through */ + /* fallthrough */ default: if (dum_opt) { kill_line(); @@ -2023,6 +2023,7 @@ int expand(char **outbuf, char *inbuf) *outstr++ = *inpstr++; break; } + /* fallthrough */ default: *outstr++ = c; } |