[PATCH] D61288: [Diagnostics] Implemented support for -Wswitch-default

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 06:34:56 PDT 2019


aaron.ballman added a comment.

In D61288#1486006 <https://reviews.llvm.org/D61288#1486006>, @xbolva00 wrote:

> Some coding guidelines may require switch to have always default label. Even if devs know that default is not reachable, they can add default: abort(); or assert to increase safety (and warning will be silenced).
>
> Yes, it not suitable to be enabled by default, but I still think it is good to have it.


We typically don't add new, default-off warnings because experience has shown that users don't enable them. The coding guidelines argument is somewhat persuasive, but I wonder whether this is better handled through clang-tidy checks rather than the compiler itself -- that's where we put other diagnostics that may not be suitable for the compiler. Have you thought about surfacing this functionality that way?


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

https://reviews.llvm.org/D61288





More information about the cfe-commits mailing list