public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@sebabeach.org>
To: cgen@sourceware.org
Subject: [commit] better error message for misspelled rtx function name
Date: Sun, 01 Nov 2009 21:11:00 -0000	[thread overview]
Message-ID: <20091101211143.070FA6E3D5@sebabeach.org> (raw)

Hi.

This patch improves the error messages for accidentally mistyped rtl
expressions like (add ((const) 1) 2).  [Note the parens around `const'.]

Most of the patch is just due to indentation changes.

2009-11-01  Doug Evans  <dje@sebabeach.org>

	* rtl-traverse.scm (/rtx-canon): Issue better error message for
	invalid rtx function names.

Index: rtl-traverse.scm
===================================================================
RCS file: /cvs/src/src/cgen/rtl-traverse.scm,v
retrieving revision 1.15
retrieving revision 1.17
diff -u -p -r1.15 -r1.17
--- rtl-traverse.scm	25 Sep 2009 19:40:08 -0000	1.15
+++ rtl-traverse.scm	1 Nov 2009 21:09:57 -0000	1.17
@@ -1182,16 +1182,20 @@
   (let ((result
 	 (if (pair? expr) ;; pair? -> cheap non-null-list?
 
-	     (let ((rtx-obj (rtx-lookup (car expr))))
-	       (if rtx-obj
-		   (/rtx-canon-expr rtx-obj mode (car expr) (cdr expr)
-				    parent-expr op-num cstate env depth)
-		   (let ((rtx-obj (/rtx-macro-lookup (car expr))))
-		     (if rtx-obj
-			 (/rtx-canon (/rtx-macro-expand expr rtx-evaluator)
-				     expected mode parent-expr op-num cstate env (+ depth 1))
-			 (/rtx-canon-error cstate "unknown rtx function"
-					   expr parent-expr op-num)))))
+	     (let ((rtx-name (car expr)))
+	       (if (not (symbol? rtx-name))
+		   (/rtx-canon-error cstate "invalid rtx function name"
+				     expr parent-expr op-num))
+	       (let ((rtx-obj (rtx-lookup rtx-name)))
+		 (if rtx-obj
+		     (/rtx-canon-expr rtx-obj mode rtx-name (cdr expr)
+				      parent-expr op-num cstate env depth)
+		     (let ((rtx-obj (/rtx-macro-lookup rtx-name)))
+		       (if rtx-obj
+			   (/rtx-canon (/rtx-macro-expand expr rtx-evaluator)
+				       expected mode parent-expr op-num cstate env (+ depth 1))
+			   (/rtx-canon-error cstate "unknown rtx function"
+					     expr parent-expr op-num))))))
 
 	     ;; EXPR is not a list.
 	     ;; See if it's an operand shortcut.

                 reply	other threads:[~2009-11-01 21:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20091101211143.070FA6E3D5@sebabeach.org \
    --to=dje@sebabeach.org \
    --cc=cgen@sourceware.org \
    /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).