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

Alexey Kardashevskiy aik at ozlabs.ru
Sun Jan 24 17:04:58 AEDT 2021



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 :) 
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