public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: binutils@sources.redhat.com, cgen@sources.redhat.com
Subject: [cgen] suggestion: improve error message
Date: Sat, 22 Oct 2005 00:08:00 -0000	[thread overview]
Message-ID: <200510220007.j9M07wPR023488@greed.delorie.com> (raw)


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

             reply	other threads:[~2005-10-22  0:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-22  0:08 DJ Delorie [this message]
2005-10-22  2:15 ` Frank Ch. Eigler
2005-10-24 22:57   ` DJ Delorie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200510220007.j9M07wPR023488@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=cgen@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).