From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106346 invoked by alias); 17 Sep 2015 10:15:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 106334 invoked by uid 89); 17 Sep 2015 10:15:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 17 Sep 2015 10:15:14 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 24E4EAC65 for ; Thu, 17 Sep 2015 10:15:11 +0000 (UTC) Date: Thu, 17 Sep 2015 10:16:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Improve genmatch errors Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-09/txt/msg01270.txt.bz2 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 * 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);