<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Chris,</div><div><br></div><div>On Mar 31, 2010, at 5:57 PM, Chris Lattner wrote:</div><blockquote type="cite"><div>Please don't check in #if 0'd code. </div></blockquote><div><br></div><div>thanks, fixed.</div><br><blockquote type="cite"><div> The idiom that we use in other apis that can fail is something like this:<br><br>int dosomething_that_could_fail(..., std::string *Error) {<br><br>...<br>  // Oh crap an error happened!<br>  if (Error) *Error = "whatever";<br>  return -1;<br>}<br><br>Then clients can handle this or not with code like:<br>std::string ErrorInfo;<br>if (dosomething_that_could_fail(..., &ErrorInfo) == -1)<br>  print(ErrorInfo); // or whatever.<br></div></blockquote><div><br></div>That's probably a reasonable approach, assuming we can get other code to sign on to doing this and returning -1 instead of calling llvm_unreachable and – in NDEBUG builds – misbehaving silently.</div><div><br><blockquote type="cite"><div>However, I don't see how error messages from the disassembler are going to be very useful.  Errors like:<br><br>Corrupt table!  Unknown modrm_type<br>Cannot have Mod = 0b11 and a SIB byte<br>Expected a REG or R/M encoding in fixupReg<br>No modifier but an operand expects one.<br><br>Are not going to mean anything to anyone.  I don't think there is such thing as a useful error message that can come out of a disassembler other than "unrecognized instruction".  Given this, I don't see the value in an error reporting api at all here.<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>I'll just have error() call fprintf(stderr) unless NDEBUG is defined.  New patch attached.<br><br><blockquote type="cite"><div>-Chris</div></blockquote><br></div><div>Sean</div><div><br></div></body></html>