On Sat, Jul 28, 2018 at 10:44 AM Jakub Jelinek <ja...@redhat.com> wrote: > > On Sat, Jul 28, 2018 at 10:22:35AM -0700, Bruce Korb wrote: > > ../../autoopts/makeshell.c: In function ‘text_to_var’: > > ../../autoopts/makeshell.c:324:14: error: this statement may fall > > through [-Werror=implicit-fallthrough=] > > (*(opts->pUsageProc))(opts, EXIT_SUCCESS); > > ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > This warning goes away if the comment "/* FALLTHROUGH */ is present. > > You are missing a condition: > > > > switch (which) { > > case TT_LONGUSAGE: > > (*(opts->pUsageProc))(opts, EXIT_SUCCESS); > > /* NOTREACHED */ > > > > Please add the exception for a "/* NOTREACHED */" comment. Thank you. > > NOTREACHED means something different, and I don't think we want to add > support for this when we already support a way (including a standard way) to > mark function pointers noreturn (noreturn attribute, _Noreturn in C). > Or you can use -Wimplicit-fallthrough=1 where any kind of comment no matter > what you say there will disable the implicit fallthrough warning.
Messing with "noreturn" means messing with autoconf configury and you have no idea how much I have always hated that horrific environment. Using the "implicit-fallthrough=1" thingy means the same thing, but making sure it is GCC and not Clang. That is why using the "obvious" implication that if a function does not return, then you won't "accidentally" fall through either. Rather than mess with all that, do both: /* FALLTHROUGH */ /* NOTREACHED */ I think it would be good to reconsider NOTREACHED. Once upon a time, I segregated out -Wformat-contains-nul. I could offer again, but it would be a long time for the round tuit and it would be hard for me.