public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* [commit] better error message for misspelled rtx function name
@ 2009-11-01 21:11 Doug Evans
  0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2009-11-01 21:11 UTC (permalink / raw)
  To: cgen

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-01 21:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-01 21:11 [commit] better error message for misspelled rtx function name Doug Evans

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