[cfe-dev] RFC redundant assignment in switch

Kyle Sluder kyle at ksluder.com
Sun Mar 30 19:47:56 PDT 2014


On Mar 28, 2014, at 1:52 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> Hi, Daniel. We already have this in Clang itself as -Wimplicit-fallthrough,

That warning triggers for every fallthrough. Daniel’s checker only triggers for assignments that are redundant with assignments made in cases that are fallen into.

These are philosophically different approaches, and they are mutually compatible. Even if -Wimplicit-fallthrough becomes useful to C/ObjC programmers via the __fallthrough macro, Daniel’s checker is still useful because it will catch logic bugs in code that redundantly assigns to the same variable in two different cases.

--Kyle Sluder



More information about the cfe-dev mailing list