<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 14, 2014, at 11:31 , Nico Weber <<a href="mailto:thakis@chromium.org">thakis@chromium.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 14, 2014 at 10:00 AM, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>The analyzer tries not to give results that are already covered by regular Clang warnings. This is sometimes problematic, since the Clang warnings may not be on by default. Nevertheless...</div>
<br><div><div class=""><div>On Mar 11, 2014, at 19:53 , apache <<a href="mailto:ehcapa@qq.com" target="_blank">ehcapa@qq.com</a>> wrote:</div><br><blockquote type="cite"><div>----------------------------------------------------------------------</div>
<div>1.case without break</div><div>e.g.</div><div>int test(const int n) {</div><div>    int ret = 0;</div><div>    switch(n) {</div><div>    case 1:</div><div>        ret = 1;</div><div>        break;</div><div>    case 2:</div>
<div>        ret = 2; // this case branch has no 'break' statement.(coverity gived a warning here, but Clang didn't)</div><div>    default:</div><div>        break;</div><div>    }</div><div>    return ret;</div>
<div>}</div></blockquote><div><br></div></div><div>This is supposed to be -Wimplicit-fallthrough, but I don't see it working either! Richard, do you know what's going on here?</div></div></div></blockquote><div><br>
</div><div>In general, -Wimplicit-fallthrough does warn on this, which I mostly consider a bug: Falling through to a default: branch that contains nothing but a break is a) safe b) relatively common, so I think this shouldn't warn. (But it currently does, at least in blink.)</div>
</div></div></div></blockquote><br></div><div>I tried adding a "ret = 3" too, and it still didn't warn. I'm not sure why.</div><div><br></div><div>Jordan</div><br></body></html>