[cfe-dev] Unreachable code warning change
Morrell, Michael
michael.morrell at intel.com
Mon Jan 5 12:36:09 PST 2015
It looks like the behavior for unreachable code has changed recently.
Given this source:
===========================
int foo(int x)
{
switch (x) {
case 1:
return 1;
break;
}
return 0;
}
============================
When I run this clang:
Apple LLVM version 5.0 (clang-500.0.68) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
I get the following:
% clang -Wunreachable-code -c unreach.c
unreach.c:6:11: warning: will never be executed [-Wunreachable-code]
break;
^~~~~
1 warning generated.
But, when I run this clang:
Apple LLVM version 6.0 (clang-600.0.34) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
I get no warning.
Is this an expected change?
Michael
More information about the cfe-dev
mailing list