This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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)))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]