<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><<a href="http://trac.webkit.org/changeset/162793">http://trac.webkit.org/changeset/162793</a>></div><div><<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>></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> output -= 5;</div><div> // fallthrough</div><div>default:</div><div> 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: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]<br> default:<br> ^<br>main.cpp:9:5: note: insert 'FALLTHROUGH;' to silence this warning<br> default:<br> ^<br> FALLTHROUGH; <br>main.cpp:9:5: note: insert 'break;' to avoid fall-through<br> default:<br> ^<br> break; <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> output -= 5;</div><div> FALLTHROUGH;</div><div>default:</div><div> output += 5;</div><div>}</div></div></blockquote></div><div><br></div></body></html>