"fall-through" errors
Jakub Jelinek
jakub@redhat.com
Sat Jul 28 17:57:00 GMT 2018
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.
Jakub
More information about the Gcc
mailing list