clang: Support -Wswitch-unreachable
Open
clang:diagnostics
enhancement
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
gcc 16 supports -Wswitch-unreachable
https://godbolt.org/z/b6KeT85P5
:6:5: warning: statement will never be executed [-Wswitch-unreachable]
Clang trunk doesn't show this warning under -Wall or -Wextra.
Gcc correctly doesn't show warning for nested loop/switch case:
https://godbolt.org/z/8Y8bjdWG8
Contributor guide
Research direction
Start by reproducing the GCC 16 behavior from the first Godbolt example and compare it with Clang trunk under -Wall and -Wextra. Use the nested loop/switch example to verify the warning is not emitted there; done means Clang supports -Wswitch-unreachable with the same distinction.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100