public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Improve genmatch errors
@ 2015-09-17 10:16 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2015-09-17 10:16 UTC (permalink / raw)
  To: gcc-patches


For a misplaced :s like

(simplify
 (plus (minus@1:s @1 @2) (minus @2 @0))
 (plus @1 @0))

we were giving

test.pd:2:16 error: not implemented: predicate on leaf operand
 (plus (minus@1:s @1 @2) (minus @2 @0))
               ^

which is at least confusing.  The following patch improves this to

test.pd:2:16 error: expected expression operand
 (plus (minus@1:s @1 @2) (minus @2 @0))
               ^

also handling any other garbage after operands and rejecting

test.pd:2:21 error: expected expression operand
 (plus (minus:s@1 @1@2) (minus @2 @0))
                    ^
which was previously accepted.

Bootstrap on x86_64-unknown-linux-gnu in progress, no changes in
generated files.

Richard.

2015-09-17  Richard Biener  <rguenther@suse.de>

	* genmatch.c (parser::parse_expr): Improve error message
	for mis-placed flags.

Index: gcc/genmatch.c
===================================================================
--- gcc/genmatch.c	(revision 227779)
+++ gcc/genmatch.c	(working copy)
@@ -3857,6 +3858,9 @@ parser::parse_expr ()
 	  e->expr_type = expr_type;
 	  return op;
 	}
+      else if (!(token->flags & PREV_WHITE))
+	fatal_at (token, "expected expression operand");
+
       e->append_op (parse_op ());
     }
   while (1);

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

only message in thread, other threads:[~2015-09-17 10:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-17 10:16 [PATCH] Improve genmatch errors Richard Biener

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