[SLOF] [PATCH] libc: Add missing fallthrough annotation

Philippe Mathieu-Daudé f4bug at amsat.org
Mon Jan 25 03:27:07 AEDT 2021


On Sun, Jan 24, 2021 at 7:05 AM Alexey Kardashevskiy <aik at ozlabs.ru> wrote:
> On 23/01/2021 04:21, Philippe Mathieu-Daudé wrote:
> > Silence warning when cross-compiling with GCC on Debian 10:
> >
> >    $ s390x-linux-gnu-gcc --version
> >    s390x-linux-gnu-gcc (Debian 8.3.0-2) 8.3.0
> >
> >    lib/libc/stdio/vsnprintf.c: In function 'print_format':
> >    lib/libc/stdio/vsnprintf.c:165:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >         upper = true;
> >         ~~~~~~^~~~~~
> >    lib/libc/stdio/vsnprintf.c:166:4: note: here
> >        case 'x':
> >        ^~~~
> >
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug at amsat.org>
>
>
> How did you trigger this exactly? If it is s390's qemu flags as Thomas
> says, then i am going to nack this and request a patch fixing all
> -Wextra and not just some reused bits, or wait until i do this myself :)

I haven't set any flag, and I don't think QEMU flags are passed because
QEMU sets convert warnings to errors.

Host is Ubuntu 18.04. Clang doesn't emit warning, GCC does.

- gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
- clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)

https://travis-ci.org/github/qemu/qemu/jobs/755867532


> And there is a question if i really have to update the slof.bin which i
> do not expect to change in noticeable way. hmmm. What would David say?
>
>
> > ---
> >   lib/libc/stdio/vsnprintf.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c
> > index 21dd04d..f292dd8 100644
> > --- a/lib/libc/stdio/vsnprintf.c
> > +++ b/lib/libc/stdio/vsnprintf.c
> > @@ -163,6 +163,7 @@ print_format(char **buffer, size_t bufsize, const char *format, void *var)
> >                               break;
> >                       case 'X':
> >                               upper = true;
> > +                             /* fall through */
> >                       case 'x':
> >                               sizec[i] = '\0';
> >                               value = (unsigned long) var & convert[length_mod];
> >
>
> --
> Alexey


More information about the SLOF mailing list