This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Improve genmatch errors
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Sep 2015 12:15:11 +0200 (CEST)
- Subject: [PATCH] Improve genmatch errors
- Authentication-results: sourceware.org; auth=none
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);