[cfe-dev] Unreachable code warning change

David Blaikie dblaikie at gmail.com
Mon Jan 5 23:21:29 PST 2015


+Ted who made some changes to unreachable-code after the whole "goto fail"
thing.

On Mon, Jan 5, 2015 at 12:36 PM, Morrell, Michael <michael.morrell at intel.com
> wrote:

> 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
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150105/38b7ede5/attachment.html>


More information about the cfe-dev mailing list