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

Thomas Huth thuth at redhat.com
Sun Jan 24 17:18:33 AEDT 2021

On 24/01/2021 07.00, Alexey Kardashevskiy wrote:
> On 23/01/2021 10:34, Segher Boessenkool wrote:
>> Hi!
>> On Fri, Jan 22, 2021 at 06:24:20PM +0100, Thomas Huth 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?
>> It is enabled by -W (aka -Wextra).  Everyone should always use that
>> option (along with -Wall), but I do not know if SLOF does.
> SLOF uses -Wall but not -Wextra which produces lot more warnings than this 
> patch is fixing.

I've tried it in a couple of projects already, but IMHO enabling -Wextra is 
a bad idea. With new versions of GCC, they often added "experimental" 
warnings with -Wextra which were just wrong in many cases. It also enables 
some rather annoying than helpful flags like -Wunused-parameter, so I'd 
suggest that we rather only add the helpful flags like 
-Wimplicit-fallthrough manually instead.


More information about the SLOF mailing list