[SLOF] [PATCH] libc: Add missing fallthrough annotation
segher at kernel.crashing.org
Sun Jan 24 19:57:33 AEDT 2021
On Sun, Jan 24, 2021 at 07:18:33AM +0100, Thomas Huth wrote:
> On 24/01/2021 07.00, Alexey Kardashevskiy wrote:
> >On 23/01/2021 10:34, Segher Boessenkool wrote:
> >>On Fri, Jan 22, 2021 at 06:24:20PM +0100, Thomas Huth wrote:
> >>>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.
It is a lot of work if you enable it on a bigger existing codebase. It
is a lot less work if you enable it right from the start. I recommend
-Wall -W -Wmissing-declarations -Wformat=2 for all new code.
> With new versions of GCC, they often added "experimental"
> warnings with -Wextra which were just wrong in many cases.
Like? I don't remember any noisy warnings added to -Wextra in the last
The most annoying one is -Wsign-compare, but that one pretty much always
points to real bugs (*future* bugs, the worst kind!)
> 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.
You can disable just one warning if you think it is annoying (just use
-Wno-unused-parameter in this case). But all warnings in -Wextra are
easy to avoid, and all of them point to potentially serious problems
(that is the requirement for putting a warning in -Wextra; for -Wall it
is the same but more so).
More information about the SLOF