[PATCH] D107933: [clang] Expose unreachable fallthrough annotation warning

Nathan Chancellor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 12 13:03:11 PDT 2021


nathanchance added a comment.

> In D107933#2942023 <https://reviews.llvm.org/D107933#2942023>, @xbolva00 wrote:
>
>> 
>
> GCC does not warn (with common -Wall) for this case, right? I think Clang should not as well.

Correct, GCC does not warn at all about unreachable fallthrough annotations as far as I am aware.

In D107933#2942102 <https://reviews.llvm.org/D107933#2942102>, @dblaikie wrote:

> In D107933#2942023 <https://reviews.llvm.org/D107933#2942023>, @xbolva00 wrote:
>
>> ImplicitFallthroughUnreachable could be enabled with -Wunreachable-code, if you think we should have it.
>
> Yeah, some of that was discussed on the bug: https://bugs.llvm.org/show_bug.cgi?id=51094 & I'd still be in favor of that sort of direction. I might go so far as to say: Maybe we should drop this warning flag (and/or move it under -Wunreachable-code - questionable, I don't think anyone's really using that, it's pretty noisy still, I think) entirely even if no one's willing to reimplement it more robustly... not sure.

The kernel does not use `-Wunreachable-code` for this reason and several others; we have explored it in the past <https://github.com/ClangBuiltLinux/linux/issues/1180> and found that there were pretty much no instances where the warnings indicated a bug and kernel maintainers were irritated with some of the patches sent. So moving this warning under there (as `-Wunreachable-code-fallthrough`?) would work for us. I do not have a strong opinion though. I am more than happy to remove the warning entirely as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107933/new/

https://reviews.llvm.org/D107933



More information about the cfe-commits mailing list