<html><body 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;"><div>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></div></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><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></blockquote></div><div><br></div></body></html>