[LLVMbugs] [Bug 20950] variable reassignment in switch not detected ?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 15 13:08:18 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20950

Reid Kleckner <rnk at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rnk at google.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from Reid Kleckner <rnk at google.com> ---
We have a related warning under -Wimplicit-fallthrough, but it isn't on by
default due to false positives on existing code bases.


$ clang++ t.cpp -c -Wimplicit-fallthrough
t.cpp:8:5: warning: unannotated fall-through between switch labels
[-Wimplicit-fallthrough]
    case 2: m = 3;
    ^
t.cpp:8:5: note: insert '[[clang::fallthrough]];' to silence this warning
    case 2: m = 3;
    ^
    [[clang::fallthrough]];
t.cpp:8:5: note: insert 'break;' to avoid fall-through
    case 2: m = 3;
    ^
    break;
t.cpp:9:5: warning: unannotated fall-through between switch labels
[-Wimplicit-fallthrough]
    case 3: m = 4;
    ^
t.cpp:9:5: note: insert '[[clang::fallthrough]];' to silence this warning
    case 3: m = 4;
    ^
    [[clang::fallthrough]];
t.cpp:9:5: note: insert 'break;' to avoid fall-through
    case 3: m = 4;
    ^
    break;
t.cpp:10:5: warning: unannotated fall-through between switch labels
[-Wimplicit-fallthrough]
    case 4: m = 5;
    ^
t.cpp:10:5: note: insert '[[clang::fallthrough]];' to silence this warning
    case 4: m = 5;
    ^
    [[clang::fallthrough]];
t.cpp:10:5: note: insert 'break;' to avoid fall-through
    case 4: m = 5;
    ^
    break;
3 warnings generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140915/126f6b2b/attachment.html>


More information about the llvm-bugs mailing list