[clang] [clang][Sema] Add -Wswitch-default warning option (PR #73077)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 24 03:31:08 PST 2023
cor3ntin wrote:
I'd like other to weight in on that but even though GCC has that flag (which clang recognizes and ignores), I'm, a bit reluctant to add a warning for it.
We have a policy to avoid off-by-default warnings most of the time... but more importantly, whether switch statements
should have a default is not something the industry seem to agree on, so it would be a very opinionated warning.
For example, Folks at google advise against using `default` when switching over an enum https://abseil.io/tips/147.
Misra requires a default statement, but makes an exception for enums. (6.4.6 in misra 2008)
LLVM development heavily relies on `-Wswitch-enum`, for example.
Maybe the existing tidy check is the right tool for this.
https://github.com/llvm/llvm-project/pull/73077
More information about the cfe-commits
mailing list