From f26e83d0a1eb3f5cd6ac64710a70d5a7010dc96e Mon Sep 17 00:00:00 2001 From: Julien Lecoeur Date: Wed, 28 Jun 2017 16:06:06 +0200 Subject: [PATCH] Fix -Werror=implicit-fallthrough on gcc7 --- fs/vfs/fs_lseek.c | 2 +- libc/stdio/lib_dtoa.c | 5 ++--- libc/stdio/lib_sscanf.c | 1 + libc/stdlib/lib_strtod.c | 4 ++++ libc/stdlib/lib_strtof.c | 4 ++++ libc/stdlib/lib_strtold.c | 4 ++++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fs/vfs/fs_lseek.c b/fs/vfs/fs_lseek.c index be74239eca..bea398c0a3 100644 --- a/fs/vfs/fs_lseek.c +++ b/fs/vfs/fs_lseek.c @@ -99,7 +99,7 @@ off_t file_seek(FAR struct file *filep, off_t offset, int whence) { case SEEK_CUR: offset += filep->f_pos; - + /* FALLTHROUGH */ case SEEK_SET: if (offset >= 0) { diff --git a/libc/stdio/lib_dtoa.c b/libc/stdio/lib_dtoa.c index ab03d9b4a4..0cc3b48fdd 100644 --- a/libc/stdio/lib_dtoa.c +++ b/libc/stdio/lib_dtoa.c @@ -1193,7 +1193,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve) case 2: leftright = 0; - /* no break */ + /* FALLTHROUGH */ case 4: if (ndigits <= 0) { @@ -1205,8 +1205,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve) case 3: leftright = 0; - /* no break */ - + /* FALLTHROUGH */ case 5: i = ndigits + k + 1; ilim = i; diff --git a/libc/stdio/lib_sscanf.c b/libc/stdio/lib_sscanf.c index 52e89b5e9a..72dca128bd 100644 --- a/libc/stdio/lib_sscanf.c +++ b/libc/stdio/lib_sscanf.c @@ -646,6 +646,7 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap) default: case 'd': sign = true; + /* FALLTHROUGH */ case 'u': base = 10; break; diff --git a/libc/stdlib/lib_strtod.c b/libc/stdlib/lib_strtod.c index 62da9e0f6e..af830abf50 100644 --- a/libc/stdlib/lib_strtod.c +++ b/libc/stdlib/lib_strtod.c @@ -113,8 +113,10 @@ double strtod(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment position */ + /* FALLTHROUGH */ case '+': p++; + /* FALLTHROUGH */ default: break; } @@ -175,8 +177,10 @@ double strtod(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment pos */ + /* FALLTHROUGH */ case '+': p++; + /* FALLTHROUGH */ default: break; } diff --git a/libc/stdlib/lib_strtof.c b/libc/stdlib/lib_strtof.c index 467842f4e6..6571e2d77e 100644 --- a/libc/stdlib/lib_strtof.c +++ b/libc/stdlib/lib_strtof.c @@ -115,8 +115,10 @@ float strtof(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment position */ + /* FALLTHROUGH */ case '+': p++; + /* FALLTHROUGH */ default: break; } @@ -177,8 +179,10 @@ float strtof(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment pos */ + /* FALLTHROUGH */ case '+': p++; + /* FALLTHROUGH */ default: break; } diff --git a/libc/stdlib/lib_strtold.c b/libc/stdlib/lib_strtold.c index c306392cec..ac9368e893 100644 --- a/libc/stdlib/lib_strtold.c +++ b/libc/stdlib/lib_strtold.c @@ -113,8 +113,10 @@ long double strtold(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment position */ + /* FALLTHROUGH */ case '+': p++; + /* FALLTHROUGH */ default: break; } @@ -175,8 +177,10 @@ long double strtold(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment pos */ + /* FALLTHROUGH */ case '+': p++; + /* FALLTHROUGH */ default: break; }