<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;">Nope!&nbsp;If there is no statement between case labels, there will be no warning.<div><br></div><div>Follow the link for a more complete description of cases:<div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>&lt;<a href="http://clang.llvm.org/docs/LanguageExtensions.html#the-clang-fallthrough-attribute">http://clang.llvm.org/docs/LanguageExtensions.html#the-clang-fallthrough-attribute</a>&gt;</div><div><br></div><div>- Joe</div></div></div><br><div><div>On Jan 26, 2014, at 10:23 AM, Brady Eidson &lt;<a href="mailto:beidson@apple.com">beidson@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I like this!<div><br></div><div>Out of curiosity, will it be needed for cases like:</div><div><br></div><div>switch (input) {</div><div>case 1: &nbsp;// fallthrough?</div><div>case 2:</div><div>&nbsp; &nbsp; // Handle both 1 and 2</div><div>&nbsp; &nbsp; break;</div><div>default:</div><div>&nbsp; &nbsp; // default</div><div>}</div><div><br></div><div>Thanks,</div><div>~Brady</div><div><br><div><div>On Jan 26, 2014, at 1:41 AM, Joseph Pecoraro &lt;<a href="mailto:pecoraro@apple.com">pecoraro@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello!</div><div><br></div><div>I'm slowly enabling -Wimplicit-fallthrough on projects in the Mac / iOS ports.</div><div>&lt;<a href="http://trac.webkit.org/changeset/162793">http://trac.webkit.org/changeset/162793</a>&gt;</div><div>&lt;<a href="http://clang.llvm.org/docs/LanguageExtensions.html#the-clang-fallthrough-attribute">http://clang.llvm.org/docs/LanguageExtensions.html#the-clang-fallthrough-attribute</a>&gt;</div><div><br></div><div>This means that if you write any switch statements with implicit fallthroughs it will produce build errors in projects with the warning enabled.</div><div><br></div><div>If you're writing a switch with a fallthrough, use the "FALLTHROUGH;" annotation (which expands to [[clang::fallthrough]];) to appease the warning.</div><div><br></div><div>The intent of this warning is to catch at compile time any accidental switch fallthroughs, and therefore explicitly annotate everywhere a fallthrough was intended.</div><div><br></div><div>Thanks,</div><div>- JoePeck</div><div><br></div><div>--</div><div><br></div><div>For example. Here is a switch with an implicit fallthrough but no compiler recognized annotation:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>switch (input) {</div><div>case 1:</div><div>&nbsp; &nbsp; output -= 5;</div><div>&nbsp; &nbsp; // fallthrough</div><div>default:</div><div>&nbsp; &nbsp; output += 5;</div><div>}</div></div><div><br></div></blockquote></div><div>When the warning is enabled you will see a build error like:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">main.cpp:9:5:&nbsp;warning:&nbsp;unannotated fall-through between switch labels [-Wimplicit-fallthrough]<br>&nbsp; &nbsp;&nbsp;default:<br>&nbsp; &nbsp;&nbsp;^<br>main.cpp:9:5:&nbsp;note:&nbsp;insert 'FALLTHROUGH;' to silence this warning<br>&nbsp; &nbsp;&nbsp;default:<br>&nbsp; &nbsp;&nbsp;^<br>&nbsp; &nbsp;&nbsp;FALLTHROUGH;&nbsp;<br>main.cpp:9:5:&nbsp;note:&nbsp;insert 'break;' to avoid fall-through<br>&nbsp; &nbsp;&nbsp;default:<br>&nbsp; &nbsp;&nbsp;^<br>&nbsp; &nbsp;&nbsp;break;&nbsp;<br><br></blockquote>Use "FALLTHROUGH;" to annotate the fallthrough and build without errors:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>switch (input) {</div><div>case 1:</div><div>&nbsp; &nbsp; output -= 5;</div><div>&nbsp; &nbsp; FALLTHROUGH;</div><div>default:</div><div>&nbsp; &nbsp; output += 5;</div><div>}</div></blockquote></div><div><br></div></div>_______________________________________________<br>webkit-dev mailing list<br><a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br><a href="https://lists.webkit.org/mailman/listinfo/webkit-dev">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br></blockquote></div><br></div></div></blockquote></div><br></div></div></body></html>