<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 11, 2011, at 6:13 PM, Nick Lewycky wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On 11 January 2011 17:47, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@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 class="im"><br>
On Jan 11, 2011, at 5:42 PM, Matt Beaumont-Gay wrote:<br>
<br>
> Author: matthewbg<br>
> Date: Tue Jan 11 19:42:42 2011<br>
> New Revision: 123297<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=123297&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=123297&view=rev</a><br>
> Log:<br>
> Prefer llvm_unreachable to assert(0)<br>
<br>
</div>Hi Matt,<br>
<br>
Please use assert(0) unless we need the "does not fallthrough" behavior of llvm_unreachable.<br></blockquote><div><br></div><div>The difference is that llvm_unreachable still generates code in a Release build while assert() doesn't, right?</div>

<div><br></div><div>Matt made this commit because we were seeing:</div><div><br></div><div>  llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp:653: error: control reaches end of non-void function [-Wreturn-type]</div><div><div><br>

</div></div><div>so it sounds like llvm_unreachable isn't the right tool, but we'd like to fix this that doesn't generate warnings in release builds.</div></div></blockquote><br></div><div>Please move the default case to the first part of the switch statement:</div><div><br></div><div>switch (whatever) {</div><div>default:  assert(0 && ...</div><div>case 0:</div><div><br></div><div>that way, in non-assert builds, the compiler still thinks everything is great.</div><div><br></div><div>-Chris</div><br></body></html>