This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
[cgen] suggestion: improve error message
- From: DJ Delorie <dj at redhat dot com>
- To: binutils at sources dot redhat dot com, cgen at sources dot redhat dot com
- Date: Fri, 21 Oct 2005 20:07:58 -0400
- Subject: [cgen] suggestion: improve error message
If you use the wrong operand in an insn, you get a vague "assert:
indx" error. This replaces it with a (hopefully) more instructive
message, hopefully allowing you to *find* the error.
* operand.scm (-anyof-merge-syntax): Print a more useful error
message.
Index: operand.scm
===================================================================
RCS file: /cvs/src/src/cgen/operand.scm,v
retrieving revision 1.11
diff -p -U3 -r1.11 operand.scm
--- operand.scm 29 Jul 2005 18:51:24 -0000 1.11
+++ operand.scm 22 Oct 2005 00:04:39 -0000
@@ -1120,7 +1120,9 @@
(if (anyof-operand? e)
(let* ((name (obj:name e))
(indx (element-lookup-index name value-names 0)))
- (assert indx)
+ (if (not indx)
+ (error "Name " name " not one of " values)
+ )
(-anyof-syntax (list-ref values indx)))
e))
syntax-elements)))