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

Thomas Huth thuth at redhat.com
Sat Jan 23 04:24:20 AEDT 2021


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?

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



More information about the SLOF mailing list