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

Philippe Mathieu-Daudé f4bug at amsat.org
Sat Jan 23 05:28:10 AEDT 2021


On Fri, Jan 22, 2021 at 6:24 PM Thomas Huth <thuth at redhat.com> wrote:
> On 22/01/2021 18.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=]
>
> Is -Wimplicit-fallthrough enabled by default there? Or did you enable it?

I am using defaults.

I just checked and this also happens with QEMU CI:
https://travis-ci.org/github/qemu/qemu/jobs/755671724#L1830

>
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug at amsat.org>
> > ---
> >   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];
> >
>
> Reviewed-by: Thomas Huth <thuth at redhat.com>

Thanks!

Phil.


More information about the SLOF mailing list